MAX/MSP: Delay Lines (A Beginners Tutorial)

Welcome to a quick overview of creating a Max/MSP patch. This is my very first tutorial on Max so it’s going to be incredibly simple. Any other Max Patches I create will likely show off something a little more complex, so experienced users might not find too much here for them.

Max/MSP (M.S.P. standing for Max Signal Processing) is an incredibly cool program developed by Cycling ’74, created by Miller S. Puckette (another M.S.P.!). It is largely considered to be a much more user-friendly cousin to Pure Data (“Pd”) , which Puckette also designed. Since I purchased it a month ago, Max 6 has quickly become one of my favorite toys, and is incredibly fun to design audio with. It is a Digital Signal Processing application, which means that it can process audio in real time. We’re going to take a quick look at Max to get a glimpse at it’s capabilities and create a short, extremely simple delay effect. To avoid repeatedly explaining anything, when I say to create an object, just hit “N” on the keyboard and type in the name of the object that I write in a quotes.

To start, create an “ezdac” object to create an output for your signal (a “dac” is a Digital-to-Audio Converter – a speaker(!) – and its inverse is the “adc”, the Analogue-to-Digital Converter – a microphone(!). You can use just a regular “dac” as well, but the ezdac offers a graphical interface). The interface of the ezdac is pretty simple. Click it to turn the audio engine on or off. The next step is to actually create the signal, so let’s create a new object called “cycle ~ 220”. “cycle” is a keyword to generate a sine wave. It is an oscillator. The tilde (“~”) is a signifier that the object deals with audio and not data – all audio-related objects end with a tilde. The 220 is an argument for the “cycle” keyword that specifies 220 cycles per second (a wave with a frequency of 220 hertz). If you were to plug this object into the ez-dac, you can hear – at your speakers maximum volume – a pure sine wave of 220 hz. To give yourself some control, create a “gain~” object and connect it between your ezdac and oscillator (make sure to connect all channels of the dac to the gain slider.

Now that we have something playing a tone, we’re almost ready to create a delay line, but because we have a single tone playing, any delay is going to go unnoticed, so let’s create a number box (hint! hit I on the keyboard to create a number (integer!) box!) and plug it into the “cycle~” object’s top inlet. The number box will alter the argument of the oscillator, so whatever number you place into the number box will replace the “220” in the oscillator object. The trick here is that you can click and drag on the number box and hear the delay line as your oscillator changes. It looks like this:

Basic Max 6 Oscillator
Basic Max 6 Oscillator. The 218 is currently replacing the original argument of 220.

Now to start the delay line.

Create a “tapin~ 1000” object. The “tapin” creates a memory space for the last X amount of milliseconds of audio. In this case, we’re getting the last 1,000 milliseconds (1 second) of delay. Break the link from your “cycle~” object to your “gain~” object, and instead connect “cycle~” to your fancy new “tapin~” object. Now create a “tapout~ 50” object, and connect the out of “tapin~” to it’s input, and “tapout~ 50″‘s out to “gain~” input. The argument of 50 in the “tapout~” object is the actual delay being generated. You’ll notice that the connection between “tapin~” and “tapout~” is a data connection and not an audio one – this is no accident! Because “tapin~” is actually storing 1,000 milliseconds of audio, you can actually use “tapout~” to create several delay lines using one source. So adding arguments (for example “tapout~ 50 200 500”) might result in an interesting delay pattern. You’ll just have to experiment to find out!

One last touch: Multiplying signals is effectively the same as a mixing two signals together on an audio console. So if you multiply two signals, you just get both signals in one audio “line” (for lack of a better term). So, if you were to “mix” back in the delay, you could effectively turn your delay into a reverb! To do this, simply multiply your signal coming out of your delay and mix it back in before the delay again. Just create a multiplication object that will return 75% of the output back to the input. Create an object “*~ 0.75” and connect the out of “tapout” to its’ input, and the multiplication objects output to the input of “tapin” (If you were to create this as a variable range from 0-100%, it would be the same as a feedback knob on a delay pedal. I’ll leave that for you to figure out though!)

The completed patch. I used 85% for my return line, and the “0” in the “Delay Line” can replace the tapout~ argument of 50, in order to modulate the delay time.

If you desire, you can copy this paste on pastebin to your clipboard and open it in Max 6 using the file>new from clipboard command, to see exactly what I’ve created. Additionally, I would like to credit Joel Rich for the original tutorial I followed to create this patch when I first began using Max. You can find that video here.