Data AcQuisition And Real-Time AnalysisScope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
Contact us about
Sound Card Comb Filtering and "Flanger" Effects
Note: See the Shifted Monaural Noise ("Jet Sounds") sub-topic of the Monaural and Binaural Beats mini-app for an audio demonstrations of comb filtering.
Comb filtering results when you add a delayed version of a signal to itself. At all frequencies for which the delay represents an integer number of full cycles, the delayed and original signals will be in phase and those frequency components will be doubled in level. At all frequencies where the delay represents an odd number of half-cycles, the delayed and original will be 180 degrees out of phase and those components will cancel. The resulting frequency spectrum thus has a series of alternating peaks and dips, with the separation between adjacent peaks (or dips) equal to the reciprocal of the delay time.
For example, if you set the delay to 24 samples and the sample rate is 48 kHz, that constitutes a 500 microsecond delay which represents 2 kHz. The spectrum will thus have peaks at 0, 2, 4, 6... kHz and notches at 1, 3, 5, 7... kHz.
With a stationary delay, the effect of comb filtering is often rather subtle. But when the delay is variable, the effect as the delay changes is striking. If the sound being processed is similar to white noise, it sounds like a jet taking off. The noise from real jet engines reaches your ears via different routes; some directly, some after reflecting off the runway and nearby buildings. When the jet moves, the relative path delays change, producing a distinctive comb-filter sound. For this reason, comb filtering is sometimes referred to as "jet sounds".
You can produce an excellent simulation of jet sounds using two or more streams producing the same noise wave, and applying a modulated timing shift. The Timing Shift topic includes a discussion of how to do this with noise sources.
For signals other than noise, a different approach is required to produce the variable delay. For normal repetitive waves, you can set two streams to produce the same wave, but with a tiny frequency difference (say, less than a few hertz). (Note that you must set each stream's Level to 50% or less since they are added together.) This will give a decent simulation of comb filtering, and will produce some visually interesting waveforms as well. The comb-filtered effect is more pronounced with waves having lots of harmonics that can go in and out of phase.
This works when the frequency difference is too small to hear as a pitch difference. As the waves progress they get more and more out of phase until eventually they are back in alignment again. So, this behaves much like two identical waves with a sinusoidally changing time delay between them.
Alternatively, you can set both streams to the exact same frequency, and use very slow Frequency Modulation (FM) to give the same effect. The advantage here is that you are not limited to a simple sinusoidal modulator; you can use Stream Modulation with another stream supplying any desired modulation shape.
Phase Modulation (PM) is a more general way to produce comb filtering, and has wider application. The effect of phase modulation is identical to time delay for any repeating waveform, without any frequency shift beyond that implied by the changing phase itself.
Comb filters with variable delays have been used in Rock music since Phil Spector used "flanging" with two open-reel tape recorders to produce "The Big Hurt" in the 1950s. Dragging a finger on the reel flange of one recorder caused it to slow down slightly and fall behind the other, creating a delay that increased as long as the pressure on the flange continued. Then doing the same thing to the other recorder caused the relative delay to decrease.
"Phaser" effects pedals for electric guitars were an attempt to duplicate this unique sound, though most of those used only a crude approximation to a true comb filter; instead of peaks and notches at all multiples of some fundamental, as in true comb filtering, they only provided a couple of dips and peaks.
You can create a "perfect" flanging effect with any sound recording by loading it as a Play wave file. Select it as the wave type for two different streams, making sure that each Play source is set to Interpolate between samples. Set each stream's Level to 50% since they will be added together. Now use Phase Modulation on one of the streams to provide the variable time delay, using either the default sine modulator or using another stream as the modulation source.
Note that "phase" is used in a special sense with Play sources; since there may be arbitrary frequencies in the file, a single phase value would be meaningless. Instead, the Phase control (as well as the modulation operation) is calibrated such that 360 degrees is 1024 samples at x1 Rate. The result is that Phase, as used here, is exactly equivalent to time delay... just what is needed for a comb filter.
For flanger effects, you will thus want to start with PM Depth around 1 or 2 percent (10 to 20 samples or 2 to 4 msec). Use a fairly slow modulation rate (such as 0.5 hertz or less for Sine modulation) to give a good simulation of the original technique.
Questions? Comments? Contact us!We respond to ALL inquiries, typically within 24 hrs.
Over 30 Years of Innovative Instrumentation
© Copyright 2007 - 2017 by Interstellar Research
All rights reserved