MSP

Resonant lowpass filter

The lores~ object is a resonant lowpass filter. It requires only two parameter values: the cutoff frequency and a resonance factor from 0 to 1. Increasing the resonance will increase the steepness of the filter (increase the attenuation effect on frequencies above the cutoff) and also will accentuate the frequencies right around the cutoff. Experiment with different resonance values between 0 and 1 to hear the effect, and try sweeping the cutoff frequency through different registers.

The simplest lowpass filter

Almost all digital filters involve mixing a sound with one or more delayed versions of itself, usually to cause interference and thus change the amplitude at certain frequencies. The very simplest imaginable example is to delay a sound by exactly one sample, and then take the average of the current sample and the previous (delayed) sample. The result of this averaging process is that the signal is smoothed slightly, reducing the high frequencies: a lowpass filter.

Comb filter

When a sound is mixed with a delayed version of itself, each sinusoidal component of the delayed sound has a unique phase offset compared to the original, so each frequency is accentuated or attenuated differently. For example, if a 1000 Hz sinusoid is delayed by 1/1000 of a second (1 millisecond), the original and the delayed version will still be perfectly in phase, so that frequency will be increased in amplitude when the two versions are added together.

Phase cancellation

When two sinusoidal waves have the same frequency, amplitude, and phase, they constructively interfere; the amplitude of their sum is twice the amplitude of each one alone. When they are exactly one half cycle out of phase, however, they completely interfere, and cancel each other out entirely; one always is positive when the other is negative, so their sum is always zero. When their phase relationship is somewhere in between those two extremes, the frequency of the sum will stay the same, but the amplitude and phase will change.

Using matrix~ for audio routing and mixing

The matrix~ object is an audio mixer/router that can be configured with any number of inlets and outlets. The arguments specify the number of audio inlets, the number of audio outlets (there's always one additional outlet on the right), and the initial gain for the connections of inlets to outlets. Each inlet is potentially connectable to each outlet with a unique gain setting. The gain of the connections is changed by sending messages in the left inlet.

Routing audio data flow

The selector~ and gate~ objects serve the same function for audio signals as the switch and gate objects do for Max messages. The selector~ object chooses one signal inlet to pass to its outlet. The gate~ object chooses one outlet out of which to pass its incoming signal.

Delay with feedback

The delay~ object does not permit its delayed signal to be fed back into its own left inlet. (You can probably imagine how that would make it impossible for MSP to calculate the correct signal, since you'd be asking it to perform infinite recursion: the signal plus the delayed signal plus the delayed sum of those two plus...). If you want to get delay with feedback, you need to use objects that are designed to handle that.

Simple flanging

This patch demonstrates a simple implementation of "flanging"—the effect created by making a delayed copy of a sound, with the delay time periodically fluctuating, and then mixing the delayed sound with the original.

Ducking when changing delay time

Whenever you change the delay time, you're asking MSP to look at a new location in the delay buffer, which can cause a click in the output if the new sample value is very different from the previous one. One way to get around that is to quickly fade the output amplitude down to 0 whenever you make a change, then quickly fade it back up once the change has been made.