---
title: Shelving and peaking equalizers
heading: Filters that boost or cut part of the spectrum and leave the rest alone
eyebrow: C4 · Lesson 16 · Shelving and peaking equalizers
xp: 40
---

::: hook
Most filters in this course pass one band and reject another. An equalizer does something gentler: it lifts or lowers part of the spectrum by a set number of decibels and leaves everything else at unity gain. A stereo's bass and treble knobs are shelving filters; each slider of a graphic equalizer, and each band of a mixing desk's parametric equalizer, is a peaking filter. Equalizers also correct sensors, loudspeakers and rooms, and they compensate for cable loss in high-speed links. Lesson 15 built a notch and an all-pass from a second-order section; a peaking equalizer is the same section with a gain knob, and it can be written as the signal plus a scaled bandpass.
:::

::: play
- The solid curve is a peaking equalizer centered on 1 kHz. Slide its gain between −12 and +12 dB and its Q.
- The dashed curve is a low shelf whose gain changes by half its decibels at 100 Hz.
- Notice how the peak at +6 dB and the dip at −6 dB are mirror images, and how a higher Q narrows the bell without changing its height.
:::

```sim plot
view: graph
x: f = 20..20000 log
y: G = -15..15
slider: g = -12..12 step 0.5 = 6
slider: Q = 0.5..8 step 0.1 = 1.4
slider: s = -12..12 step 0.5 = 10
plot: 10*log(((1 - (f/1000)^2)^2 + (10^(g/40)*(f/1000)/Q)^2)/((1 - (f/1000)^2)^2 + ((f/1000)/(10^(g/40)*Q))^2)) | samples: 1500 | label: peaking, dB
plot: 10*log(((f/(100/10^(s/40)))^2 + 10^(s/10))/((f/(100/10^(s/40)))^2 + 1)) | dashed | color: ch2 | label: low shelf, dB
readout: lower half-gain frequency in Hz = 1000*(sqrt(1 + 1/(4*Q^2)) - 1/(2*Q)) | digits: 4
readout: upper half-gain frequency in Hz = 1000*(sqrt(1 + 1/(4*Q^2)) + 1/(2*Q)) | digits: 4
```

::: predict
## A graphic equalizer has one slider per octave. What Q should each peaking section have, measured between the points where its decibel gain is half the peak's?

- [ ] 0.5
- [ ] 0.71
- [x] 1.41
- [ ] 4.3

::: reveal
1.41. An octave band runs from $f_1$ to $2f_1$ with its center at the geometric mean, $\sqrt2f_1$, so $Q = f_0/(f_2 - f_1) = \sqrt2f_1/f_1$ = 1.41. A third-octave equalizer, with 31 bands across the audio range, needs $Q = 2^{1/6}/(2^{1/3} - 1)$ = 4.32.
:::
:::

::: nameit
## The low shelf

A first-order low shelf with gain $G$ at low frequencies and 1 at high frequencies is

$$H(s) = \frac{s + G\omega_c}{s + \omega_c}$$

a pole at $\omega_c$ and a zero at $G\omega_c$. Its decibel gain passes through half its full value at $\omega_m = \sqrt G\,\omega_c$, the geometric mean of the pole and zero, which is the frequency a designer usually quotes. A high shelf swaps the roles: $H(s) = (Gs + \omega_c)/(s + \omega_c)$. With $G < 1$ they cut instead of boost.

## The peaking (bell) equalizer

$$H(s) = \frac{s^2 + s\dfrac{A}{Q}\omega_0 + \omega_0^2}{s^2 + s\dfrac{1}{AQ}\omega_0 + \omega_0^2}$$

- At $\omega = \omega_0$ the gain is $A^2$, so the peak in decibels is $40\log_{10}A$.
- Far from $\omega_0$ the gain is 1.
- Replacing $A$ by $1/A$ swaps numerator and denominator, so a cut of the same Q is the exact mirror image of a boost in decibels: one undoes the other.
- The frequencies where the decibel gain is half the peak satisfy $\frac{\omega}{\omega_0} - \frac{\omega_0}{\omega} = \pm\frac1Q$, so the bandwidth between them is $\omega_0/Q$, for any gain. That's the definition of Q this form uses; datasheets and audio software don't all agree on it, so check which one a product means.

## Signal plus bandpass

The bell is the input plus a scaled bandpass:

$$H(s) = 1 + (A^2 - 1)\frac{s\,\omega_0/(AQ)}{s^2 + s\,\omega_0/(AQ) + \omega_0^2}$$

That's how many circuits build it: a bandpass section whose output is added to or subtracted from the dry signal with a gain knob. A **graphic equalizer** is a bank of such sections at octave or third-octave spacing; a **parametric equalizer** lets the user set $f_0$, $Q$ and gain for each one.
:::

::: example
## Design a low shelf with +10 dB of bass boost whose gain is +5 dB at 100 Hz. Where are its pole and zero, and what is its gain at 200 Hz?

::: solution
1. **Gain ratio.**
   $$\begin{aligned} G &= 10^{10/20} \\ &= 3.162 \end{aligned}$$
2. **Pole.** The half-gain point is $\sqrt G f_c$ = 100 Hz, so
   $$\begin{aligned} f_c &= \frac{100}{\sqrt{3.162}} \\ &= 56.2\ \text{Hz} \end{aligned}$$
3. **Zero.**
   $$Gf_c = 177.8\ \text{Hz}$$
4. **Gain at 200 Hz.**
   $$|H|^2 = \frac{(200/56.2)^2 + 3.162^2}{(200/56.2)^2 + 1}$$
   which gives 2.2 dB.
5. **Why a shelf sounds gentle.** The boost fades over about two octaves above the midpoint, which is why a shelf sounds gentle.

**Answer:** the pole is at 56.2 Hz and the zero at 177.8 Hz, and the gain at 200 Hz is 2.2 dB.
:::
:::

::: example
## A peaking equalizer at 1 kHz has +6 dB of gain and Q = 1.414. What is $A$, where are its half-gain (+3 dB) points, and what does the cut setting at −6 dB do to a signal that was boosted?

::: solution
1. **Find A.**
   $$\begin{aligned} A &= 10^{6/40} \\ &= 1.413 \end{aligned}$$
2. **Half-gain condition.** With $x = f/f_0$, the half-gain points satisfy
   $$x - \frac1x = \pm\frac1Q$$
3. **Solve for x.**
   $$\begin{aligned} x &= \sqrt{1 + \frac{1}{4Q^2}} \pm \frac{1}{2Q} \\ &= 1.061 \pm 0.354 \end{aligned}$$
   giving 707 Hz and 1414 Hz: exactly an octave, as the predict question said.
4. **The cut setting.** The −6 dB setting replaces $A$ by $1/A$, which swaps the numerator and denominator.
5. **Boost, then cut.** So passing a signal through the boost and then the cut leaves it exactly as it was, at every frequency, in phase as well as magnitude.

**Answer:** $A$ = 1.413, the half-gain points are at 707 Hz and 1414 Hz, and the −6 dB cut exactly undoes the boost.
:::
:::

::: example
## Write a +9 dB, Q = 2 bell at $f_0$ as the signal plus a bandpass. What's the bandpass's peak gain and Q, and the bell's gain at $1.2f_0$?

::: solution
1. **Find A.**
   $$\begin{aligned} A &= 10^{9/40} \\ &= 1.679 \end{aligned}$$
2. **The bandpass.** It's scaled by $A^2 - 1$ and has quality factor $AQ$:
   $$\begin{aligned} A^2 - 1 &= 1.818 \\ AQ &= 3.36 \end{aligned}$$
3. **Check at the center.** At the center the bandpass section's gain is 1, so the total is
   $$1 + 1.818 = 2.818$$
   which is 9 dB.
4. **Numerator at x = 1.2.**
   $$\begin{aligned} N &= (1 - 1.44)^2 \\ &\quad + (1.679 \times 1.2/2)^2 \\ &= 0.194 + 1.015 \end{aligned}$$
5. **Denominator at x = 1.2.**
   $$\begin{aligned} D &= (1 - 1.44)^2 \\ &\quad + (1.2/(1.679 \times 2))^2 \\ &= 0.194 + 0.128 \end{aligned}$$
6. **Gain at x = 1.2.**
   $$\begin{aligned} |H|^2 &= \frac{0.194 + 1.015}{0.194 + 0.128} \\ &= 3.76 \end{aligned}$$
   so the gain is 5.75 dB.
7. **Why the bandpass Q is higher.** The bandpass's Q is higher than the bell's: the boost is narrower than its own bandpass's skirts would suggest, because adding the dry signal lifts the skirts toward 0 dB.

**Answer:** the bandpass has a peak gain of 1.818 and a Q of 3.36, and the bell's gain at $1.2f_0$ is 5.75 dB.
:::
:::

::: check
given: g = 3 | 6 | 9 | 12 | -6 | -9
answer: 10^(g/40)
tolerance: 0.5%

## A peaking equalizer in the form above has a peak gain of {g} dB. What is $A$?

::: right
Right. The peak gain is $A^2$, so $A = 10^{g/40}$ = {answer}.
:::

::: misses
- [10^(g/20)] That's the peak gain $A^2$ as a ratio. $A$ is its square root.
- [10^(g/10)] Decibels of voltage use 20 log; and the peak is $A^2$.
- [any] Not yet. $40\log_{10}A = g$.
:::
:::

::: check
kind: parts
given: g = 6 | 10 | 15; fm = 80 | 100 | 150

## A first-order low shelf boosts by {g} dB at low frequency, with its half-gain point at {fm} Hz.

::: part
answer: fm/10^(g/40)
unit: Hz
tolerance: 0.5%

### Where is its pole?

::: misses
- [fm/10^(g/20)] The midpoint is $\sqrt G$ times the pole, not $G$ times.
- [fm*10^(g/40)] That's the zero. The pole is below the midpoint.
- [any] Not yet. $f_c = f_m/\sqrt G$ with $G = 10^{g/20}$.
:::
:::

::: part
answer: fm*10^(g/40)
unit: Hz
tolerance: 0.5%

### Where is its zero?

::: misses
- [fm/10^(g/40)] That's the pole.
- [any] Not yet. The zero is at $Gf_c = \sqrt G f_m$.
:::
:::

::: right
Right. The pole and zero sit symmetrically, on a log scale, about the midpoint.
:::
:::

::: check
given: f0 = 250 | 1000 | 4000; Q = 0.7 | 1.4 | 2
answer: f0*(sqrt(1 + 1/(4*Q^2)) + 1/(2*Q))
unit: Hz
tolerance: 0.5%

## A peaking equalizer at {f0} Hz has Q = {Q}. At what frequency above the center does its decibel gain fall to half the peak's?

::: right
Right. $f = f_0\left(\sqrt{1 + 1/4Q^2} + 1/2Q\right)$ = {answer}.
:::

::: misses
- [f0*(1 + 1/(2*Q))] The points are symmetric on a log scale, not a linear one: solve $x - 1/x = 1/Q$.
- [f0*(sqrt(1 + 1/(4*Q^2)) - 1/(2*Q))] That's the lower point.
- [any] Not yet. Solve $x - 1/x = 1/Q$ for $x = f/f_0$.
:::
:::

::: check
given: N = 1 | 2 | 3 | 6
answer: 2^(1/(2*N))/(2^(1/N) - 1)
tolerance: 0.5%

## A graphic equalizer has bands spaced 1/{N} octave apart. What Q gives each section a half-gain bandwidth of exactly one band?

::: right
Right. With $f_2/f_1 = 2^{1/N}$ and $f_0 = \sqrt{f_1f_2}$, $Q = 2^{1/2N}/(2^{1/N} - 1)$ = {answer}.
:::

::: misses
- [N] That's roughly right only for narrow bands; compute it from the band edges.
- [1/(2^(1/N) - 1)] Measure the bandwidth from the geometric center, $\sqrt{f_1f_2}$, not from $f_1$.
- [any] Not yet. $Q = f_0/(f_2 - f_1)$ with $f_2 = 2^{1/N}f_1$.
:::
:::

::: check
given: g = 6 | 9 | 12; Q = 1 | 2 | 4; x = 0.8 | 1.25 | 1.5
answer: 10*log(((1 - x^2)^2 + (10^(g/40)*x/Q)^2)/((1 - x^2)^2 + (x/(10^(g/40)*Q))^2))
tolerance: 1%

## A peaking equalizer has a {g} dB peak and Q = {Q}. What is its gain in dB at {x} times its center frequency?

::: right
Right. {answer} dB.
:::

::: misses
- [20*log(((1 - x^2)^2 + (10^(g/40)*x/Q)^2)/((1 - x^2)^2 + (x/(10^(g/40)*Q))^2))] That's twice the decibels: the expression is already $|H|^2$, so use 10 log.
- [any] Not yet. Evaluate $|H(jx\omega_0)|^2$ and take $10\log_{10}$.
:::
:::

::: check
kind: choice

## A signal passes through a peaking equalizer set to +6 dB at 1 kHz with Q = 2, then through a second one set to −6 dB at 1 kHz with Q = 2. What comes out?

- [x] The original signal, unchanged in magnitude and phase
- [ ] The original magnitude, with a phase shift near 1 kHz
- [ ] A small residual bump, since the cut is narrower than the boost
- [ ] A 0 dB response only at exactly 1 kHz

::: right
Right. Replacing $A$ by $1/A$ swaps numerator and denominator, so the cut's transfer function is exactly the boost's inverse, and their product is 1.
:::

::: misses
- [2] The phases cancel too: the product of the two transfer functions is exactly 1.
- [3] In this form, boost and cut at the same Q are exact mirror images.
- [4] It cancels at every frequency, not just the center.
:::
:::

::: check
kind: derivation
vars: A = 0.3..3, Q = 0.5..8

## Write the bell as $1 + k\cdot\dfrac{s\,\omega_0/(AQ)}{s^2 + s\,\omega_0/(AQ) + \omega_0^2}$.

::: step
answer: A/Q

### Combining over the common denominator, the numerator's $s$ coefficient (in units of $\omega_0$) is $(1 + k)/(AQ)$. What must it equal to match the bell?
:::

::: step
answer: A^2 - 1

### What is $k$?
:::

::: right
Right. $k = A^2 - 1$: positive for a boost, between −1 and 0 for a cut.
:::
:::

::: check
kind: python
given: g = 4 | 8 | 12; Q = 0.7 | 1.4 | 3

## Write `bell_db(f, f0, g, Q)` for the peaking equalizer above (gain `g` in dB at `f0`). Then find its upper half-gain frequency for `f0 = 1000` numerically: bisect between `f0` and `100*f0` for the point where the gain is `g/2` dB, to 1e-9 Hz, and set `f_half`. Also set `cancel`, the largest absolute value in dB of `bell_db(f, 1000, g, Q) + bell_db(f, 1000, -g, Q)` over `f = numpy.logspace(1, 5, 2001)`.

```python starter
import numpy as np
def bell_db(f, f0, g, Q):
    return g / (1 + (Q * (f / f0 - f0 / f)) ** 2)
f_half = 1000 * (1 + 1 / (2 * Q))
cancel = 0.0
print(f_half)
```

```python solution
import numpy as np
def bell_db(f, f0, g, Q):
    A = 10 ** (g / 40)
    x = np.asarray(f, dtype=float) / f0
    num = (1 - x**2) ** 2 + (A * x / Q) ** 2
    den = (1 - x**2) ** 2 + (x / (A * Q)) ** 2
    return 10 * np.log10(num / den)
lo, hi = 1000.0, 1e5
while hi - lo > 1e-9:
    m = (lo + hi) / 2
    if bell_db(m, 1000, g, Q) > g / 2: lo = m
    else: hi = m
f_half = (lo + hi) / 2
fs = np.logspace(1, 5, 2001)
cancel = float(np.max(np.abs(bell_db(fs, 1000, g, Q) + bell_db(fs, 1000, -g, Q))))
print(f_half, cancel)
```

```python tests
import numpy as np
ref = 1000 * (np.sqrt(1 + 1 / (4 * Q**2)) + 1 / (2 * Q))
assert abs(f_half - ref) < 1e-6, f"The half-gain point should be f0·(√(1 + 1/4Q²) + 1/2Q) = {ref:.6f} Hz."
assert abs(bell_db(1000, 1000, g, Q) - g) < 1e-9, "The gain at f0 should be g dB."
assert abs(bell_db(1e6, 1000, g, Q)) < 1e-3, "Far from f0 the gain should return to 0 dB."
assert cancel < 1e-9, "A boost and the same cut should cancel at every frequency."
```

::: right
Right. The numerical half-gain point lands on the formula for every gain, which is what makes this definition of Q convenient: it describes the bell's width independently of its height.
:::
:::

::: explain
## A loudspeaker has a 4 dB peak at 2.5 kHz about a third of an octave wide. Explain how you'd flatten it with a peaking equalizer, what Q and gain you'd choose, and why the correction also fixes the speaker's phase near that frequency, if the peak comes from a simple resonance.

::: model
Set a peaking section at 2.5 kHz to cut by 4 dB, with a Q matched to the peak's width; a third-octave-wide feature measured at its half-decibel points suggests Q of about 4.3. If the speaker's peak behaves like a second-order resonance, it's itself a bell-shaped response with numerator and denominator of the same form, and the equalizer's cut is approximately its inverse: multiplying them gives nearly 1, flat in magnitude, and since a pole pair is cancelled by a matching zero pair, the phase disturbance near the resonance cancels as well, as it does exactly when a boost meets its mirror cut. That's the advantage of correcting a minimum-phase feature with a minimum-phase filter. Peaks that come from room reflections, which aren't minimum-phase, can't be fixed this way.
:::
:::

::: practice

::: check
given: g = 3 | 6 | 10 | 15
answer: 10^(g/20)
tolerance: 0.5%

## A low shelf boosts by {g} dB. What is its low-frequency gain $G$ as a ratio?

::: misses
- [10^(g/10)] Voltage gain: divide by 20.
- [any] $G = 10^{g/20}$.
:::
:::

::: check
given: f0 = 500 | 2000; Q = 1 | 3
answer: f0*(sqrt(1 + 1/(4*Q^2)) - 1/(2*Q))
unit: Hz
tolerance: 0.5%

## Where is the lower half-gain point of a peaking equalizer at {f0} Hz with Q = {Q}?

::: misses
- [f0*(1 - 1/(2*Q))] Solve $1/x - x = 1/Q$ exactly.
- [any] $f_0(\sqrt{1 + 1/4Q^2} - 1/2Q)$.
:::
:::
:::
