Max Tutorial #2: Making a Clave

This tutorial expands on concepts from Max Tutorial #1 by adding sound to the sequence and creating a clave-like repeated musical pattern. In the first part of the video, we produce a simple, sustained sine tone by using the [cycle~] object, which is a sine wave oscillator. The signal flows through a [gain~] object, which controls the volume, and finally passes to the [dac~] object, a digital-to-analog converter, so that the sound will be audible through your speakers. The frequency of the sine wave is determined by a number box. This time we use “f” as a shortcut to create a floating-point number box so that we can enter decimal values (as opposed to the integer number box we used in the first tutorial).

In order to hear sound in Max, the audio must be turned on in the lower-right corner. The icon will turn blue when the audio is on. Normally the audio should be on when you’re performing or testing, and off when you’re programming. The next step is to build a simple synthesizer by applying an envelope to the sine wave. We can draw the shape of an envelope by using an object called [function], and then passing the output of the second-from-left outlet into an object called [line~]. To draw a shape in [function], the patch must be locked. Then simply click to place points (shift-click to delete a point), and make sure your starting and ending points are all the way to the bottom of the window (the points will turn “hollow”).

In a traditional synthesizer, the envelope generator and sound source are combined using a voltage-controlled amplifier, or VCA. In Max, we can use the multiplication object [*~] as shown in the video. Note that objects whose name ends with a tilde (“~”) are specifically audio objects, whereas other objects do not necessarily relate directly to audio, and so are called control objects. For instance, [function] does not have a tilde, so we have to convert its output to an audio signal by passing it through [line~]. We can trigger the envelope by connecting a button to the top of [function] and clicking on it.

Finally, we can recreate the patch from the first tutorial in order to create an eight-step pattern. We can choose which steps of the pattern should have sound, and then connect them to the envelope generator via the numbered outlets of [sel], as shown. The result is a looping musical pattern. In future tutorials, we will expand this sequencing concept so that we can include different notes.

Max Tutorial #1: Building a Sequence with [metro]

This is the first in an instructional video series for using Max, a visual programming language for music and many other things. When you open up a new patch, note the lock icon in the lower-left corner. This allows you to lock and unlock the patch. Generally, a patch should be unlocked for editing and locked for testing and performing. The keyboard shortcut on a Mac is command+E, and control+E on a PC.

To create new items in the Max environment, first unlock the patch. Then type “n” to create a new object. This first object will be a metronome, called “metro.” Type “metro” to create the metronome object. The next object is a toggle, which we’ll use as an on/off switch for the metronome. Type “t” to create a toggle and connect it as shown in the video.

The next element is a number box, which will determine how fast the metronome clicks. There are two types of number boxes in Max: integer and decimal (or floating point). We’ll use the integer number box (the shortcut is “i”) since we don’t need decimal values. By default, we set the timing of the metronome by specifying how many milliseconds (1/1000th of a second) between clicks. (To change the number you have to lock the patch.)

Then we’ll unlock the patch again and press “b” to create a button. Buttons can be used to trigger things or to show when something has been triggered. We’ll use it to visualize the clicking of the metronome. When the patch is locked, you can type new values into the number box or use the mouse to drag the value up and down. Because the metronome measures time in milliseconds, lower values correspond to a faster tempo (less time between clicks) and higher values correspond to a slower tempo (more time between clicks).

In order to create a musical pattern, as with a sequencer, we have to be able to split the metronome pulse into separate steps or beats. We can do this by running the metronome into an object called [counter]. The arguments “1 8” indicate that the count will loop between 1 and 8, like an eight-step sequencer, at the speed dictated by the metronome. We can add a number box below the [counter] to visualize the steps.

Next, we can divide up the steps by using an object called [sel] (short for “select”). We’ll add an argument for each step (“1 2 3 4 5 6 7 8”). We can expand the size of the object by dragging the lower-right corner—this will help us be able to see all of the different outlets at the bottom of the object. By connecting a button to each of the first eight outlets of [sel], we can visualize the metronome click corresponding to each step. (We’ll ignore the last, rightmost outlet of [sel] for now.)

Finally, we can convert the metronome input control to tempo (in beats per minute, or BPM) instead of milliseconds. To convert from BPM to seconds, we divide 60 by the BPM (i.e. 60/60 = 1 second). To convert from BPM to milliseconds, we divide 60,000 by the BPM (60000/60= 1000 milliseconds). The object we will use to divide is [!/] with an argument of “60000” to specify the numerator. Now we can set a BPM for the metronome using a number box and it is automatically converted to milliseconds. This will allow us to build sequence-based musical patterns in future videos.