Digital Sound & Music: Concepts, Applications, & Science, Chapter 3, last updated 6/25/2013
43
Figure 3.52 Max patcher unlocked, accessible to the programmer
With all the patcher objects exposed and the main patcher unlocked, you can now see
how the program is initialized and how the user is able to trigger the sending and receiving of
messages by selecting from a menu, turning the dial to set a tempo, and clicking the mouse on
the keyboard display. Here’s how the program runs:
The loadbang object is triggered when the program begins. It is used to initialize the
tempo to 120 bpm and to set the default MIDI output device. Both of these can be
changed by the user.
The user can select a type of scale from a menu. The list of intervals is set accordingly
and sent in the variable scalesintervals, to be received by the handlescale patcher object.
The user can select a tempo through the dial object. The input value is sent to the
metronome patcher object to determine the timing of the notes played in the scale.
The user can click a key on the keyboard object. This initiates the playing of a scale by
sending a keyhit message to both the metronome and the handlescale patcher.
When the metronome patcher receives the keyhit message, it begins sending a tick every
n milliseconds. The value of n is calculated based on the bpm value. Each tick of the
metronome is what Max calls a bang message, which is used to trigger buttons and set
actions in motion. In this case, the bang sets off a counter in the handlescale patcher,
which counts out the correct number of notes as it plays a scale. The number of notes to
play for a given type of scale is determined by a lookup list in the zl object, a
multipurpose list processing object.
Previous Page Next Page