Lecture 2 · Filter tasks in audio, impulse invariance, the bilinear transformation, prewarping
| 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 1 of 5. Today: why audio filters are designed from analog prototypes, and how to carry them over to discrete time.
| dry: the guitar DI of the course | |
| bass boost, +12 dB low shelf, corner 250 Hz | |
| tone knob down, low-pass at 600 Hz | |
| through a diode clipper |
Listen first
Two of the three treatments are linear filters: a mixing desk does them with one knob each. Which one is not, and what would you need to know to build it?
| Communications | Audio Engineering |
| Task | |
| suppression of unwanted signal components (selective filter) | amplification or reduction of certain frequency bands |
| Prototypes | |
| rectangular lowpass, highpass, bandpass, bandstop adaptive filters |
high and lowpasses of degree 1 and 2, high and low frequency shelving filters, peak filters |
| Typical requirements | |
| passband deviation \(<\) 1dB stopband attenuation \(>\) 60dB |
boost or cut from 0dB to 20dB gain and cutoff frequency highly variable during operation |
Communications:
Tolerance schemes after H. W. Schüßler, Digitale Signalverarbeitung 2, Springer-Verlag, 2010 (redrawn).
tolerance schemes for selective filters:
| lp, hp | lowpass, highpass |
| bp, bs | bandpass, bandstop |
| \(\Omega_\mathrm{D}\), \(\Omega_\mathrm{S}\) | passband and stopband cutoff frequencies |
| \(\delta_\mathrm{D}\), \(\delta_\mathrm{S}\) | tolerances |
Audio Engineering:

shelving and peak filters
(german: Kuhschwanz-Entzerrer, Glocken-Filter)
cutoff and center frequencies
variable during operation

Mixing console · Rodrigo César, public domain, Wikimedia Commons
Problem: simple calculation of the coefficients required
simple manual input of gain, cutoff frequencies, etc.
e.g. through faders at a mixing console,
simple and fast calculation of the filter coefficients
the stability of the filter has to be guaranteed for all possible input values
possible solutions:
non-recursive filters
advantage: always stable, disadvantage: many coefficients to calculate
recursive filters in direct form \[H(z) = c\cdot \frac{z^2 + \beta_1 z+ \beta_0}{z^2 + \alpha_1 z+ \alpha_0}\] advantage: few coefficients,
disadvantage: no straightforward calculation of the filter coefficients
recursive filters by transformation from analog reference filters
advantage: few coefficients,
one-to-one assignment between variable parameters and filter coefficients,
guaranteed stability possible
Investigate a candidate transfer function for a low frequency shelving filter \[\begin{aligned} H(s) &= \frac{s + V_0\, \omega_\mathrm{c}}{s + \omega_\mathrm{c}} & V_0 &>1 & \omega_\mathrm{c} & > 0 \end{aligned}\]
Basic behaviour of the frequency response \(H(j\omega)\): \[\begin{aligned} H(0) &= V_0 \quad \text{DC gain}, \\ \lim\limits_{\omega\rightarrow\infty}H(j\omega) &=1 \quad \text{high frequency gain} \end{aligned}\] For more details, see the Bode diagram.
Bode diagram for \(\omega>0\) \[\begin{aligned} \log|H(j\omega)| &= \log \left| \frac{j\omega + V_0\, \omega_\mathrm{c}}{j\omega + \omega_\mathrm{c}} \right| = \log \left| j\omega + V_0\, \omega_\mathrm{c}\right| - \log \left| j\omega + \omega_\mathrm{c}\right| \\ \log|H(j\omega)| &\approx \begin{cases} \log V_0 & \omega < \omega_\mathrm{c} < V_0\, \omega_\mathrm{c} \\ \log V_0 + \log \omega_\mathrm{c} - \log \omega & \omega_\mathrm{c} < \omega < V_0\, \omega_\mathrm{c} \\ \log 1 = 0 & \omega_\mathrm{c} < V_0\, \omega_\mathrm{c} < \omega \end{cases} \end{aligned}\]
Note that the axes are spaced logarithmically.
Decompose the shelving filter into a low pass filter and a constant: \[\begin{aligned} H(s) & = \frac{s + V_0\, \omega_\mathrm{c}}{s + \omega_\mathrm{c}} = \frac{s + \omega_\mathrm{c}}{s + \omega_\mathrm{c}} + \frac{(V_0-1) \omega_\mathrm{c}}{s + \omega_\mathrm{c}} = 1 + H_0 \frac{\omega_\mathrm{c}}{s + \omega_\mathrm{c}} & H_0 &= V_0-1 \end{aligned}\] \[\begin{aligned} H(s) &= 1 + H_0 H_\mathrm{LP}(s) & H_\mathrm{LP}(s) &= \frac{\omega_\mathrm{c}}{s + \omega_\mathrm{c}} \end{aligned}\] Basic behaviour of the lowpass frequency response \(H_\mathrm{LP}(j\omega)\): \[\begin{aligned} H_\mathrm{LP}(0) &= 1 \quad \text{DC gain} \\ \lim\limits_{\omega\rightarrow\infty}H_\mathrm{LP}(j\omega) &=0 \quad \text{high frequency gain} \end{aligned}\]
| \(H_\mathrm{LP}(s)\) | first order lowpass filter with unit passband gain and cutoff frequency \(\omega_\mathrm{c}\) |
Note
\(H_\mathrm{LP}(s)\) is used as a running example in the following.
transform the
transfer function of a continuous-time system into the
transfer function of a corresponding discrete-time system
with similar properties. \[H_\mathrm{c}(s) \quad \longrightarrow \quad H_\mathrm{d}(z)\]
Different approaches with different properties:
impulse-invariant transformation,
bilinear transformation,
…and others.
\[\begin{aligned} &\textbf{Impulse-Invariant Transformation}& H_\mathrm{d}(z) = \text{𝒵} \left\{ T \left.\left[ \text{ℒ}^{-1}\left\{ H_\mathrm{c}(s) \right\} \right]\right|_{t=kT} \right\} \end{aligned}\]
Example
\[\begin{aligned} H_\mathrm{c}(s) &= \sum\limits_{\mu=1}^n A_\mu \dfrac{1}{s-s_\mu} &&\longrightarrow& H_\mathrm{d}(z) &= T\sum\limits_{\mu=1}^n A_\mu \dfrac{z}{z-z_\mu} & z_\mu &=e^{s_\mu T} \end{aligned}\]
Disadvantage
Sampling of the impulse response causes aliasing in the frequency domain
For low-pass systems only!

Take away
| Mapping from | to |
|---|---|
| \(s\)-plane | \(z\)-plane |
| imaginary axis \(j\omega\) | unit circle \(e^{j\Omega}\) |
| frequency axis continuous signals |
frequency axis discrete signals |
| frequency responses of analog filters |
frequency responses of digital filters |
| structures of analog filters | structures of digital filters |
| \(s = \displaystyle \frac{2}{T} \frac{z - 1}{z+1}\) | \(z = \displaystyle \frac{1 + sT/2}{1-sT/2}\) |
Given: continuous system \(H_\mathrm{c}(s)\)
Wanted: discrete system \(H_\mathrm{d} (z)\)
Representation of a continuous system by a realizing structure, e.g.
\[H_\mathrm{c} (s) = \displaystyle \frac{b_1 s + b_0}{s + c_0} = \displaystyle\frac{Y_\mathrm{c}(s)}{V_\mathrm{c}(s)}\]
Integrator:
\(\quad X(s) = \displaystyle \frac{1}{s}\; W(s)\), \(\quad x(t) = \displaystyle \int \limits^{t}_{0} w (\tau)\, d \tau\)
Derive a discrete system \(G(z)\) such that \(\quad\dfrac{1}{s} \approx G (z)\).
Two different derivations:
1 Numerical integration of \(x(t)=\displaystyle \int \limits^{t}_{0} w (\tau) d\tau\) at \(t\!=\!kT\)
with the trapezoidal rule
\(\Rightarrow\) \[\begin{array}{rcl}\displaystyle \rlap{x\big((k + 1) T \big) = }\\[1ex]\displaystyle &\displaystyle = &\displaystyle \displaystyle \int \limits^{(k+1)T}_{0} w (\tau)\, d \tau = \underbrace{ \displaystyle \int \limits^{kT}_{0} w (\tau)\, d \tau}_{\displaystyle x(kT)} + \displaystyle \int \limits^{(k + 1) T}_{kT} w (\tau)\, d \tau \\\displaystyle &\displaystyle = &\displaystyle \displaystyle x(kT) + \frac{T}{2} \big[ w\big( ( k + 1) T \big) + w(kT)\big]\end{array}\]
\(z\)-transformation
\[\displaystyle zX(z) = X(z) + \frac{T}{2} \bigg[zW(z) + W (z)\bigg]\]
\(\displaystyle \frac{X (z)}{W(z)} =\) \(\bbox[#eef2f8,6px,border:1.5px solid #215293]{\displaystyle \frac{T}{2} \displaystyle \frac{z + 1}{z-1} = G(z)}\)
\[\begin{array}{lll}\displaystyle v_\mathrm{c} (t) &\displaystyle = &\displaystyle \displaystyle \sum \limits^{\infty}_{k = 0} v_\mathrm{d} [k]\, \delta (t - kT)\\\displaystyle V_\mathrm{c} (s) &\displaystyle = &\displaystyle \text{ℒ} \left\{ v_\mathrm{c} (t) \right\} = \displaystyle \sum \limits^{\infty}_{k = 0} v_\mathrm{d} [k] e^{-skT}\\\displaystyle V_\mathrm{d} (z) &\displaystyle = &\displaystyle \text{𝒵} \left\{ v_\mathrm{d} [k] \right\} = \displaystyle \sum \limits^{\infty}_{k = 0} v_\mathrm{d} [k] z^{-k} \end{array}\]
\[\Rightarrow\]
\(z = e^{sT}\)
\(s = \displaystyle \frac{1}{T} \ln z\)
cannot be realized by a difference equation
instead approximation by series expansion:
\[s = \dfrac{1}{T} \ln z = \dfrac{2}{T} \left[ \dfrac{z-1}{z + 1} + \dfrac{1}{3} \left( \dfrac{z-1}{z + 1} \right)^3 + \cdots \right] \approx \dfrac{2}{T} \dfrac{z-1}{z + 1}\] \[\bbox[#eef2f8,6px,border:1.5px solid #215293]{ \dfrac{1}{s} \approx \dfrac{T}{2} \dfrac{z + 1}{z - 1} = G (z) }\]
from the transfer function \(H_\mathrm{c}(s)\) (continuous) to \(H_\mathrm{d}(z)\) (discrete):
\[H_\mathrm{d} (z) = H_\mathrm{c} \left( \dfrac{1}{G(z)} \right) = H_\mathrm{c} \left( \dfrac{2}{T} \dfrac{z-1}{z + 1} \right)\]
Example
\(\begin{array}{lll}\displaystyle
H_\mathrm{c} (s)
&\displaystyle = &\displaystyle
\displaystyle \frac{\omega_\mathrm{c}}{s + \omega_\mathrm{c}}
= \displaystyle \frac{-s_\infty}{s - s_\infty},
\quad s_\infty = - \omega_\mathrm{c}
\qquad
|H_\mathrm{c} (0)| = 1, \quad
|H_\mathrm{c} (\infty)| \rightarrow 0
\\[3ex]\displaystyle
H_\mathrm{d} (z) &\displaystyle = &\displaystyle \displaystyle \frac{\omega_\mathrm{c}}{\displaystyle\frac{1}{G(z)} +
\omega_\mathrm{c}}=
\displaystyle \frac{\omega_\mathrm{c}}{ \displaystyle\frac{2}{T} \frac{z-1}{z + 1}+
\omega_\mathrm{c}}=
\displaystyle
\frac{\omega_\mathrm{c} T/2\; (z + 1)}
{(z-1) + \omega_\mathrm{c} T/2\; (z + 1)} =
\\[5ex]\displaystyle
&\displaystyle = &\displaystyle \displaystyle
\frac{\omega_\mathrm{c}T/2\; (z + 1)}
{(1+ \omega_\mathrm{c}T/2 )z - (1 - \omega_\mathrm{c} T/2)} = \displaystyle
\frac{\omega_\mathrm{c}T/2}{1 + \omega_\mathrm{c} T/2} \cdot
\displaystyle \frac{z + 1}{z - z_\infty} =
\\[3ex]\displaystyle
&\displaystyle =&\displaystyle \displaystyle\frac{1 - z_\infty }{2} \cdot
\displaystyle \frac{z + 1}{z - z_\infty}
\qquad
\mbox{ with } z_\infty =
\displaystyle
\frac{1 - \omega_\mathrm{c}T/2 }{1 + \omega_\mathrm{c}T/2 }
=
\displaystyle
\frac{1 + s_\infty T/2 }{1 - s_\infty T/2 }
\end{array}\)
\[H_\mathrm{d}(1) = H_\mathrm{c}(0) = 1,\qquad
H_\mathrm{d}(-1) =H_\mathrm{c}(\infty) = 0\]
Properties of the mapping \(z = \displaystyle \frac{1 + s T/2}{1 - s T/2}\) with \(s = \sigma + j \omega\):
\[z = \rho e^{j \Omega} = \displaystyle \frac{1 + (\sigma + j \omega)T/2}{1 - (\sigma + j \omega) T/2}\]
\[|z| = \rho = \sqrt{ \displaystyle \frac{(1 + \sigma T/2)^2 + (\omega T/2)^2}{(1 - \sigma T/2)^2 + (\omega T/2)^2}}\]
\[\begin{array}{lllllll}\displaystyle \sigma &\displaystyle > &\displaystyle 0 \quad &\displaystyle \rightarrow &\displaystyle \quad \rho &\displaystyle > &\displaystyle 1\\\displaystyle \sigma &\displaystyle = &\displaystyle 0 \quad &\displaystyle \rightarrow &\displaystyle \quad \rho &\displaystyle = &\displaystyle 1\\\displaystyle \sigma &\displaystyle < &\displaystyle 0 \quad &\displaystyle \rightarrow &\displaystyle \quad \rho &\displaystyle < &\displaystyle 1 \end{array}\]
1. Stability
Poles in the left \(s\)-half-plane are mapped to
the interior of the unit circle of the \(z\)-plane.
continuous system stable \(\rightarrow\) discrete system stable

Vertical lines (constant damping) become circles through \(z = -1\); the imaginary axis becomes the unit circle. ✕: a pole at \(sT/2 = -0.4\) lands at \(z = 0.43\).
2. Frequency Warping \[\begin{array}{rcl}\displaystyle &\displaystyle &\displaystyle s = \displaystyle \frac{2}{T} \displaystyle \frac{z - 1}{z + 1} \qquad \mbox{ for } s = j \omega, z = e^{j \Omega} \\\displaystyle &\displaystyle &\displaystyle j \omega = \displaystyle \frac{\displaystyle 2}{\displaystyle T} \displaystyle \frac{ e^{j \Omega} - 1}{e^{j \Omega} + 1} = \displaystyle \frac{2}{T} \displaystyle \frac{e^{j \Omega/2} - e^{-j \Omega/2}}{e^{j \Omega/2} + e^{-j \Omega/2}} = \displaystyle \frac{2}{T} \displaystyle \frac{2 j \sin \Omega/2}{2 \cos \Omega/2} \\\displaystyle &\displaystyle &\displaystyle \omega = \displaystyle \frac{2}{T} \tan \displaystyle \frac{\Omega}{2} \qquad \Omega = 2\, {\rm arctan}\, \omega T/2 \end{array}\]
geometric illustration:
\[\begin{array}{lllllll}\displaystyle \omega &\displaystyle = &\displaystyle 0 &\displaystyle \rightarrow &\displaystyle \Omega &\displaystyle = &\displaystyle 0\\[1ex]\displaystyle \omega &\displaystyle = &\displaystyle \displaystyle \frac{2}{T} &\displaystyle \rightarrow &\displaystyle \Omega &\displaystyle = &\displaystyle \displaystyle\frac{\pi}{2}\\[2ex]\displaystyle \omega &\displaystyle = &\displaystyle \pm \infty &\displaystyle \rightarrow &\displaystyle \Omega &\displaystyle = &\displaystyle \pm \pi\\[1ex]\displaystyle |\omega| &\displaystyle \ll &\displaystyle \displaystyle \frac{1}{T} &\displaystyle \rightarrow &\displaystyle \Omega &\displaystyle \approx &\displaystyle \omega T\\\displaystyle \end{array}\]
continuous system \(\quad\omega = 2 \pi f\)
discrete system
\[\Omega = \omega'T = 2 \pi T f' = 2 \,{\rm arctan}\, \omega T/2\]
\[\begin{array}{lll}\displaystyle f' &\displaystyle = &\displaystyle \displaystyle \frac{1}{\pi}\, f_\mathrm{s} \cdot {\rm arctan} \left( \pi \displaystyle \frac{f}{f_\mathrm{s}} \right)\\\displaystyle &\displaystyle &\displaystyle \\\displaystyle f &\displaystyle = &\displaystyle \displaystyle \frac{1}{\pi}\, f_\mathrm{s} \cdot {\rm tan} \left( \pi \displaystyle \frac{f'}{f_\mathrm{s}} \right) \end{array}\]
for \(f \ll f_\mathrm{s}\): \(f'\approx f\) approximately linear
Local equalization of frequency warping by prewarping
Specify the desired cutoff frequency of the discrete system \(\rightarrow f_0'\)
Mapping onto the frequency axis of the continuous systems (prewarping) \(\rightarrow \bar{f}_0\)
Design of a continuous system with the cutoff frequency \(\bar{f}_0
\rightarrow \bar{H}_\mathrm{c} (s)\)
Obtain the discrete system by bilinear transformation \(\rightarrow H_\mathrm{d} (z) = \bar{H}_\mathrm{c} \left( \displaystyle \frac{2}{T}\displaystyle \frac{z-1}{z + 1} \right)\)


1. Wanted: digital cutoff \(f'_\mathrm{c}\) = 10 kHz at \(f_\mathrm{s}\) = 44.1 kHz
Directly applied: analog design at 10 kHz lands at \(f'\) = 8.69 kHz (orange, both plots): the warping pulls it down
2. Prewarping: \(\bar f_\mathrm{c} = \frac{f_\mathrm{s}}{\pi}\tan\frac{\pi f'_\mathrm{c}}{f_\mathrm{s}}\) = 12.12 kHz (arrow in the top plot)
3. Analog design of the prototype at \(\bar f_\mathrm{c}\) (dotted, bottom plot)
4. Bilinear transformation: the digital low-pass (blue) passes −3 dB exactly at 10 kHz
Example: Lowpass
\(\displaystyle H_\mathrm{c}(s)=\frac{\omega_\mathrm{c}}{s+\omega_\mathrm{c}}\:,\qquad H_\mathrm{d}(z)=\frac{1-z_\infty}{2}\cdot\frac{z+1}{z-z_\infty}\), prewarping for \(\omega_\mathrm{c}\):
\[\omega_\mathrm{c}=2\pi f_\mathrm{c}=2\pi\,\dfrac{1}{\pi}\,f_\mathrm{s}\tan\left(\pi\,\dfrac{f'_\mathrm{c}}{f_\mathrm{s}} \right)\qquad\Rightarrow\qquad \dfrac{\omega_\mathrm{c}T}{2}= \tan\left(\pi\dfrac{f'_\mathrm{c}}{f_\mathrm{s}}\right)=c\]
Design procedure
Desired cutoff frequency of the discrete system \(f'_\mathrm{c}\) \[\begin{aligned} c &= \tan\left(\pi\,\frac{f'_\mathrm{c}}{f_\mathrm{s}}\right) \\ z_\infty &= \frac{1-c}{1+c} \\ H_\mathrm{d}(z) &= \frac{1-z_\infty}{2}\cdot\frac{z+1}{z-z_\infty} \end{aligned}\]
The coefficients follow from the knob in closed form: one \(\tan\) per update.
Digital low shelf, two knobs
Gain \(G\) in dB and cutoff \(f'_\mathrm{c}\) in Hz: \[V_0 = 10^{G/20}, \qquad H_0 = V_0 - 1\] \[H_\mathrm{d}(z) = 1 + H_0\,\frac{1 - z_\infty}{2}\cdot\frac{z+1}{z - z_\infty}\]

Learn German with signals and systems:
| Frequenz | frequency |
| Frequenzgang | frequency response |
| Grenzfrequenz | cutoff frequency |
| Abtastfrequenz | sampling frequency |
| Tiefpass | lowpass |
| Betrag | magnitude |
| kontinuierlich | continuous |
| Vorverzerrung | prewarping |

Sound examples: a sawtooth through a resonant low-pass (second order, \(Q\) = 6) at \(f_\mathrm{s}\) = 16 kHz. The cutoff is swept 200 Hz → 7 kHz → 200 Hz; every 2 ms the coefficients are recomputed from the analog prototype with the bilinear transformation. The plots above show where the resonance ends up.
| prewarped | |
| not prewarped |
Take away
Without prewarping the analog 7 kHz lands at \(f' = \frac{f_\mathrm{s}}{\pi}\arctan\frac{\pi\cdot 7\,\mathrm{kHz}}{f_\mathrm{s}}\) = 4.8 kHz: the sweep stalls and stays dull at the top. Prewarping, \(f_\mathrm{c} = \frac{f_\mathrm{s}}{\pi}\tan\frac{\pi f'_\mathrm{c}}{f_\mathrm{s}}\), costs one \(\tan\) per update and puts the resonance where the knob says. Time-varying filters (lecture 4) prewarp at every coefficient update.
Prewarp a lowpass
A first-order lowpass should have its cutoff at \(f'_\mathrm{c} = 10\) kHz, at \(f_\mathrm{s} = 48\) kHz. At which cutoff \(f_\mathrm{c}\) do you design the analog prototype? Where would the digital cutoff land without prewarping?
Try it: notebook (warp, prewarp and compare impulse invariance with the bilinear transformation), runs in the browser.
Design analog, then transform
Audio filters need coefficients that are simple to compute from gain and cutoff, and stable for every knob setting: design a continuous prototype, then transform it.
Impulse invariance
Samples the impulse response: the frequency response aliases. Usable for lowpass systems only.
Bilinear transformation
\(s = \frac{2}{T}\frac{z-1}{z+1}\) (trapezoidal rule): stable stays stable, the \(j\omega\) axis becomes the unit circle, the frequency axis is warped. Prewarping makes one frequency exact.
Next lecture: one more mapping, now from the unit circle onto itself. Allpass transformations move a cutoff with a single coefficient.
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.