Over the past few weeks I’ve started to become well acquainted Pure Data (Pd) and its dataflow programming paradigm. During this time I have realized that in order to produce interesting sound-based experiences with Pd I needed to gain a basic understanding regarding the physics of sound waves.
This is the second post that documents my process of learning about the nature of sound, its behavior, and how we perceive it. Last week I shared some notes regarding general digital music concepts. Today I am going to focus on describing how filters work (without getting into any of the math, since I don’t understand it). Then I will follow-up with a few specific posts featuring pd patches that I created to illustrate how these various filters work in Pd.
What Is a Filter?
Filters are devices that attenuate and/or remove specific frequencies of sound waves. Usually the frequency response of a filter is represented using a Bode plot, such as the one featured below. Filters are usually characterized by one or two cut-off frequencies, which define the edges of the filter. Another important characteristic of filters is the rate of frequency roll-off, which refers to the slope (or rate) of attenuation of the frequencies above or below the cut-off frequencies.
An ideal filter would completely eliminate all frequencies above and/or below the cutoff frequency. Ideal filters do not exist. The rolloff, which I just mentioned above, is an artifact inherent in all filters that is a result of these limitations. Roll-offs are areas beyond the cut-off where frequencies have been attenuated but not repressed altogether. Perfect filters would not have a roll-off.
The order of a filter determines the steepness of the roll-off. The higher the order the steeper the curve, and the faster the roll-off. Roll-off is usually a logarithmic value that is expressed in dB of attenuation per octave or decade of frequency (decade is a logarithmic quantity that represents a factor of 10 difference of between two numbers). Here is a link to a Pd patch that enables you to play around with the order of a low-pass filter to explore this concept.
A first-order filter, for example, will reduce the signal amplitude by half (equivalent to a power reduction of 6 dB) every time the frequency doubles (equivalent to going up one octave). The Bode plot for a first-order low-pass filter (featured above) looks like a horizontal line to the left of the cut-off frequency, to the right of the cut-off frequency a diagonal line slopes downward. There is also a “knee curve” at the boundary between these two lines, which creates a smooth transition between the two straight line regions.
It is important to keep in mind that people will often use the terms “above” and “below” to refer to the areas on the right and left of the cut-off frequencyin a Bode plot. The reason being, higher frequencies are mapped to the right and lower frequencies are mapped to the left on this type of graph. Note that the filter on the Bode plot above is of the first order. The reason being roll-off of 20dB per decade is equivalent to one of 6dB per octave.
A second-order filter attenuates higher frequencies more steeply. The Bode plot for this type of filter resembles that of a first-order filter, except that it falls off more quickly. A second-order filter will usually reduce the signal amplitude twice as fast as a first-order filter. Resulting in a reduction of one fourth of the signal’s level every time the frequency doubles. In other words, the power decreases by 12 dB per octave or 40dB per decade.
Third- and higher-order filters are defined similarly. In general, the final rate of power rolloff for an order-n all-pole filter is 6n dB per octave, or 20n dB per decade.
To create second and third order filters using puredate, you need to connect multiple filter objects in a serial arrangement. This can be done with low-pass, high-pass, and band-pass filters.
Types of Filters
There are many types of filters. Some of the most prominent types include: Butterworth filter, Chebyshev filter, Bessel filter. The difference between these filters is that they have different-looking “knee curves”.
Many filters are designed to have “peaking” or resonance, causing their frequency response at the cutoff frequency to be above the horizontal line. I will soon write a post about the concept of resonance in relation to sound. This effect can often be controlled and used one’s benefit, though it can also cause unwanted noise and volume jumps.
Most filters are linear time-invariant systems. What this means is that the relationship between input and output is linear and that the the response of the system is identical regardless of when a signal is introduced into it. For example, whether you add input now or N seconds from now the output will be the same expect for a delay of N seconds.
Here is a list of different types of filters, along with links to posts with additional information and Pd code examples (where availalble):