<-- Back to Previous Page TOC Next Section -->


Chapter 4: The Synthesis of Sound by Computer

Section 4.3: Filters

The most common way to think about filters is as functions that take in a signal and give back some sort of transformed signal. 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 4.9
Telephone simulations

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

Soundfile 4.10
High-pass filtered noise

White noise (every frequency below the Nyquist rate at equal level) is filtered so we hear only frequencies above 5 kHz.

Soundfile 4.11
Low-pass filtered noise

Here we hear only frequencies up to 500 Hz.

Four Basic Types of Filters

Figure 4.8  Four common filter types (clockwise from upper left): low-pass, high-pass, band-reject, band-pass.

Figure 4.8 illustrates four basic types of filters: low-pass, high-pass, band-pass, and band-reject. Low-pass and high-pass filters should already be familiar to you—they are exactly like the "tone" knobs on a car stereo or boombox. A low-pass (also known as high-stop) filter stops, or attenuates, high frequencies while letting through low ones, while a high-pass (low-stop) filter does just the opposite.


Band-Pass and Band-Reject Filters

Band-pass and band-reject filters are basically combinations of low-pass and high-pass filters. A band-pass 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.


Low-Pass and High-Pass Filters

Low-pass and high-pass 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, which cut off instantly at their cutoff frequency. However, real filters are not perfect, and they can’t just stop all frequencies at a certain point. Instead, frequencies die out according to a sort of curve around the corner of their cutoff frequency. Thus, the filters in Figure 4.8 don’t have right angles at the cutoff frequencies—instead they show general, more or less realistic response curves for low-pass and high-pass filters.

Cutoff Frequency

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

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 low-pass and high-pass filters to form band-pass and band-reject filters. Band-pass 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 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.

You can plainly see 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 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 along with 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, right? FIRs tend to be simpler, easier to use, and easier to design than IIRs, and they are very handy for a lot of simple situations. An averaging low-pass filter, in which some number of samples are 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 have feedback: by placing the microphone in front of a speaker, you amplify what comes out and then 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 output a higher signal than that which is fed to them. But at the same time, they can be many times more complex and subtler than FIRs. Again, think of electric guitar feedback—IIRs are harder to control but are also very interesting.

Figure 4.9  FIR and IIR filters.

Filters are usually designed in the time domain, by delaying a signal and then averaging (in a wide variety of ways) the delayed signal and the nondelayed one. These are called finite impulse response (FIR) 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 feed the output of that process back into the signal, we create what are called infinite impulse response (IIR) filters. The feedback process actually allows the output to be much greater than the input. These filters can, as we like to say, "blow up."

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

Thanks to Fernando Pablo Lopez-Lezcano for these graphics.

Designing filters is a difficult but key activity in the field of digital signal processing, a rich area of study that 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 (that is, 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 and filter theory, have some background in mathematics, and know how to move from the time domain (what you have) to the frequency domain (what you want) by averaging, delaying, and so on.

<-- Back to Previous Page Next Section -->