Max/MSP is designed to allow realtime audio processing and control.
Max objects are processed/updated at 1 millisecond intervals (referred to as the "control rate").
Between control increments, MSP objects must perform their computations to satisfy the audio sample rate (typically 44100 or 48000 samples per second on most Macintosh built-in audio devices).
MSP objects perform "vectorized" computations ... they compute a set number of output samples before sending that data to the next "object" in the audio network. The number of samples per "vector" can be controlled in the DSP Status window (opened from the Options menu) via the "Signal Vector Size" parameter.
Audio samples to be sent to the digital-to-analog converter (DAC) or read from the analog-to-digital converter (ADC) are "bundled" in buffers as well. The size of these input/output buffers is set via the "I/O Vector Size" parameter in the DSP Status window.
Audio output in MSP is accomplished with the dac˜ object (digital-to-analog converter).
The dac˜ can be turned "on" or "off" with 1 or 0, or "start" and "stop", messages, respectively.
Input signals to the dac˜ must be in the range
-1.0 < x < 1.0 or the output will clip/distort.
Audio signal operators are specified by "tilde" symbols (i.e., *˜, /˜).
The cycle˜ object is a table lookup oscillator with inlets for frequency and phase offset.
By default, the cycle˜ object uses an internal table of 16K samples of a single period of a sine wave and linear interpolation to generate values between those samples.
The cycle˜ object is an example of an object that produces audio-rate output but which can take either control- or audio-rate input (though not both at the same time).
Audio file data can be read into a buffer˜ object and subsequently used by various other MSP objects.
A buffer˜ object should be given a unique name so that it can be identified by other objects.
A "read" message to a buffer˜ object will open a dialog box for selecting a specific file to import. If the read message is given a specific file name and that file is found in the MSP path, a dialog box will not be opened.
A cycle˜ object can read its "wavetable" from a buffer˜ by specifying the buffer name as a parameter. However, the cycle˜ object will only read 512 samples from a buffer (though you can change the buffer size with other arguments or attributes). A buffer offset argument can be provided to the cycle˜ object.
To play longer segments of audio data from a buffer at possibly variable rates, the play˜, groove˜ and wave˜ objects can be used.
To play soundfiles without using a buffer˜, use the sfplay˜ object.
A phasor˜ object produces a sawtooth ramp generator in the range 0 - 1. It can be used to increment the phase of an oscillator (cycle˜).
The gain˜ object provides an interpolating logarithmic signal fader.
The meter˜ object provides a graphical signal level meter.
The scope˜ object provides a graphical signal display. It responds to a variety of special messages.
The noise˜ object generates psuedo-random numbers in the range
-1.0 < x < 1.0.
The line˜ object generates signal-rate linear envelopes.
Up to 64 value-time pairs can be sent to a line˜ object to produce multi-segment envelopes.
The function object allows one to graphically create piece-wise linear envelopes that can be used by the line˜ object.
The right outlet of the line˜ object sends a "bang" when the final destination point has been reached ... this can be used to re-trigger a new envelope.
Exponential envelopes tend to produce more natural sounds.
The curve˜ object generates exponential or logarithmic envelopes.
In addition to target and duration parameters, the curve˜ object takes a "curve" parameter that controls the rate of increase/decrease of the envelope. A value of 0 produces linear line segments. A value between 0 and 1 produces an exponential curve, while values between 0 and -1 produce logarithmic curves.
With newer version of Max/MSP, it is possible to make use of the function object to design envelopes for use by the curve˜ object. However, because the list of parameters to the curve˜ object is different from the line˜ object, the “Mode” of the function object must be set to “Curve” in the inspector and setcurve messages must be used to initially set the curve parameters of breakpoints (they default to linear line segments).
Another common envelope type is adsr˜, which provides controls for timing (in milliseconds) of the attack, decay and release portions of an envelope, as well as the sustain gain. The adsr˜ must be triggered both on and off.
The gate˜ object can be used to patch a single input to one of several outputs.
The selector˜ object can be used to patch one of several inputs to a single output.
The matrix˜ object can be used to route various inputs to various outputs. The matrixctrl object provides a graphical control for the matrix˜ object.
It is possible to turn off audio in a specific subpatch by connecting a mute˜ object to the inlet of the subpatch. A pass˜ object should be used inside any subpatch (connected just above subpatch outlets) that might be muted.
Audio and MIDI operations can be turned off in a subpatch by sending an enable 0 message to a pcontrol object connected to a subpatch.