Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 64

Audio Filter Design for EQ and Tone Control

Recommended resources

Hello! Welcome to your next lesson in our module on the Fundamentals of Digital Audio Processing.

In our last session, we mastered the Short-Time Fourier Transform (STFT) and the spectrogram, giving us a powerful tool to visualize how the frequency content of an audio signal changes over time. Today, we take the next logical step: learning how to modify that frequency content.

This lesson directly addresses the learning outcome: Design and apply digital filters for audio equalization and tone control. We will explore how to build the fundamental tools used by audio engineers to shape the timbre and character of sound. We'll start with the basic building blocks of digital filters and then dive into the mathematics of designing the most common and flexible type of audio equalizer: the parametric EQ.

A Brief History of Equalization

As you appreciate the "why" behind concepts, it's worth noting that the term "equalizer" originated in early telephone engineering. Long cables caused greater attenuation of high frequencies, and filters were needed to boost them back up, making the system's frequency response more equal across the spectrum. This corrective tool was soon adopted by recording engineers for creative purposes, evolving from simple bass/treble "tone controls" to the sophisticated tools we have today.

All About Audio Equalization: Solutions and Frontiers

For a concise overview of this evolution, from telegraphy to the invention of the parametric equalizer, please read the history section of the review paper 'All About Audio Equalization'.

Please read Section 2, 'History of Audio Equalization'. This will provide valuable context for the filter designs we are about to study.


1. The Anatomy of a Digital Filter

At its core, any digital filter, no matter how complex its effect, is constructed from three simple operations:

  1. Delay: Storing a sample to be used later (represented as in the z-domain).
  2. Scaling: Multiplying a sample by a constant (a coefficient).
  3. Addition: Summing multiple signal paths.

The following video provides an excellent, intuitive explanation of how these three blocks form the foundation of digital filtering.

Building a Digital Filter: How it works + Simulation + Example

This video, 'Building a Digital Filter', demonstrates how a filter can be constructed from basic principles.

Watch from 10:47 to 12:59. Focus on how the presenter introduces the three fundamental building blocks of a digital filter.

By arranging these blocks in different ways, we can create the two primary classes of digital filters:

  • Finite Impulse Response (FIR) Filters: These use only feed-forward paths. The output at any time is a weighted sum of current and past input samples. The underlying operation is convolution. They are inherently stable but can be computationally expensive for sharp filters.
  • Infinite Impulse Response (IIR) Filters: These use feedback, meaning the output is a function of both past inputs and past outputs. This recursion allows for very efficient and sharp filters, making them the standard choice for audio equalization. However, the feedback loop introduces the possibility of instability if not designed correctly.

Let's watch a clear conceptual comparison of these two structures.

Building a Digital Filter: How it works + Simulation + Example

The same video provides a superb visual and conceptual breakdown of FIR (feed-forward) versus IIR (feedback) filters.

Please watch from 17:47 to 23:32. Pay close attention to the distinction between FIR filters creating 'zeros' (nulls) and IIR filters creating 'poles' (peaks) through feedback. This is a crucial concept.

For the remainder of this lesson, we will focus on IIR filters, as they are the workhorses of real-time audio equalization.


2. Designing Parametric Equalizer Filters

A parametric equalizer provides the most flexible form of equalization. For each filter band, an engineer can control three parameters:

  1. Center Frequency (): The frequency at which the boost or cut is maximal.
  2. Gain (G): The amount of boost or cut, specified in decibels (dB).
  3. Quality Factor (Q): A measure of the filter's bandwidth. A high Q gives a narrow, sharp filter, while a low Q gives a wide, broad one.

The most common building block for a parametric EQ is a second-order IIR filter, often called a biquad. We'll now dive into the mathematical design of a biquad peaking filter.

Deriving the Peaking Filter Transfer Function

Our goal is to derive the coefficients of a digital filter's transfer function, , based on the parameters , , and . A standard and robust method, which leverages your EE background, is to design an analog prototype and then convert it to the digital domain using the bilinear transform.

Bilinear Transform Mapping from S-Plane to Z-Plane
The bilinear transform maps the entire left-half of the continuous-time s-plane (the stable region) into the unit circle of the discrete-time z-plane. This preserves filter stability and order, but introduces a non-linear "warping" of the frequency axis, which must be accounted for in the design.

The full derivation is quite involved, but the high-level steps are:

  1. Start with a simple analog prototype filter, like a 1st-order low-shelf.
  2. Apply a lowpass-to-bandpass frequency transformation in the analog domain. This converts the low-shelf into a bandpass/peaking filter centered at our desired .
  3. Apply the bilinear transform to map the analog transfer function to a digital transfer function .

The paper "All About Audio Equalization" provides the complete derivation. We will focus on the result for the most common filter type, the second-order peaking/notch filter.

All About Audio Equalization: Solutions and Frontiers

This section of the paper details the mathematical design of the filters we need. It's dense, but it provides the rigorous foundation you're looking for.

Please read Section 3.3, 'Second Order Peaking and Notch Filters'. Focus on understanding the design constraints (Equations 20-24) and the final resulting transfer function (Equation 29). You can skim the intermediate steps but pay close attention to the final form.

From the paper, the final transfer function for a peaking filter is:

This might look intimidating, but it's just a second-order IIR filter where all the coefficients are determined by our desired parameters:

  • is the linear gain (e.g., for a +6 dB boost, ). For a cut, we use .
  • is the normalized center frequency, where is the sample rate.
  • is an intermediate variable related to bandwidth or Q, calculated as:

This transfer function gives us the 'recipe' for our filter. The numerator coefficients define the 'zeros' and the denominator coefficients define the 'poles' that shape the frequency response.

Test your understanding!

Looking at the transfer function above, what happens to the filter if the gain is set to 1 (i.e., 0 dB)?

Show answer

If , the numerator becomes , which is identical to the denominator. The transfer function becomes . This means the filter passes the signal through without any change, which is exactly what we expect from an equalizer set to 0 dB gain.

The Biquad Implementation

The transfer function above is implemented using a structure called a biquad. It directly maps the feed-forward (numerator) and feedback (denominator) coefficients into a diagram of delays, multipliers, and adders.

Building a Digital Filter: How it works + Simulation + Example

Let's revisit the 'Building a Digital Filter' video to see this biquad structure and how it combines the FIR (feed-forward) and IIR (feedback) concepts we saw earlier.

Watch from 23:32 to 28:40. The presenter shows a common biquad diagram (Direct Form 1). Notice how the 'B' coefficients correspond to our transfer function's numerator and control the zeros, while the 'A' coefficients correspond to the denominator and control the poles. He also mentions the famous 'RBJ Audio EQ Cookbook', which is the source of these standardized formulas.


3. From Theory to Practice: A Case Study

We now have the theory: we can calculate the 'a' and 'b' coefficients for a biquad filter from our desired , , and . Let's see how this is done in practice using a computer simulation.

The video LINK walks through an entire project of designing a notch filter (which is just a peaking filter with a gain ) to remove an annoying 1kHz tone from a song. This is a perfect demonstration of applying our theory.

Building a Digital Filter: How it works + Simulation + Example

This segment of the video is a complete walkthrough of simulating our filter design in a Python-based Jupyter Notebook. It beautifully ties together the theory we've just learned with the analysis techniques from our last lesson.

Please watch the detailed walkthrough from 01:00:40 to 01:25:47. Observe the key steps: Analysis: Loading the audio and looking at its spectrum (spectrogram) to confirm the presence of the 1kHz tone. Coefficient Calculation: Using the formulas we discussed to calculate the a and b coefficients from the desired notch frequency and bandwidth. Verification: Plotting the frequency response of the calculated filter to ensure it has the correct notch shape. Application: Applying the filter to the audio signal. Confirmation: Analyzing the spectrum of the filtered audio to confirm the 1kHz tone has been removed.

This workflow—specify, design, simulate, apply, and verify—is fundamental to digital filter design in any application.


4. Common EQ Architectures

The biquad filter is the fundamental atom. Molecules of equalization are built by combining biquads.

  • Tone Controls: The simple "bass" and "treble" knobs on a stereo are typically first or second-order shelving filters. A low-shelf boosts or cuts all frequencies below a certain point, and a high-shelf does the same for frequencies above a certain point. A "mid" control is usually a single peaking filter. The derivations for these are similar to the peaking filter and are also in Section 3 of the LINK paper.

  • Graphic Equalizers: A graphic EQ presents sliders for boosting or cutting a set of fixed frequency bands (e.g., octave or 1/3-octave bands). The simplest implementation is a cascade of biquad peaking filters, one for each band. However, because the filters' responses overlap, adjusting one slider affects its neighbors. Clever techniques, often involving linear algebra to create an "interaction matrix", are used to pre-compensate the filter gains to achieve a more accurate response. You can read more about this in Section 4.2 of the LINK paper.


Conclusion

In this lesson, we have bridged the gap between signal analysis and signal modification. We've gone deep into the design of the most important tool for audio spectral shaping: the parametric EQ.

Key Takeaways:

  • Audio equalization is the process of altering a signal's frequency balance.
  • IIR filters are preferred for EQ due to their computational efficiency. They use feedback to create poles, which can form sharp peaks in the frequency response.
  • The biquad is the standard second-order IIR building block for audio filters.
  • We can derive the coefficients for a biquad filter (e.g., a peaking or shelving filter) from user-friendly parameters like Gain, Center Frequency, and Q using formulas derived from analog prototypes via the bilinear transform.
  • Complex equalizers, like parametric and graphic EQs, are built by cascading multiple biquad sections.

Preview of the Next Lesson:

We have now explored modifying the frequency domain. In our next lesson, "Analyze and implement delay-based audio effects, including simple echo and feedback-based reverberation," we will shift our focus to modifying the signal primarily in the time domain. The concept of feedback we encountered in IIR filters will prove to be central to creating these classic audio effects.