delay~

Interface for a flanger

This patch shows an appropriate interface for a flanger, including dials to control delay time, flanging rate, flanging depth, and control over the mix between the dry (unaltered) and wet (altered) signal. Control over the dry/wet mix is a good thing to include in most audio effects.

Simple demonstration of flanging

The technique of flanging in computer music refers to a changing delay time applied to a sound, usually by modulating the delay time with a low-frequency oscillator (LFO). The continuously changing delay time causes a subtle—or not-so-subtle—change in the pitch of the sound. When the flanged sound is mixed with the original sound, the two sounds interfere in continuously changing ways, creating a charactistic modulated filtering effect.

Short delay creates a timbre change

A single sample value of 1 (surrounded on either side by sample values of 0) is the shortest possible sound that can be represented in a digital audio signal. Electrical engineers call this signal an impulse. It theoretically contains every frequency up to the Nyquist frequency (one-half the sample rate), so it’s useful for testing filters and for determining the mathematical formulae to describe different sorts of filtering effects.

Phase cancellation due to delay

A sinusoid added to a delayed version of itself will result in a sinusoid of the same frequency but with its amplitude altered. The amount of amplitude change will depend on the phase relationship between the original sinusoid and its delayed copy. The two sinusoids will interfere with each other either constructively (reinforcing each other) or destructively (tending to cancel each other).

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.

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.