Lecture 4 · Shelving and peak filters, wah-wah and phaser
| Block | Representation | Generator |
|---|---|---|
| Filters and effects | LTI and time-varying systems | hand-designed |
| Classical synthesis | samples, partials, modes, physical state | hand-designed |
| DDSP | the same structured models | parameters learned |
| Reverberation | a recursive dynamical system | hand-designed, fittable |
| Diffusion | a learned representation | learned |
The four questions
Filters and effects, part 3 of 5. Last time: allpass transformations. Today: shelving and peak filters built from an allpass, and filters whose parameters move in time.
Structures of digital filters
where the coefficients are determined
by the parameters of the desired frequency response
Shelving filters (low frequency shelving, high frequency shelving)
Peak filters
Literature:
Udo Zölzer. Digitale Audiosignalverarbeitung, 3. Auflage, B.G.Teubner, Stuttgart, 2005
desired frequency response as Bode diagram
Parameters:
cutoff frequency \(\omega_\mathrm{c}\)
gain \(V_0\)
\[\displaystyle H_1(s)=\frac{s+V_0\omega_\mathrm{c}}{s+\omega_\mathrm{c}}\]
\[\displaystyle H_2(s)=\frac{s+\omega_\mathrm{c}}{s+\omega_\mathrm{c}/V_0}\]
\[\displaystyle H_1(0)=H_2(0)=V_0\:,\qquad H_1(\infty)=H_2(\infty)=1\]
Ideal combination:
| \(H_1(s)\) | for | \(V_0>1\) |
| \(H_2(s)\) | for | \(V_0<1\) |
Disadvantage
different prototypes for \(V_0>1\) and \(V_0<1\)
Wanted: discrete equivalent with a unified structure
\(H_1(s) = \frac{s+V_0\omega_\mathrm{c}}{s+\omega_\mathrm{c}}\) for both, \(f_\mathrm{c}\) = 250 Hz:
| dry | |
| \(G\) = +12 dB | |
| \(G\) = −12 dB |

With \(H_1\) the cut is not the mirror image of the boost: at \(f_\mathrm{c}\) +9.3 dB, but only −2.7 dB. Hence \(H_2\) for \(V_0 < 1\), and the wish for one structure for both.
Prototype filter 1. : \(V_0>1\)
\[\begin{array}{rcl}\displaystyle H_{1\mathrm{c}}(s) &\displaystyle = &\displaystyle \frac{s+V_0\omega_\mathrm{c}}{s+\omega_\mathrm{c}} = \frac{s+\omega_\mathrm{c}}{s+\omega_\mathrm{c}} + (V_0 - 1)\frac{\omega_\mathrm{c}}{s+\omega_\mathrm{c}} \stackrel{H_0=V_0-1}{=} 1 + H_0 \frac{1}{(s/\omega_\mathrm{c}) + 1} \\\displaystyle H_{1\mathrm{cn}}(\sigma) &\displaystyle = &\displaystyle 1+H_0\frac{1}{\sigma T/2+1}\\\displaystyle H_{1\mathrm{dn}}(\zeta) &\displaystyle = &\displaystyle 1+\frac{H_0}{2}\left[1+\zeta^{-1}\right] \\[2mm]\displaystyle H_{1\mathrm{d}}(z) &\displaystyle = &\displaystyle 1+\frac{H_0}{2}\left[1+A_1(z)\right]\qquad A_1(z)=\frac{\alpha z+1}{z+\alpha} \end{array}\]
Prototype filter 2. : \(V_0<1\)
\[\begin{array}{rcl}\displaystyle H_{2\mathrm{c}}(s) &\displaystyle = &\displaystyle \frac{s+\omega_\mathrm{c}}{s+\omega_\mathrm{c}/V_0} = 1 + H_0 \frac{\omega_\mathrm{c}/V_0}{s+\omega_\mathrm{c}/V_0} = 1 + \frac{H_0}{2}\left[1 + \frac{1/V_0-s/\omega_\mathrm{c}}{1/V_0+s/\omega_\mathrm{c}} \right] \\[2ex]\displaystyle H_{2\mathrm{cn}}(\sigma) &\displaystyle = &\displaystyle 1+\frac{H_0}{2} \left[1+\frac{1/V_0-\sigma T/2}{1/V_0 + \sigma T/2}\right] = 1+\frac{H_0}{2} \Big[1+ A_{2\mathrm{cn}}(\sigma)\Big] \\[2ex]\displaystyle A_{2\mathrm{cn}}(\sigma) &\displaystyle = &\displaystyle \frac{1/V_0-\sigma T/2}{1/V_0 + \sigma T/2}\\\displaystyle A_{2\mathrm{dn}}(\zeta) &\displaystyle = &\displaystyle \dfrac {\frac{1}{V_0} - \frac{\zeta-1}{\zeta+1}} {\frac{1}{V_0} + \frac{\zeta-1}{\zeta+1}} = \dfrac{(\zeta+1)-V_0(\zeta-1)}{(\zeta+1)+V_0(\zeta-1)} = \frac{\zeta\left(\frac{1-V_0}{1+V_0}\right)+1}{\zeta+\left(\frac{1-V_0}{1+V_0}\right)} \\[3ex]\displaystyle H_{2\mathrm{dn}} (\zeta) &\displaystyle = &\displaystyle 1+\frac{H_0}{2}\Big[1+A_{2\mathrm{dn}}(\zeta)\Big] \end{array}\]
\[\begin{array}{rcl}\displaystyle H_{2\mathrm{dn}} (\zeta) &\displaystyle = &\displaystyle 1+\frac{H_0}{2}\Big[1+A_{2\mathrm{dn}}(\zeta)\Big] \\\displaystyle H_\mathrm{2d}(z) &\displaystyle = &\displaystyle 1+\frac{H_0}{2}\Big[1+A_2(z)\Big] \end{array}\]
same structure for \(V_0 \gtrless 1\) !
coefficients for \(A_{1/2}(z)=A(z)\)
\(V_0>1\) (boost): \(\displaystyle A_1(z)=A(z)=\frac{a z+1}{z+a}\) \(\displaystyle
a=\alpha=\frac{\omega_\mathrm{c}T/2-1}{\omega_\mathrm{c}T/2+1}\)
Frequency warping
\(\displaystyle \omega_\mathrm{c}T/2=\tan\frac{\Omega_\mathrm{c}}{2}=\tan\left(\pi f'_\mathrm{c}T\right)=\tan\left(\pi\frac{f'_\mathrm{c}}{f_\mathrm{s}}\right)=c\) \(\quad\bbox[#eef2f8,6px,border:1.5px solid #215293]{\displaystyle a=\frac{c-1}{c+1}}\)
\(V_0<1\) (cut): \(\displaystyle A_2(z)=A(z)=\frac{az+1}{z+a}= A_{2\mathrm{dn}}\left(\frac{z+\alpha}{\alpha z+1}\right)\)
with \(\displaystyle A_{2\mathrm{dn}}(\zeta)=
\frac{b\zeta +1}{\zeta+b}\;,\qquad b=\frac{1-V_0}{1+V_0}\)
\(\displaystyle a=\frac{\alpha+b}{1+\alpha b}=
\frac
{\dfrac{c-1}{c+1}+\dfrac{1-V_0}{1+V_0}}
{1+\dfrac{c-1}{c+1}\cdot\dfrac{1-V_0}{1+V_0}} =
\ldots=\frac{c-V_0}{c+V_0}\) \(\quad\bbox[#eef2f8,6px,border:1.5px solid #215293]{\displaystyle a=\frac{c-V_0}{c+V_0}}\)
Structure:
Parameters:
| gain | in | dB | \(G\) |
| cutoff frequency | in | Hz | \(f'_\mathrm{c}\) |
| sampling frequency | in | Hz | \(f_\mathrm{s}\) |
Allpass structure
Dependent quantities
\(\displaystyle V_0=10^{G/20}\:,\qquad H_0=V_0-1\)
\[\displaystyle a=\left\{
\begin{array}{lll}\displaystyle
\dfrac{c-1}{c+1} &\displaystyle \mbox{for} &\displaystyle G>0\\[2ex]\displaystyle
\dfrac{c-V_0}{c+V_0} &\displaystyle \mbox{for} &\displaystyle G<0
\end{array}
\right.\] \[\mbox{with}\quad c=\tan\left(\pi\frac{f'_\mathrm{c}}{f_\mathrm{s}}\right)\]
Desired frequency response
Parameters
| center frequency | \(\displaystyle\omega_\mathrm{m}\) |
| bandwidth | \(\displaystyle\omega_\mathrm{b}\) |
| gain | \(V_0=H\left(j\omega_{\mathrm{m}}\right)\) |
Possible procedure (here for \(\displaystyle V_0>1\)) :
discrete prototype filter \(\displaystyle H_{1\mathrm{dn}}\left(\zeta\right)=1+\frac{H_0}{2}\left[ 1+\zeta^{-1}\right]\)
allpass transformation of degree 2 (lowpass-bandpass-transformation)
\(\displaystyle \zeta=-\frac{z^2+\beta(1-\alpha)z-\alpha}{-\alpha z^2+\beta(1-\alpha)z+1}\)
leads to a bandpass with center frequency \(\displaystyle
\Omega_\mathrm{m}=\omega_\mathrm{m}T=\pm\arccos(-\beta)\)
But: Interpretation as a two stage transformation
\(\zeta=\dfrac{\zeta_1+\alpha}{\alpha\zeta_1+1}\)(lowpass-lowpass)
\(\zeta_1=-\dfrac{z(z+\beta)}{\beta z+1}\)(transformation of degree 2)
The lowpass-lowpass-transformation has already been performed for the low frequency shelving filter
\[\Downarrow\]
peak filter = low frequency shelving filter + transformation of degree 2
low frequency shelving filter
\[\displaystyle H_\mathrm{TS}\:=\:1+\frac{H_0}{2}\left[1+A_\mathrm{TS}(\zeta_1)\right]\] \[\displaystyle A_\mathrm{TS}\:=\:\frac{a\zeta_1+1}{\zeta_1+a}\] \[\displaystyle a\:=\:\left\{\begin{array}{ll}\displaystyle \dfrac{c-1}{c+1} &\displaystyle \mbox{for}\: G>0\\[2ex]\displaystyle \dfrac{c-V_0}{c+V_0} &\displaystyle \mbox{for}\: G<0 \end{array}\right. \qquad c=\tan\left(\pi\frac{f'_\mathrm{b}}{f_\mathrm{s}}\right)\] \(f'_\mathrm{b}\) half the bandwidth of the peak filter
transformation of degree 2
\(\displaystyle \zeta_1\:=\:-\frac{z(z+\beta)}{\beta z+1}\)
\[\displaystyle H_\mathrm{P}(z)\:=\:1+\frac{H_0}{2}\left[ 1-A_\mathrm{P}(z)\right]\] \(\displaystyle
A_\mathrm{P}(z)\:=\:-A_\mathrm{TS}\left(-\frac{z(z+\beta)}{\beta z+1}
\right)\;=\;\ldots\;=\;\frac{az^2-\beta(1-a)z-1}{-z^2-\beta(1-a)z+a}\)
\[\beta\;=\;-\cos\left(\omega_\mathrm{m}T\right)\]
Structure:
Parameters:
| gain | in | dB | \(G\) |
| half bandwidth | in | Hz | \(f'_\mathrm{b}\) |
| center frequency | in | Hz | \(f'_\mathrm{m}\) |
| sampling frequency | in | Hz | \(f_\mathrm{s}\) |
dependent quantities
\[\displaystyle V_0=10^{G/20}\:,\qquad H_0=V_0-1\] \[\displaystyle a=\left\{ \begin{array}{lll}\displaystyle \dfrac{c-1}{c+1} &\displaystyle \mbox{for} &\displaystyle G>0\\[2ex]\displaystyle \dfrac{c-V_0}{c+V_0} &\displaystyle \mbox{for} &\displaystyle G<0 \end{array} \right.\] \[\displaystyle c=\tan\left(\pi\frac{f'_\mathrm{b}}{f_\mathrm{s}}\right)\:,\qquad\beta=-\cos\left(2\pi\frac{ f'_\mathrm{m}}{f_\mathrm{s}}\right)\]
analog prototype \(\displaystyle H_\mathrm{c}(s)\;=\;\dfrac{s^2+\frac{V_0}{Q}\omega_\mathrm{m}s+\omega^2_\mathrm{m}}{s^2+\frac{1} {Q}\omega_\mathrm{m}s+\omega^2_\mathrm{m}}\)
Properties: \[\begin{array}{rcl}\displaystyle H_\mathrm{c}(j\omega_\mathrm{m}) &\displaystyle = &\displaystyle V_0\\\displaystyle H_\mathrm{c}(j\omega_\mathrm{m}Q) &\displaystyle = &\displaystyle \frac{(1-Q^2)+jV_0}{(1-Q^2)+j}\\\displaystyle H_\mathrm{c}\left(j\frac{\omega_\mathrm{m}}{Q}\right) &\displaystyle = &\displaystyle \frac{\left(Q^2-1\right)+jV_0}{\left(Q^2-1\right)+j} \\\displaystyle \left|H_\mathrm{c}\left(j\omega_\mathrm{m}Q\right)\right|^2 &\displaystyle =&\displaystyle \left|\displaystyle H_\mathrm{c}\left(j\frac{\omega_\mathrm{m}}{Q}\right)\right|^2 = \dfrac{(Q^2-1)^2+V_0^2}{(Q^2-1)^2+1} \end{array}\]

The parameter \(Q\) is related to the filter quality.
Normalization
\[\displaystyle s=\omega_\mathrm{m}T/2\cdot\sigma\]
\[\begin{array}{rcl}\displaystyle H_\mathrm{c}(s) &\displaystyle = &\displaystyle \frac{\left(s/{\omega_\mathrm{m}}\right)^2+\frac{V_0}{Q}\left(s/{\omega_\mathrm{m}}\right)+1}{ \left(s/{\omega_\mathrm{m}}\right)^2+\frac{1}{Q}\left(s/{\omega_\mathrm{m}}\right)+1}\\\displaystyle H_\mathrm{cn}(\sigma) &\displaystyle = &\displaystyle \frac{\left(\sigma T/2\right)^2+\frac{V_0}{Q}\left(\sigma T/2\right)+1}{\left(\sigma T/2\right)^2+\frac{1}{Q}\left(\sigma T/2\right)+1} \end{array}\]
bilinear
transformation
\[\displaystyle\sigma T/2 =\frac{\zeta-1}{\zeta+1}\]
\[\begin{array}{rcl}\displaystyle H_\mathrm{dn}\left(\zeta\right) &\displaystyle = &\displaystyle \frac{\left(\frac{\zeta-1}{\zeta+1}\right)^2+\frac{V_0}{Q}\left(\frac{\zeta-1}{\zeta+1}\right)+1 }{\left(\frac{\zeta-1}{\zeta+1}\right)^2+\frac{1}{Q}\left(\frac{\zeta-1}{\zeta+1}\right)+1} =\\\displaystyle &\displaystyle = &\displaystyle \frac{(\zeta-1)^2+\frac{V_0}{Q}(\zeta^2-1)+(\zeta+1)^2}{(\zeta-1)^2+\frac{1}{Q} (\zeta^2-1)+(\zeta+1)^2} =\\\displaystyle &\displaystyle = &\displaystyle \frac{\zeta^2\left(2+\frac{V_0}{Q}\right)+\left(2-\frac{V_0}{Q}\right)}{\zeta^2\left(2+\frac{1}{ Q}\right)+\left(2-\frac{1}{Q}\right)}\\\displaystyle &\displaystyle &\displaystyle \mbox{discrete prototype} \end{array}\]
Peak filter with variable bandwidth \[\begin{array}{rcl}\displaystyle H_\mathrm{d}(z) &\displaystyle = &\displaystyle H_\mathrm{dn}\left(\frac{z+\alpha}{\alpha z+1}\right)\\\displaystyle &\displaystyle = &\displaystyle \frac{\left[2Q(1+\alpha^2)+V_0(1-\alpha^2)\right]z^2+\left[8Q\alpha\right]z+\left[ 2Q(1+\alpha^2)-V_0(1-\alpha^2)\right]}{\left[2Q(1+\alpha^2)+(1-\alpha^2)\right]z^2+\left[ 8Q\alpha\right]z+\left[2Q(1+\alpha^2)-(1-\alpha^2)\right]} \end{array}\]
with \(\displaystyle \alpha=\frac{c-1}{c+1}\;,\qquad c=\tan\left(\pi\frac{f'_\mathrm{m}}{f_\mathrm{s}}\right)\) (for \(G<0\): the inverse of this filter with \(V_0 = 10^{-G/20}\))
\(\Rightarrow\) discrete transfer function depending on the sign of the gain \(G\):
\[\displaystyle H_\mathrm{d}(z)\:=\:\frac{a_0z^2+a_1z+a_2}{z^2+b_1z+b_2}\]
Coefficients of \(H_\mathrm{d}(z)\): (\(V_0 = 10^{G/20}\) for \(G>0\), \(V_0 = 10^{-G/20}\) for \(G<0\))
| \(G>0\): | ||||
|---|---|---|---|---|
| \(a_0\) | \(a_1\) | \(a_2\) | \(b_1\) | \(b_2\) |
| \(\dfrac{1+\frac{V_0}{Q}c+c^2}{1+\frac{1}{Q}c+c^2}\) | \(\dfrac{2(c^2-1)}{1+\frac{1}{Q}c+c^2}\) | \(\dfrac{1-\frac{V_0}{Q}c+c^2}{1+\frac{1}{Q}c+c^2}\) | \(\dfrac{2(c^2-1)}{1+\frac{1}{Q}c+c^2}\) | \(\dfrac{1-\frac{1}{Q}c+c^2}{1+\frac{1}{Q}c+c^2}\) |
| \(G<0\): | ||||
| \(a_0\) | \(a_1\) | \(a_2\) | \(b_1\) | \(b_2\) |
| \(\dfrac{1+\frac{1}{Q}c+c^2}{1+\frac{V_0}{Q}c+c^2}\) | \(\dfrac{2(c^2-1)}{1+\frac{V_0}{Q}c+c^2}\) | \(\dfrac{1-\frac{1}{Q}c+c^2}{1+\frac{V_0}{Q}c+c^2}\) | \(\dfrac{2(c^2-1)}{1+\frac{V_0}{Q}c+c^2}\) | \(\dfrac{1-\frac{V_0}{Q}c+c^2}{1+\frac{V_0}{Q}c+c^2}\) |
Other coefficient forms of shelving and peak filters: R. Bristow-Johnson, Audio EQ Cookbook (W3C Note).
Varying gains \(G\):

| gain | \(G\) | = | -15, -10, -5, 0, 5, 10, 15 dB |
| half bandwidth | \(f'_\mathrm{b}\) | = | 500 Hz |
| \(Q\) | = | 1.1 | |
| center frequency | \(f_\mathrm{m}\) | = | 500 Hz |
| sampling frequency | \(f_\mathrm{s}\) | = | 44100 Hz |
Varying bandwidths \(f'_\mathrm{b}\) or qualities \(Q\):

| gain | \(G\) | = | -15, 0, 15 dB |
| half bandwidth | \(f'_\mathrm{b}\) | = | 10, 100, 1000, 10000 Hz |
| \(Q\) | = | 0.1, 1, 10, 100 | |
| center frequency | \(f_\mathrm{m}\) | = | 500 Hz |
| sampling frequency | \(f_\mathrm{s}\) | = | 44100 Hz |
Varying center frequencies \(f_\mathrm{m}\):

| gain | \(G\) | = | -15, 0, 15 dB |
| half bandwidth | \(f'_\mathrm{b}\) | = | 50 Hz |
| \(Q\) | = | 5 | |
| center frequency | \(f_\mathrm{m}\) | = | 5, 50, 500, 5000 Hz |
| sampling frequency | \(f_\mathrm{s}\) | = | 44100 Hz |
the frequency response is determined by only a few parameters
gain
cutoff frequency
center-frequency
bandwidth/quality
control
manual
automatic
periodic (low frequency oscillator, LFO)
random (noise generator)
signal dependent
Bandpass BP :
small bandwidth
variable center frequency
Typical application as guitar effect
control of the center frequency
by a foot pedal
Wah-Wah filter

Cry Baby wah-wah · Massimo Barbieri, CC BY-SA 3.0
N: notch filter
low bandwidth bandstop filter
AP: allpass
strong phase differences between the direct path and the filter path lead to attenuation and amplification (interferences)
variable interference
patterns: phaser effect
| dry: the guitar DI of the course | |
| wah-wah: \(y = (1-g)\,x + g\,\mathrm{BP}(x)\), \(g = 0.8\), \(Q = 6\), center 400 Hz … 2.2 kHz, LFO 1.5 Hz | |
| phaser with allpasses: 6 first-order allpasses, break frequency 200 Hz … 2 kHz, LFO 0.5 Hz, \(d = e = 0.5\) | |
| phaser with notch filters: 3 notches at \(f_\mathrm{c}\), \(2f_\mathrm{c}\), \(4f_\mathrm{c}\), \(Q = 2\), same sweep, \(d = 0\), \(e = 1\) |
Listen
Both effects move a filter over time. Which one emphasizes a moving band, which one cuts moving notches?
Boost and cut
A low shelf with \(G = +12\) dB and one with \(G = -12\) dB share the structure \(1 + \frac{H_0}{2}[1 + A(z)]\). Why does the cut filter need a different allpass coefficient \(a\) than the boost? And how can a phaser, built from allpasses only, produce notches?
Try it: notebook (a four-band parametric EQ, boost vs. cut, match a hidden EQ curve), runs in the browser.
Shelving filter
\(H = 1 + \frac{H_0}{2}[1 + A(z)]\): the gain enters through \(H_0 = V_0 - 1\), the cutoff through the allpass coefficient \(a\) (for the cut, \(a\) also depends on \(V_0\)).
Peak filter
Fixed bandwidth: low shelving prototype plus a lowpass-bandpass transformation (center \(\beta\), bandwidth \(a\), gain \(H_0\)). Variable bandwidth: second-order analog prototype with \(Q\), bilinear and lowpass-lowpass transformation.
Parameters in motion
Moving \(f_\mathrm{c}\) or \(f_\mathrm{m}\) over time gives effects: the wah-wah sweeps a narrow bandpass, the phaser sweeps the notches of an allpass chain.
Next lecture: the simplest filter of all, a delay line, and what feedback and modulation make of it.
Slides 1:1 from the LMS/FAU lecture notes (R. Rabenstein, M. Schäfer); figures redrawn in TikZ (slides/filters_tikz/), plots re-plotted from the original Matlab scripts, added examples by the slides/make_filters_*.py scripts in the course repository.