—> To Continue with Chapter 4

Filters

Fun with filters.
Soundfile .x

Telephone simulations.

Older telelphones had around an 8k lowpass filter imposed on their audio signal, mostly for noise reduction and to keep the equipment a bit cheaper. .

The most common way to think about filters is as functions which take in a signal, and give some sort of transformed signal back. Usually, what comes out is less than what goes in. That's why the use of filters is sometimes referred to as subtractive synthesis.

It probably won't surprise you to learn that subtractive synthesis is in many ways the opposite of additive synthesis. In additive synthesis we start with simple sounds and add them together to form more complex ones. In subtractive synthesis we start with a complex sound (like noise) and subtract, or filter out, parts of it. Subtractive synthesis can be thought of as sound sculpting — you start out with a thick chunk of sound containing many possibilities (frequencies) and then you carve out (filter) parts of it. Filters are one of the sound sculptor’s most versatile and valued tools.

Soundfile .x

Highpass filtered noise.

White Noise (every frequency below the Nyquist Rate at equal level) is filtered so we only hear frequencies above 5 KHz.

Soundfile .x

Lowpass filtered noise.

Here we hear only frequencies up to 500 Hz.

The Four Basic Types of Filters


Figure .x Four common filter types (clockwise from upper left): lowpass, highpass, bandpass, band reject.

Each type of filter lets through certain frequency ranges while attenuating others. For instance, a lowpass filter lets through low frequencies, but attenuates high ones. The names of these filters are sometimes inverted: lowpass is the same as highstop, highpass is the same as lowstop.


Applet x

This applet is a good example of how filters, combined with something like noise, can produce some common and useful musical effects with very few operations.

The figure above illustrates four basic types of filters: lowpass, highpass, bandpass, and band reject. Lowpass and highpass filters should already be familiar to you — they are exactly like the "tone" knobs on a car stereo or boombox. A lowpass (also known as highstop) filter stops, or attenuates, high frequencies while letting through low ones, while a highpass (lowstop) filter does just the opposite.

Bandpass and Band reject Filters

Applet x

applet: comb filter.

Comb filters are a very specific type of digital process in which a short delay (some number of samples are actually delayed in time) and simple feedback algorithm (outputs are sent back to be reprocessed and recombined) is used to create a rather extraordinary effect. Sounds can be "tuned" to specific harmonics (based on the length of the delay and the sample rate.)

Bandpass and band reject filters are basically combinations of lowpass and highpass filters. A bandpass filter lets through only frequencies above a certain point and below another, so there is a band of frequencies that get through. A band reject filter is the opposite: it stops a band of frequencies. Band reject filters are sometimes called notch filters, because they can notch out a particular part of a sound.


Lowpass and highpass filters

Lowpass and highpass filters have a value associated with them called the cutoff frequency, which is the frequency where they begin "doing their thing". So far we have been talking about ideal, or perfect, filters. However, real filters are not perfect, and they can't just stop all frequencies at a certain point. Instead the ways that frequencies die out according to a sort of curve around the corner of their cutoff frequency. Thus, the pictures in the figures above (the four different types of filter) don't have right-angles at the cutoff frequencies — they show general, more or less realistic response curves for lowpass and highpass filters.

The Cutoff Frequency

The cutoff frequency of a filter is defined to be the point at which the signal is attenuated to .707 of its maximum value (which is 1.0). No, the number .707 was not just picked out of a hat! It turns out that the power of a signal is determined by squaring the amplitude: .7072 = .5. So when the amplitude of a signal is at .707 of its maximum value, it is at half-power. The cutoff frequency of a filter is sometimes called its half-power point.

The Transition Band

The area between where a filter "turns the corner" and where it "hits the bottom" is called the transition band. The steepness of the slope in the transition band is important in defining the sound of a particular filter. If the slope is very steep, the filter is said to be "sharp," conversely, if the slope is more gradual the filter is "soft" or "gentle".

Things really get interesting when you start combining lowpass and highpass filters to form bandpass and band reject filters. Bandpass and band reject filters also have transition bands and slopes, but they have two of them, one on each side. The area in the middle, where frequencies are either passed or stopped is (imaginatively) called the
passband or the stopband. The frequency in the middle of the band is called the center frequency, and the width of the band is called the filter's bandwidth.

There must have been some pretty wild and crazy engineers making up the names for this stuff! But, what you can plainly see is that filters can get pretty complicated, even these simple ones. By varying all these parameters (cutoff frequencies, slopes, bandwidths, etc.) we can create an enormous variety of subtractive synthetic timbres.

A Little More Technical: IIR and FIR Filters

Filters are often talked about as being of one of two types: Finite Impulse Response (FIR) and Infinite Impulse Response (IIR). This sounds complicated (and can be!), so we'll just try to give a simple explanation as to the general idea of these kinds of filters.

Finite Impulse Response filters are those in which delays are used, and some sort of averaging. Delays mean that the sound that comes out at a given time uses some of the previous samples. They've been delayed before they get used.

We've talked about these filters in earlier chapters. What goes into an FIR is always less than what comes out (in terms of amplitude). Sounds reasonable, no? FIRs tend to be simpler, easier to use and design than IIRs, and very handy for a lot of simple situations. An averaging lowpass filter, in which some number of samples is averaged and output is a good example of an FIR.

Infinite Impulse Response filters are a little more complicated, because they have an added feature: feedback. You've all probably seen how a microphone and speaker can feedback: by placing the microphone in front of a speaker you amplify what comes out and stick it back into the system which is amplifying what comes in, creating a sort of infinite amplification loop. Ouch. If you're Jimi Hendrix, you can control this and make great music out of it.

Well, IIRs are similar. Because the feedback path of these filters consists of some number of delays and averages, they are not always what are called unity gain transforms. They can actually ouput a higher signal than that which is fed to them. To use a technical term, they can (stop us if it's too confusing), blow up. But at the same time, they can be many times more complex and subtle than FIRs. Again, think of electric guitar feedback — IIRs are harder to control, but also very interesting.

FIR Filters
IIR Filters
Figure xFIR and IIR, feedack and feedforward filters.

Filters are usually designed in the time domain, by delaying a signal and averaging (in a wide variety of ways) the delayed signal and the non-delayed one. These are called FIR (Finite Impulse Response) filters, because what comes out uses a finite number of samples, and a sample only has a finite effect.

If we delay, average, and then feedback the output of that process back into the signal, we create what are called IIR (Infinte Impulse Response) filters. The feedback process actually allows the output to be greater (much, much greater) than the input. These filters can, as we like to say, "blow up."

The diagrams above are technical lingo for typical filter diagrams for FIR and IIR filters. Note how in the bottom diagram, the IIR, the output of the filter's delay is summed back into the input, causing the infinte response characteristic. That's the main difference between the two.

Thanks to Fernando Pablo Lopez-Lezcano for these graphics.


Designing filters is a difficult but central activity in the field of
digital signal processing, a rich area of study which is well beyond the range of this book. It is interesting to point out that, surprisingly, even though filters change the frequency content of a signal, a lot of the mathematical work done in filter design is done in the time domain, not in the frequency domain! By using things like sample averaging, delays, and feedback, one can create an extraordinarily rich variety of digital filters.

For example, the following is a simple equation for a low pass filter. This equation just averages the last two samples of a signal (where x(n) is the current sample) to produce a new sample. This equation is said to have a one sample delay. You can see easily that quickly changing (high frequency) time domain values will be "smoothed" (removed) by this equation.

x(n) = (x(n) + x(n-1))/2


In fact, although it may look simple, this kind of filter design can be quite difficult (although extremely important). How do you know which frequencies you’re removing? It’s not intuitive, unless you’re well schooled in digital signal processing, filter theory, and have some background in mathematics, how to move from the time domain (what you’ve got) to the frequency domain (what you want) by averaging, delaying, and so on.

—> To Continue with Chapter 4

<— Back to 4.2

<— To Table of Contents