# 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.