Describing Musical Events |
Nested control structures and the special variables start and end |
Comparison with Csound |
Streams of Events and IterationOften it is necessary to repeat some simple event iteratively in order to form a stream of similar events. One example of this might be repeatedly striking an object at short (random) intervals in order to create a dense granular texture. This section describes a common technique for implementing such streams of events 2.In order to describe an iterated event we will use the technique of nested control structures described in the previous section, but in a particular way, which allows an event to reschedule itself once its time is up. The following example script schedules a series of events to occur at one second intervals. Each individual event is trivial in nature, simply printing a message to the shell window showing the time at which it occurs (performance-time, not real-time). Audio rate: 44100; Param eventStart=0.0, eventDur=0.01, interval=1.0; Init: ... Score 10 secs: At eventStart for eventDur: At start: Print "Time=", Time, newline; ... At end: eventStart += interval; ... ... ... The first thing to note about this script is that it contains a
hierarchy of nested control structures. The outermost The script produces the following output: Sample rate=44100 KHz Score duration=10 seconds Time=0 Time=1 Time=2 Time=3 Time=4 Time=5 Time=6 Time=7 Time=8 Time=9 Time=10 Of course the time interval between events does not have to be fixed.
The value by which the
| ||
Describing Musical Events |
Nested control structures and the special variables start and end |
Comparison with Csound |
©1999,2000 Mark Pearson
m.pearson@ukonline.co.uk April 30, 2000 |