MSP objects are for processing digital audio (i.e., sound) to be played by your computer. MSP objects look just like Max objects, have inlets and outlets just like Max objects, and are connected together with patch cords just like Max objects. They are created the same way as Max objects— just by placing an object box in the Patcher window and typing in the desired name -- and they co-exist quite happily with Max objects in the same Patcher window.
A patch of interconnected MSP objects works a little differently from the way a patch of standard Max objects works.
One way to think of the difference is just to think of MSP objects as working much faster than ordinary Max objects. Since MSP objects need to produce enough numbers to generate a high fidelity audio signal (commonly 44,100 numbers per second), they must work faster than the millisecond schedule used by standard Max objects.
Here's another helpful way to think of the difference. Think of a patch of MSP objects not as a program in which events occur at specific instants (as in a standard Max patch), but rather as a description of an instrument design -- a synthesizer, sampler, or effect processor. It's like a mathematical formula, with each object constantly providing numerical values to the object(s) connected to its outlet. At any given instant in time, this formula has a result, which is the instantaneous amplitude of the audio signal. This is why we frequently refer to an ensemble of inter-connected MSP objects as a signal network.
So, whereas a patch made up of standard Max objects sits idle and does nothing until something occurs (a mouse click, an incoming MIDI message, etc.) causing one object to send a message to another object, a signal network of MSP objects, by contrast, is always active (from the time it's turned on to the time it's turned off), with all its objects constantly communicating to calculate the appropriate amplitude for the sound at that instant.
The names of all MSP objects end with the tilde character (~). This character, which looks like a cycle of a sine wave, just serves as an indicator to help you distinguish MSP objects from other Max objects.
The patch cords between MSP objects have stripes. This helps you distinguish the MSP signal network from the rest of the Max patch.
MSP objects are connected by striped patch cords
The digital-to-analog converter (DAC) is the part of your computer that translates the stream of discrete numbers in a digital audio signal into a continuous fluctuating voltage which will drive your loudspeaker.
Once you have calculated a digital signal to make a computer-generated sound, you must send the numbers to the DAC. So, MSP has an object called dac~
, which generally is the terminal object in any signal network. It receives, as its input, the signal you wish to hear. It has as many inlets as there are available channels of audio playback. If you are using Core Audio (or WWWW on Windows) to play sounds directly from your computer's audio hardware, there are two output channels, so there will be two inlets to dac~
. (If you are using more elaborate audio output hardware, you can type in an argument to specify other audio channels.)
dac~ plays the signal
must be receiving a signal of non-zero amplitude in order for you to hear anything. dac~
expects to receive signal values in the range -1.0 to 1.0. Numbers that exceed that range will cause distortion when the sound is played.
The best way to produce a periodic waveform is with cycle~
. This object uses the technique known as ‘wavetable synthesis’. It reads through a list of 512 values at a specified rate, looping back to the beginning of the list when it reaches the end. This simulates a periodically repeating waveform.
You can direct cycle~
to read from a list of values that you supply (in the form of an audio file), or if you don't supply one, it will read through its own table which represents a cycle of a cosine wave with an amplitude of 1. We'll show you how to supply your own waveform in Tutorial 3
. For now we'll use the cosine waveform.
Graph of 512 numbers describing one cycle of a cosine wave with amplitude 1
receives a frequency value (in Hz) in its left inlet, and it determines on its own how fast it should read through the list in order to send out a signal with the desired frequency.
To figure out how far to step through the list for each consecutive sample, cycle~
uses the basic formula
is the amount to increment through the list, ƒ
is the signal's frequency, L
is the length of the list (512 in this case), and R
is the audio sampling rate. cycle~
is an ‘interpolating oscillator’, which means that if I
does not land exactly on an integer index in the list for a given sample, cycle~
interpolates between the two closest numbers in the list to find the proper output value. Performing interpolation in a wavetable oscillator makes a substantial improvement in audio quality. The cycle~
object uses linear interpolation, while other MSP objects use very high-quality (and more computationally expensive) polynomial interpolation.
By default cycle~
has a frequency of 0 Hz. So in order to hear the signal, we need to supply an audible frequency value. This can be done with a number argument as in the example patch, or by sending a number in the left inlet, or by connecting another MSP object to the left inlet.
The way to turn audio on and off is by sending the Max messages dac~
object (or an adc~
object, discussed in a later chapter). Sending or to any dac~
object enables or disables processing for all signal networks.
and (or and ) to the left inlet of a
The simplest possible signal network
is part of a signal network, it also understands certain Max messages, such as and . Many of the MSP objects function in this manner, accepting certain Max messages as well as audio signals.
The first time you start up Max/MSP, it will try to use your computer's default sound card and driver (Core Audio on Macintosh or MME on Windows) for audio input and output. If you have the audio output of your computer connected to headphones or an amplifier, you should hear the output of MSP through it. If you don't have an audio cable connected to your computer, you'll hear the sound through the computer's internal speaker.
In order to get MSP up and running properly, we recommend that you start the tutorials using your computer's built-in sound hardware. If you want to use an external audio interface or sound care, please refer to the Audio Input and Output chapter for details on configuring MSP to work with audio hardware.
• Set your audio amplifier (or amplified speakers) to their minimum setting, then click on the
message box. Adjust your audio amplifier to the desired maximum setting, then click on the message box to turn off that annoying test tone.
If you don't hear any sound coming from your computer when you start the dac~
in this example, check the level setting on your amplifier or mixer, and check all your audio connections. Check that the sound output isn't currently muted. On Macintosh, the sound output level is set using the Sound preferences in the System Preferences application. On Windows, the sound output level is set using the Sounds and Audio Devices setup (Start - Control Panels - Sounds and Audio Devices).
If you are still are not hearing anything, choose DSP Status from the Options Menu and verify that Core Audio Built in Controller for Macintosh or MME driver for Windows is selected in the Driver pop-up menu. If it isn't, choose it.
A signal network
of connected MSP objects describes an audio instrument. The digital-to-analog converter of the instrument is represented by the dac~
must be receiving a signal of non-zero amplitude (in the range -1.0 to 1.0) in order for you to hear anything. The cycle~
object is a wavetable oscillator which reads cyclically through a list of 512 amplitude values, at a rate determined by the supplied frequency value. Signal processing is turned on and off by sending a or message to any dac~
• Close the Patcher window before proceeding to the next chapter.