Max Tutorial #3: Customizing a Pitch Sequence

This tutorial builds on the concepts in Tutorial #2 by building a sequencer in which the pitch of each step of the sequence can be customized. We begin with the [metro] and [counter] objects to determined how many steps are in the sequence, and how fast we move through the sequence. Instead of using the [sel] object to trigger sound for each step, however, we’ll use a new object called the [multislider]. When you create the [multislider] object, like [function] the name will disappear and you’ll be presented with a dark-colored rectangle.

The [multislider] object allows you to customize the number of sliders it contains. In our patch, each slider will represent a single step. As before, we’ll use eight steps total in our sequence. To set the number of sliders, we need to open the object Inspector. To access the Inspector, unlock the patch, click on the object so that it is highlighted, and then hover over the left side of the object. Click on the yellow circle that appears and choose Inspector. The Inspector will pop up on the right side of the screen.

Scroll down to the bottom of the Inspector, and you will find three parameters that we will change: Number of Sliders, Range, and Sliders Output Values. (If you don’t see these options, click All, next to Basic, Layout, and Recent at the top of the Inspector.) Set the Number of Sliders to eight. We will use standard MIDI note numbers for our pitches, so we change to range to the MIDI standard range of 0 to 127 (separated by a space as in the video). Finally, because we are using MIDI, we are only interested in integers, so we change the Sliders Output Values accordingly.

Once we’re finished with the Inspector, we can return to the patch and resize the [multislider] so it will be easier to see. If we lock the patch and click inside of the [multislider], we see there are eight distinct sliders which can be arranged freely. The vertical position of each slider will represent the pitch of each sequencer step.

In order to connect the [counter] to the [multislider], we have to use a message box (shortcut “m”). Type “fetch $1” into the message box. In this case, “fetch” tells the [multislider] object to output the value of the slider corresponding with the current step as determined by the counter. The “$1” portion of the message is a “dummy variable” that is automatically replaced by whatever value goes into the message box. Since [counter] is sending out the numbers one through eight over and over again, the [multislider] interprets the incoming messages as “fetch 1,” “fetch 2,” “fetch 3,” etc. Each time it receives this message, it outputs the value of that slider, which we will use to control the pitch of our sequencer shortly. We can verify all of this by adding some integer boxes (“i”) and turning on [metro], as in the video.

Next, we will create a simple synthesizer using the same objects as in the previous tutorial. The only change in this video is the use of a different oscillator—instead of a sine wave, we’ll use [saw~], which generates a sawtooth waveform. This doesn’t have any impact on the functionality of the patch—it just gives the sound a different, richer timbre.

The final step is connecting the two halves of the patch. We can think of the left half of the patch as the “control” part of the patch, and the right half of the patch as the “audio” part of the patch. There are two pieces of information we have to pass from left to right: when each note is triggered, and the pitch of each note. We can pass this information along using the [trigger] object, or [t] for short. The [t] object takes as its arguments the kind of information we wish to pass through. In this case, we want to send an integer (“i”) to set the pitch of the oscillator, and a “bang” (“b”) to trigger the envelope. The [t] object also helps us set the order in which information is sent: arguments are sent in order from right to left. So if we type in [t b i], the integer, representing pitch, will be sent first, followed by the bang for the envelope generator. Sometimes the order doesn’t matter, but it is best practice to update the pitch of a sound before actually triggering it.

The final step is to connect the outlets of the [t b i] object to the oscillator and envelope generator. The bang should be connected to the envelope generator with a button as before. The integer, however, must be converted from a MIDI note number to a frequency value (in Hertz), as all of the oscillator objects expect frequency values to determine pitch. Therefore, we use an object called [mtof] which converts from MIDI note numbers to frequency before passing the pitch information through to the oscillator. Once this is complete, we can lock the patch, turn on the audio, turn up the volume, and explore the different possible patterns of our sequencer.