Generators¶
An option available to make events more dynamic is to use special tokens to define its parameters. In general, these generators define a particular scope from which random values will be drawn.
Pitch¶
Pitch can be randomized in three ranges:
lowPitch = pitch between C0 and C3
midPitch = pitch between C3 and C5
highPitch = pitch between C5 and C7
For example:
Loudness¶
Generators for loudness can be accessed from three tokens:
soft = amplitude between 0.01 and 0.1
midlevel = amplitude between 0.1 and 0.4
loud = amplitude between 0.4 and 0.9
An example, in context:
Start time¶
Generators for scheduling the start time in the future can be accessed from three tokens:
now = start between 0.01 and 0.5 seconds
soon = start between 0.5 and 4 secons
later = start between 4 and 8 seconds
For example:
Durations¶
Durations can be randomized with these three tokens:
shortDur = durations between 0.05 and 0.2 seconds
midDur = durations between 0.2 and 2 secons
longDur = durations between 2 and 5 seconds
For example:
Drums family¶
Two generators can be used to get different types of drums for the what attribute:
For example:
Instrument groups¶
Additionally, random instruments that belong to a same group can be called in
the last attribute of play():
onStruck
onSus
onPluck
onBass
onBowed
onEnsemble
onVoice
onBlow
onWind
onLead
onSynth
onFx
onPerc
onDrums
For context, an example combining everything we learned here:
Warning: notice that sustained sounds will play forever if not called with an specified duration!
Finally, any instrument can be randomly called with: