MSP

Control the balance between two channels of audio

This abstraction allows you to adjust the balance between two channels of audio. The audio channels come in the first two inlets, and a control signal comes in the right inlet. When the control signal is 0, the two channels pass through unchanged. As the control signal approaches -1, the amplitude of the right channel is reduced (till completely silent at -1) while the left channel remains unchanged; as the control signal approaches 1, the amplitude of the left channel is reduced (till completely silent at 1) while the right channel remains unchanged.

Smooth filter changes

If you want to change the coefficients of biquad~ in real time while a sound is playing, it's usually better to use MSP signals rather than individual Max messages, to avoid causing clicks. In that case, you should replace filtergraph~ with filtercoeff~ and send the frequency, gain, and Q parameters into filtercoeff~ as smooth signals (as shown in the left portion of the example).

Variable-mode filter demo

This patch allows you to try out various filter settings of the biquad~ object, via the filtergraph~ object. For adjusting the parameters you can drag on filtergraph~ with the mouse, or you can send values in its three rightmost inlets for frequency, gain, and Q. The spectroscope~ object tries to draw the spectrum of the signal.

Bandpass filter swept with a LFO

This example demonstrates one of MSP's many filter objects—the resonant bandpass filter reson~—and demonstrates how a parameter of that filter—in this case its center frequency—can be easily modulated by a low-frequency control oscillator (cycle~). The range of cycle~ is between 1 and -1, but that range can be amplified by multiplication, and can be offset by addition.

Live capture in buffer~

This shows how to record into a RAM (random-access memory) buffer, and how to play back the contents of the buffer at any rate (even backward by using a negative rate) starting at any point in the buffer. A timer is used to keep track of the duration of the recording. The example also demonstrates how one might use a quick fade-in and fade-out to avoid clicks when doing realtime capture during a performance.

Linear interpolation of audio

For linear interpolation of a MSP signal, the line~ object sends out a signal that progress to some new value over a certain amount of time interpolating sample-by-sample along the way. The input to line~ is a pair of numbers representing a destination value (where it should eventually arrive) and a transition time (how long it should take to get there). It can receive multiple pairs of numbers in a single message, and it will use the pairs in order, starting each new pair when the previous transition has finished.

Exponential mapping

A linear fade-in or fade-out of audio is okay for quick changes that take place in a fraction of a second, but for slower fades one should generally take into account that our subjective sense of loudness more closely conforms to an exponential change in amplitude. This patch allows you to use the slider (or the mod wheel from a MIDI controller) to control the amplitude of white noise in one of three different ways: with straight linear mapping, exponentially (with an exponent of 4), or using a range of 60 decibels.

Interpolation with line or line~

The line~ object outputs a signal and interpolates sample-by-sample from wherever it currently is to wherever you tell it to go, in the amount of time you specify. So, if it is currently sending out a signal value of 0.5 and you tell it to go to 0.8 in 10 ms, it will start going to 0.8 and get there in 441 samples (assuming a sample rate of 44,100), sending out signal values like 0.50068, 0.50136, etc. till it arrives at 0.8, then it will stay there till it gets a new message.