Skip to main content

Welcome to a Grasp lesson

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

Lesson 73

Multi-Band Audio Equalizer Design

Recommended resources

Hello! Welcome to the next lesson in our capstone project.

In our last session, we successfully bridged the gap between theory and practice by implementing a digital filter's difference equation in code. You now know how to take a set of coefficients and process a real-time audio stream, sample by sample.

Today, we'll leverage that foundational skill to build one of the most essential tools in audio engineering: a multi-band graphic equalizer. We will focus specifically on the learning outcome of designing a bank of parallel bandpass filters to serve as a multi-band audio equalizer. You'll see how combining multiple instances of the filters we've studied creates a system far more powerful and flexible than any single filter on its own.

1. Architectures of an Equalizer

An equalizer is a system of filters that allows you to independently control the gain (boost or cut) of different frequency bands. There are two primary ways to construct a digital graphic equalizer:

  1. Cascade Structure: Filters are placed in series. The output of the first filter becomes the input to the second, and so on. This is common for parametric equalizers where each filter is a "peaking" type that has unity gain far from its center frequency.
  2. Parallel Structure: The input signal is fed to all filters simultaneously. The outputs of these filters are then scaled by their respective gains and summed together.

Our focus today is on the parallel structure, as it directly uses a bank of independent bandpass filters.

All About Audio Equalization: Solutions and Frontiers

To understand the different architectures, let's start with a high-level overview. This survey paper on audio equalization provides excellent descriptions and diagrams.

Please read the introduction to Section 4, 'Graphic Equalizers,' up to the beginning of subsection 4.1. This short text introduces the concept of a graphic EQ and mentions the cascade and parallel implementations. Pay close attention to the descriptions of how each structure works.


2. The Parallel Filter Bank

The parallel architecture is conceptually very straightforward. The input signal is split, processed by several independent filters, and the results are combined at the end.

A diagram showing the parallel filter bank structure. The input signal x(n) is fed to a direct path with gain g0, and also to N parallel bandpass filters H1(z) through HN(z). The output of each filter Hm(z) is scaled by a gain gm. All scaled outputs and the direct path are summed to produce the final output y(n).
This diagram illustrates the parallel graphic equalizer structure. The input x[n] is fed to a bank of bandpass filters and a direct 'dry' path. The output of each filter is scaled by a user-controlled gain and then summed to create the final output y[n].

The total transfer function of this system is the sum of the individual paths:

Where:

  • is the transfer function of the m-th bandpass filter.
  • is the gain (boost or cut) applied to that band, controlled by the user (e.g., with a slider).
  • is the gain of the direct or "dry" path. Often, this is just set to 1.

The core of this design is the bank of filters, . To make this an effective equalizer, each must be a bandpass filter, which isolates a specific range of frequencies.


3. Designing the Individual Bands

Each filter in our bank will be a second-order IIR bandpass filter, often called a "biquad." In the last lesson, you saw how a filter is defined by its difference equation, which in turn comes from its transfer function. The process for designing one band of our EQ is:

  1. Define the analog prototype transfer function.
  2. Use the bilinear transform to convert it to a digital transfer function .
  3. Extract the coefficients for the difference equation.

A standard analog second-order bandpass filter is given by the transfer function:

Where:

  • is the center frequency in radians/sec ().
  • is the "quality factor," which defines the sharpness of the band. A higher means a narrower, more selective filter. is inversely related to bandwidth: .

We can use the bilinear transform, just as we've seen before, to convert this analog prototype into the digital filter coefficients needed for our implementation. This process involves substituting and applying frequency pre-warping to to ensure the digital filter's center frequency accurately matches the desired analog frequency.

The video below, while focused on a "peaking filter" (which we'll see is slightly different), provides an excellent demonstration of this exact design workflow: from analog prototype to digital coefficients.

(Sponsored) Audio EQ Software Implementation (STM32) - Phil's Lab #89

In this video from Phil's Lab, you'll see the complete process of designing a single parametric EQ band. The principles of deriving digital coefficients from an analog prototype using the bilinear transform are exactly what we need.

Please watch the following segments carefully: Discretization (11:02 - 13:26): Focus on the strategy. The goal is to move from the continuous s-domain to the discrete z-domain. He introduces the bilinear transform and the necessity of pre-warping the center frequency to correct for frequency mapping distortion. The Difference Equation (13:26 - 15:03): This is the result of the discretization. Observe the final second-order difference equation and the complex-looking formulas for the coefficients (a0 through b2). These formulas are the direct recipe for calculating our filter coefficients from the user parameters (center frequency, Q, and gain). Why Pre-Warp? (15:03 - 16:31): This segment visually demonstrates the importance of pre-warping for achieving an accurate frequency response in the final digital filter.

After this process, for each band in our equalizer, we will have a unique set of a and b coefficients that define a bandpass filter with a specific center frequency and Q-factor.


4. Designing the Filter Bank

Now that we know how to design a single band, how do we choose the parameters for a full bank of filters to create a useful graphic equalizer?

Frequency Spacing

Human hearing perceives frequency logarithmically. A jump from 100 Hz to 200 Hz sounds similar to a jump from 1000 Hz to 2000 Hz (an octave). Therefore, the center frequencies of an equalizer are typically spaced logarithmically, not linearly.

Standard graphic EQs use octave or 1/3-octave spacing. An octave EQ might have 10 bands with center frequencies like 31.5 Hz, 63 Hz, 125 Hz, 250 Hz, ..., 16 kHz.

Constant Q

To maintain a consistent perceived shape across all bands, graphic equalizers are often designed to be "constant Q". This means that although the absolute bandwidth (in Hz) of higher-frequency filters is larger, the ratio of the center frequency to the bandwidth () remains the same for all filters.

For an octave-spaced equalizer, the Q-factor can be estimated as:

where for one octave. This gives . For a 1/3-octave equalizer (), the Q-factor would be much higher, around 4.32, resulting in narrower bands.

All About Audio Equalization: Solutions and Frontiers

The paper 'All About Audio Equalization' provides the mathematical details for choosing the bands in a graphic equalizer.

Please read Section 4.1, 'Bands in Graphic Equalizers.' Focus on understanding: The logarithmic distribution of frequency bands. The concepts of octave and 1/3-octave spacing (the ratio R). How the Q factor relates to the band spacing and is often held constant.

This gives us a complete design procedure for the entire equalizer:

  1. Choose the number of bands and spacing (e.g., 10 bands, octave spacing).
  2. Determine the standard center frequencies () for these bands.
  3. Calculate the required Q-factor for this spacing.
  4. For each of the N bands, use its and the constant to calculate the digital bandpass filter coefficients ().
Test your understanding!

You are tasked with designing a 3-band parallel audio equalizer. The center frequencies are 200 Hz, 1000 Hz, and 5000 Hz. The sampling rate is 48 kHz.

  1. Sketch the block diagram of this system.
  2. You want the filter at 1000 Hz to have a bandwidth of 500 Hz. What is its Q-factor?
  3. What are the key steps you would follow to find the specific difference equation coefficients for this 1000 Hz filter?
Show answer
  1. Block Diagram: The diagram would show an input signal x[n] splitting into four paths.

    • One path is the direct signal, which might be scaled by a gain g_0.
    • The other three paths each go to a bandpass filter: H_1(z) (for 200 Hz), H_2(z) (for 1000 Hz), and H_3(z) (for 5000 Hz).
    • The output of each filter is scaled by its respective gain slider: g_1, g_2, g_3.
    • Finally, all four paths are summed together to produce the output y[n].
  2. Q-factor: The Q-factor is the ratio of the center frequency to the bandwidth.

  3. Steps to find coefficients:

    • Start with the analog prototype: Use the transfer function with rad/s and .
    • Pre-warp the center frequency: Calculate the warped analog frequency that will map to the correct digital frequency after the bilinear transform. The formula is , where and .
    • Apply the Bilinear Transform: Substitute into the analog transfer function, using the pre-warped frequency .
    • Simplify: Algebraically manipulate the resulting expression to get it into the standard rational polynomial form of . The numerator and denominator coefficients are the values you need for the difference equation. (In practice, one would use established formulas like those shown in the video, which are the result of this derivation).

5. Practical Implementation

In the previous lesson, you created a structure to implement a single filter. Now, you will create an array of these filter objects. The real-time audio processing loop becomes remarkably simple:

// Assume you have an array of filter objects, one for each band
// Filter band_filters[NUM_BANDS];
// And an array of gains from the user sliders
// float slider_gains[NUM_BANDS];

float processSample(float inputSample) {
    // Start with the direct signal (dry path)
    float outputSample = inputSample; 

    // Add the contribution from each bandpass filter
    for (int i = 0; i < NUM_BANDS; ++i) {
        // Get the output of the bandpass filter for this band
        float band_output = band_filters[i].update(inputSample);
        
        // Scale it by the user's gain and add to the total
        outputSample += slider_gains[i] * band_output;
    }

    return outputSample;
}

This structure is beautifully modular. Each band_filters[i] object is an independent biquad filter with its own coefficients and state (history of past inputs/outputs). Your main processing loop just iterates through them, sums their scaled outputs, and you have a working parallel equalizer!

PARAMETRIC EQUALIZER FILTERS FOR MUSICAL ...

This master's thesis describes implementing a 20-band equalizer using this exact parallel structure. It's a great, straightforward confirmation of the method.

Please read the short section titled '20-band semi-parametric equalizer (offline)'. Note how it describes the process: 'the sampled signal is filtered through the 20 band-pass filters each output is scaled by a gain... Then the 20 results are summed and the final output is obtained.' This perfectly matches the parallel architecture we've discussed.


Conclusion

You have now learned how to design one of the most fundamental tools in digital audio processing. By combining multiple simple filters in a parallel structure, we can achieve fine-grained control over a signal's frequency spectrum.

Key Takeaways:

  • A parallel graphic equalizer is built by summing the outputs of multiple bandpass filters that receive the same input signal.
  • The design process for the bank involves choosing logarithmically spaced center frequencies and a constant Q-factor appropriate for the desired band spacing (e.g., octave).
  • Each individual band is a second-order IIR (biquad) bandpass filter, designed by applying the bilinear transform to an analog prototype.
  • The implementation involves creating an array of filter objects and, for each audio sample, summing their scaled outputs with the original signal.

Preview of the Next Lesson:

We have now covered two major frequency-domain effects in our capstone project: spectral analysis and equalization. In the next lesson, we will pivot to the time domain and explore a new class of effects. We will begin by learning how to implement a simple echo effect using a circular buffer for delayed signal feedback.