<<

Written Review 2: Stereo Flanging for DSP applications. SID: 430541647

Delay line modulation is a common audio processing technique that is used widely in many studio recordings. It can be implemented in a number of different ways, quite simply, to alter the output of a sound. Producing a flanger by using modulation presents some challenges and requires some modifications when turned into a stereo effect, hence, the aim of this review is to provide an effective solution to implement a stereo flanger in DSP. The review is written using signal flow diagrams and textual descriptions so that this information is not software or hardware specific. The effect can therefore be easily applied to a program that can perform audio digital signal processing such as Matlab or Max/MSP.

Delay line modulation

Flanging is a type of delay line modulation that can be applied using DSP to a sound or collection of sounds. Delay line modulation effects are things like the flanger, and vibrato. All of these effects incorporate a delayed copy or copies of the sound that is then fed combined with the original signal to produce a modulated output. This means that delay line modulation systems are time variant, producing different results depending on the input of audio.

By using different lengths or combinations of these digital delays, one can make a variety of effects only using copies of the original sound. Short delays, around 1-10 ms, are ideal for flangers. The short delay time doesn’t allow for the sound and its delayed copy to be heard, instead you hear the comb filters being produced by the delay providing cancellation with the original sound. If we increase the delay length to about 10-25 ms, we can start to differentiate the delay line, this gives the effect of a second sound source. If we layered a couple of these up we could create a chorus effect.

Delays beyond the 25ms mark will start to produce a slapback echo effect. These delays are the kind of delays that are used in things like a speech jammer. This delay length is long enough to allow a syllable of a word through just in time for a listener to hear the delayed copy of the sound. This interrupts the brain’s ability to string together multiple syllables or packets of verbal information. This is the same reason why highly reverberant rooms are not ideal for speech intelligibility. The effect becomes greater will larger delay times. A study on the effect concluded: ‘From the summary it can be observed that stuttering improves relative to the size of the D. In our preliminary study, we obtained results consistent with those summarized (i.e., larger D values jam speech more effectively).’ (Kurihara, et al 2011, p 9). Once delay times go beyond a significant amount they start to sound like uncorrelated copies of the sound. A classic tape delay plug in is an example of this.

Flanger

Flanging is described as an effect ‘used by contemporary musicians to introduce a spacious and "ethereal" character into recorded sounds.’ (Hartmann, 1978, p 439). The flanger is an effect utilising the comb filter produced by introducing a delayed copy of a sound. This delay line is then modulated in time to create the moving flanger effect. This delay can be controlled by signal such as a sine wave where the delay time will extended towards a longer delay before slowing down and oscillating back in the other direction to a shorter delay time. A triangle wave could be used to have a quick change between increasing delay and decreasing delay. One could even use a sawtooth signal to dictate delay modulation. The resulting flanger would increase in delay time and then jump back to minimum delay once it hits maximum delay.

A delay effect can be implemented using either an FIR or IIR filter, with the aim to create a delayed copy of the signal to be combined with the original signal. A typical tape flanger effect uses a single delay where two tapes would play copies of the same audio except that the second tape would be slightly slowed down in time to create a temporal separation which results in the comb filter. Julius Smith’s paper on all pass phasing and flanging describes how a flanger can be simply done using a ‘two turntable method’ (Smith, J., 1984) where two copies of the same record would play and one can vary the speed on one of them using friction from your hand or moving the speed dials to increase and decrease the delay times. The rate of speed change between the two tapes or the acceleration/deceleration will modulate the distance of the separation over time and give you a modulated delay line. This concept can be described as an FIR filter using a feed forward mechanism with an LFO modulator to create a flanger effect:

x(n) × + y(n) Delay ×

LFO

Wave Type Variation Amount ƒ(v)

This signal flow diagram shows a flanger being created from a finite impulse response filter. This version uses a feed-forward system to create a single delay that is modulated to create a sweeping comb filter, otherwise known as a flanger. x(n) is the signal input that is gain controlled before being sent to the output with the delayed copy of the signal. The delay here is modulated by an LFO that has a few parameters. There is a wave type which can be something like a sine wave or saw wave. The f(v) refers to the frequency of the modulation which is the frequency of the LFO. Variation amount is the depth of delay or how far the delay time is stretched and stretched back with each cycle of the LFO. The individual gain controls on the delay and original signal allow for ‘mixing’ of the signal to determine how wet the flanger effect is. ‘In practice, most modern implementations of flanging use an IIR or recursive feedback comb structure’ (Roads, 2009, p 438). An IIR filter can also be used to create the sweeping comb filter for the flanger effect: ƒ(v)

Wave Type Variation Amount

LFO

× Delay

x(n) + × y(n)

This system uses recursive feedback to generate an infinite amount of decaying delay. The output of the system is constantly fed back into the input. This creates delay upon delay. The critical thing to note here is that the gain on after the delay must be less than the absolute value of 1, otherwise the system will become unstable and the recurring delays will be forever increasing, causing no decay but rather a system that is constantly gaining energy.

The effect of using an IIR (being that the delay modulated sound will be repeatedly added back into the system) will result in a stronger effect where the recursive delays are constantly reinforcing the comb filter, especially at high delay gain values close to 1.

This delay line is then modulated in time to create the moving flanger effect. This delay can be controlled by signal such as a sine wave where the delay time will extended towards a longer delay before slowing down and oscillating back in the other direction to a shorter delay time. A triangle wave could be used to have a quick change between increasing delay and decreasing delay. One could even use a sawtooth signal to dictate delay modulation. The resulting flanger would increase in delay time and then jump back to minimum delay once it hits maximum delay.

The single delay line flanger is created by the delayed copy interacting with the original sound but this can be taken further. It is possible to mix a modulated sound with another modulated sound instead of using the original sound. An example can be a modulated delay that sweeps through its delay minimum to its delay maximum at a rate of 2hz combined with another modulated delay that sweeps at a rate of 3hz. This is all done without any addition of the original signal. The resulting sound will still be a flanger, albeit a more complicated sounding one, there will be a 3/2 cycle rate where the effects will crossover at different points in time. A paper in the AES discusses how slow moving comb filters such as this one produce a proper effect. ‘Sweeping this delay slowly (on the order of 1/4 Hz) produces moving null frequencies resulting in the special effect.’ (Hutchins, et al, 1975, p 3). This special effect is referred in the paper as ‘Jetsounds’ probably likened to the fact that we only hear these kinds of slow delay modulation in the real world. We would hardly ever hear a delay modulating at 1kHz hence a 1kHz delay modulation would sound unrealistic and not produce the true flanger effect. The frequency of the modulation can be made more complex by using different cycle rates and by adding more delay modulated copies of the original sound.

Stereo Flanger

Stereo flanging is the same concept as mono flanging only that the two (or more) sounds are played through 2 channels and are not mixed. This makes for some interesting ways to add two copies of a sound. A common misconception would be to play the original sound through one channel and the modulated copy through the other. This creates a problem where one channel is modulated and the delay time will be changing while one channel will sound completely normal, the problem here is that the effect is a little bit spoiled, sounding out of balance with normal sound at one channel and modulated sound at the other.

By taking a different approach we can alleviate this problem. By applying the more complicated effect of having a modulated copy play through one channel and another modulated copy play through the second, only both modulations will have different rate or depth properties. With both channels being modulated, the signal becomes less imbalanced and more ‘even’ sounding. A resulting FIR stereo flanger will look like this:

This, however, creates another problem. Having just two modulated copies of the sound and no original sound can make the effect sound a little too strong or detrimental to the audio you are applying the effect to. This can be alleviated by mixing some of the original sound back into the sound in a mono fashion. This is done by adding in the original with a gain reduction into both channels. This will make the audio more pleasing in most cases. There may be situations in which one would prefer a really full on effect that is not very ideal musically, in which case one could leave out the original signal.

We could devise a stereo flanger as such using FIR filtering technique: ƒ(vl)

Wave Type Variation Amount

LFO

Delay × + yl(n)

x(n) × Delay × + yr(n)

LFO

Wave Type Variation Amount ƒ(vr )

Here we have a stereo implementation of the FIR single delay filter. Only this time we see two FIR delay modulations each with a different modulation frequency being ‘vl’ and ‘vr’. This will create two different delayed signals that will create comb filter sweeps at different rates. The outputs are also changed to include a left and right output for y(n) which are named ‘yl’ and ‘yr’. We can see that the original, non modulated copy of the sound is also being added back in to each channel, this is done with a control gain. As mentioned earlier, ideally, this gain should be 50% of the intended amount as it will be adding to both channels and hence will create twice the amount of sound. This will effectively diminish the effect of the system and make the output sounding too dry.

Conclusion:

The design of a stereo flanger can be conducted in a number of different way. By looking at how a basic delay line can be applied to any sound in either a analogue or digital setting one can understand how the effect could be implemented in DSP. Using the prescribed signal flow diagrams one could create an audio effect that could be applied to any audio signal.This system, like the other ones described can be tweaked to feature different delay depths, rates and LFO wave types, this will create greater differences in the output where the stereo output will be a result of many factors. Similarly a stereo flanger can utilise many more feed forward delay lines to either further develop the signal processing or even to create flanger effects over more than a two channel stereo output such as a quadraphonic sound system. The system could also be modified to create an infinite response by changing the feed forward lines to feed back lines.

References:

Dutilleux, P., Zolzer, U., 2002. Delays. DAFX: Digital Audio Effects, [Online]. 03, 63-74. Available at: http://web.arch.usyd.edu.au/~wmar0109/DESC9115/DAFx_chapters/03.PDF [Accessed 29 May 2013].

Hartmann, W. M., 1978. Flanging and Phasers. Journal of the Audio Engineering Society, Vol 26, Number 6, p 439-443.

Hutchins, B. A., Ku, W. H., 1975. Audio Frequency Applications of Integrated Circuit Analog Delay Lines. Journal of the Audio Engineering Society, p 1-14.

Karhs, M., 2002. Applications of Digital Signal Processing to Audio and Acoustics. Piscataway, New Jersey: Kluwer Academic Publishers. p 122-135

Kurihara, K., Tsukada, K., 2011. SpeechJammer: A System Utilizing Artificial Speech Disturbance with Delayed Auditory Feedback., [Online]. 1st ed, 1-10. Available at: http:// arxiv.org/vc/arxiv/papers/1202/1202.6106v1.pdf [Accessed 01 June 2013].

Roads, C., 1996. The Computer Music Tutorial. 1st ed. Cambridge: The MIT press. p 436-438

Smith, J. O., 1984. All Allpass Approach to Digital Phasing and Flanging. Internation Computer Music Conference, Vol 1, p 103-109.