Wednesday, August 6, 2008

Repetition at a steady rate

The act of composing any time-based art such as film or video or music is the placement of events in time such that they serve as markers of the passage of time, describing a rate (speed) or rhythm (pattern) of the passage of time.

The most simple such composition (beyond a single isolated event) is a regularly repeating event. As Curtis Roads pointed out in his article "Time Scales in Music" in his book Microsound, we measure time in many different orders of magnitude, from the infinite to the infinitesimal. But more appropriately in most musical situations we speak of time ranging from the large formal scale (a section, phrase, or measure) down to the small sonic level (a chord or note or a small fraction of a second). At the acoustic or digital level, we might even break it down to milliseconds or microseconds. But periodicity, rate, and pattern can all be established by regular repetition at any or all of these different magnitudes of scale.

This program shows the most basic way to create timed repetition of an event in Max.

In Max, amounts of time are usually expressed in milliseconds. (Time can also be expressed in a more music-specific way, relative to a specified beat tempo. Tempo-relative time is discussed in another lesson.) The millisecond interval provided to the metro object is the amount of time that will be allowed to pass between output messages. The metro object sends out the most basic triggering message, bang, which is understood by most other Max objects to mean "do it". In this program each trigger causes a momentary flash of color and a sound of minimal duration; those things were chosen to symbolize the simplest possible visual and sonic events.

The process being exemplified here is that of repeated "scheduling" of an event to happen at a future time. The metro object takes care of that for us; when it is turned on it sends out a bang and also schedules the next bang to occur after a specified interval of time. When metro is turned off, the scheduled future bang is cancelled, so the whole process stops. Not all programming languages encapsulate the whole process quite that neatly, so in many languages the programmer has to specify the whole process of "do the task", "schedule a future repetition of the task", and "cancel the scheduled task" explicitly.

No comments: