One can apply functions to the properties of event lists, as in the following example, which creates a drum roll and applies a crescendo modifier to it.
[ | roll decresc |
roll := ((Roll length: 3 rhythm: 0.06 note: 60) ampl: 120) eventList.
decresc := Swell function: (ExponentialFunction from: #((0 0 2) (1 1))).
decresc applyTo: roll.
roll open]
Similarly, the following changes the tempo of the drum roll.
[ | roll rub |
roll := ((Roll length: 5 rhythm: 0.1 note: 60) ampl: 80) eventList.
rub := Rubato function: (LinearFunction from: #((0 1) (1 0.5))).
rub applyTo: roll.
roll open]
or this example, where the rubato is a sine curve with an offset
[ | roll sin rub |
roll := ((Roll length: 5 rhythm: 0.1 note: 60) ampl: 80) eventList.
sin := (FourierSummation from: #((1 0.1 0))) + 1.0.
rub := Rubato function: sin.
rub applyTo: roll.
roll open]
All of these work by sending the message
anEventList applyFunction: aFunction to: aSelector startingAt: sTime
which can be used for many other situations.
There are many other examples of using functions with event lists in the MIDI, OSC, and CSL I/O examples.