Chebyshev Filters: From Theory to Musical Applications
Table Of Contents
Introduction
This article introduces an adaptation of the Chebyshev filter for musical applications. The approach focuses on defining a user-friendly resonance parameter, normalizing both the cutoff frequency and output gain, and applying filter transformations to conform to standard filter types: low-pass, high-pass, band-pass, and notch.
Chebyshev Polynomials
To design the Chebyshev filter, we use the Chebyshev polynomial \(T_n\) of order \(n\). Various definitions for \(T_n\) can be found here. For efficient implementations, one might opt for a recursive approach or precompute the polynomials.
For now, we concentrate on the essential requirements, using the following definition for \(T_n\) and its inverse \(T_n^{-1}\):
$$ T_n(x) = \begin{cases} \cos(n \arccos x) & \text{if } |x| \le 1, \newline \cosh(n \operatorname{arcosh} x) & \text{if } x \ge 1 \end{cases} $$
$$ T_n^{-1}(x) = \begin{cases} \cos\left(\frac{\arccos(x)}{n}\right) & \text{if } |x| \le 1, \newline \cosh\left(\frac{\operatorname{arcosh}(x)}{n}\right) & \text{if } x \ge 1 \end{cases} $$
A plot below illustrates the behavior of these functions.
|
|
Magnitude and Gain Normalization
The gain of the Chebyshev filter is traditionally expressed as:
$$G_{\text{down}}(x) = \sqrt{\frac{1}{1 + \epsilon^2 T(x)^2}}$$
However, to ensure that the filter’s oscillations remain positive and the gain at DC (zero frequency) equals 1, we adjust the formula to:
$$\boxed{G_{\text{up}}(x) = \sqrt{\frac{1 + \epsilon^2}{1 + \epsilon^2 T(x)^2}}}$$
|
|
Here’s an improved version of the text:
Definition of a Quality Factor (Q)
To control the filter’s resonance using a traditional Q factor, we use:
$$\boxed{\varepsilon = \frac{2Q^{2} - 1}{\sqrt{4Q^{2} - 1}}}$$
This equation ensures that the peak magnitude remains consistent regardless of the filter order and matches that of a standard second-order filter. Therefore, for a second-order Chebyshev filter, the Q control will behave the same as in a typical second-order filter.
|
|
Normalization of the Cutoff Frequency
Several strategies can be employed to normalize the cutoff frequency of the filter.
The first and most intuitive approach is to normalize the frequency so that the asymptotic gain as \(\omega \to +\infty\) matches that of a Butterworth filter. This ensures that the modulation of the Q-factor only alters the shape of the magnitude around \(\omega_c.\) For our filter, this normalization involve taking as its cut frequency:
$$\omega_{\text{norm1}} = \left(\frac{\varepsilon^{2}4^{n-1}}{1 + \varepsilon^{2}}\right)^{-\frac{1}{2n}}$$
However, in practice, this normalization can result in significant jumps in the frequency response when modulating the Q factor.
A second approach normalizes the frequency so that the filter’s gain at (\omega = 1) matches that of a second-order filter. Since the Q factor corresponds to the linear gain at (\omega = 1), it is sensible to maintain this property as a constraint. For this reason, and because this method does not produce the significant jumps seen with the first method, we choose it for normalization. The cutoff frequency is defined as:
$$\boxed{\omega_{\text{norm2}} = T^{-1}\left(\frac{1}{2Q^{2} - 1}\right)}$$
Finally, another closely related approach normalizes the frequency so that the most resonant section of the filter has a cutoff frequency of 1. This method simplifies the calculations (hint: (\sinh/\cosh = \tanh)) and is given by the following relation, where (\tilde{p}_k) denotes the poles of the Chebyshev filter, which we will define later:
$$ \omega_{\text{norm3}} = |\tilde{p}_{0}| $$
Calculation of Poles and Zeros and Normalization of the Cutoff Frequency
The poles and zeros of a Chebyshev filter are given by the following equations^1:
$$ \tilde{p}_{k} = -\sinh(u)\sin(\theta _{k}) + i\cosh(u)\cos(\theta _{k}) $$
where
$$ u = \frac{1}{n}\operatorname{arcsinh}\left(\frac{1}{\varepsilon}\right), \quad \theta_{k} = \frac{\pi(2k + 1)}{2n}, \quad k = [0, \ldots, n - 1] $$
After applying frequency normalization, we can express our poles as:
$$ \boxed{ p_k = \frac{\tilde{p}_{k}}{\omega _{\text{norm2}}} } $$
|
|
Calculation of Extrema
The frequencies of the local extrema are given by the expression:
$$w_{m} = \frac{1}{w_{2}} \cos\left(\frac{m\pi}{2n}\right), \quad m = \left[1, \ldots, n\right]$$
|
|
Factorization into Second-Order Sections
In digital implementations, complex poles require the use of second-order sections (SOS) to maintain real coefficients and enhance numerical stability. Each section corresponds to a pair of conjugate poles. The overall transfer function can be expressed as the product of \(n/2\) second-order sections:
$$ \boxed{H_{LP}(s) = \prod_{k=0}^{n/2-1} \frac{1}{a_{k,0}s^{2} + a_{k,1}s + a_{k,2}}} $$
where the coefficients \(a_{k,0}\), \(a_{k,1}\), and \(a_{k,2}\) are defined as:
$$ \begin{aligned} a_{k,0} &= 1 \newline a_{k,1} &= -(p_k + \overline{p_k}) &= -2 , \operatorname{Re}(p_k) \newline a_{k,2} &= p_k \cdot \overline{p_k} &= \operatorname{Re}(p_k)^2 + \operatorname{Im}(p_k)^2 \end{aligned} $$
Highpass, Bandpass, and Notch Versions
Highpass
The highpass version is straightforward: we simply replace the numerator with \(s^2\) for each subsection:
$$ \boxed{H_{HP}(s) = \prod_{k=0}^{n/2-1} \frac{s^2}{a_{k,0}s^{2} + a_{k,1}s + a_{k,2}}} $$
Bandpass
The bandpass transformation is defined as:
$$s \leftarrow Q \left(s + \frac{1}{s}\right).$$
Applying this to \(H_{LP}\) yields:
$$ \boxed{H_{BP}(s) = \prod_{k=0}^{n/2-1} \frac{\frac{a_{k,2}}{Q^{2}}s^{2}}{s^{4} + \frac{a_{k,1}}{Q}s^{3} + \left(\frac{a_{k,2}}{Q^{2}} + 2\right)s^{2} + \frac{a_{k,1}}{Q}s + 1}}. $$
The resulting fourth-order denominator can be factored into two second-order sections using a root solver described here.
Notch
The notch transformation is given by:
$$s \leftarrow \frac{1}{Q \left(s + \frac{1}{s}\right)}.$$
Applying this to \(H_{LP}\) results in:
$$ \boxed{H_{NT}(s) = \prod_{k=0}^{n/2-1} \frac{\left(s^{2} + 1\right)^{2}}{s^{4} + \frac{a_{k,1}}{Q}s^{3} + \left(\frac{a_{k,2}}{Q^{2}} + 2\right)s^{2} + \frac{a_{k,1}}{Q}s + 1}}. $$
Similarly to the bandpass version, the fourth-order denominator can also be factored into two second-order sections using a root solver described here.
Factorization to Second-Order Sections
In the digital implementation, complex poles necessitate the use of second-order sections (SOS) to handle real coefficients and ensure improved numerical stability. Each section corresponds to a pair of conjugate poles. The complete transfer function can then be expressed as the product of \(n/2\) second-order sections as follow:
$$ \boxed{H_{LP}(s) = \prod_{k=0}^{n/2-1} \frac{1}{a_{k,0}s^{2} + a_{k,1}s + a_{k,2}}} $$
where the coefficients \(a_{k,0}\), \(a_{k,1}\), and \(a_{k,2}\) are given by:
$$ \begin{aligned} a_{k,0} &= 1 \newline a_{k,1} &= -(p_k + \overline{p_k}) &= -2 , \operatorname{Re}(p_k) \newline a_{k,2} &= p_k \cdot \overline{p_k} &= \operatorname{Re}(p_k)^2 + \operatorname{Im}(p_k)^2 \end{aligned} $$
Highpass, Bandpass and Notch version
Highpass
The Highpass version is trivial as we just need to replace the numerator by \(s^2\) for each sub section like
$$ \boxed{H_{HP}(s) = \prod_{k=0}^{n/2-1} \frac{s^2}{a_{k,0}s^{2} + a_{k,1}s + a_{k,2}}} $$
Bandpass
The Band Pass transform is given by:
$$s\leftarrow Q\left(s+\frac{1}{s}\right)$$
Applying it on \(H_{LP}\) we get:
$$ \boxed{H_{BP}(s) = \prod_{k=0}^{n/2-1} \frac{\frac{a_{k,2}}{Q^{2}}s^{2}}{s^{4}+\frac{a_{k,1}}{Q}s^{3}+\left(\frac{a_{k,2}}{Q^{2}}+2\right)s^{2}+\frac{a_{k,1}}{Q}s+1}} $$
the 4-order denominator may be factorized in two 2-order sections using the root solver from here.
Notch
The Notch transform is given by:
$$s\leftarrow\frac{1}{Q\left(s+\frac{1}{s}\right)}$$
Applying it on \(H_{LP}\) we get:
$$ \boxed{H_{NT}(s)=\prod_{k=0}^{n/2-1}\frac{\left(s^{2}+1\right)^{2}}{s^{4}+\frac{a_{k,1}}{Q}s^{3}+\left(\frac{a_{k,2}}{Q^{2}}+2\right)s^{2}+\frac{a_{k,1}}{Q}s+1}} $$
As well as for the bandpass version, the 4-order denominator may be factorized in two 2-order sections using the root solver from here.
|
|
Adding Underdamping Capability
Currently, the Chebyshev filter does not support a \(Q\) value less than or equal to \(\frac{\sqrt{2}}{2}\). To enhance our musical Chebyshev filter’s flexibility, we aim to enable underdamping, aligning its behavior with our other filters.
Strategy
Our proposed strategy is to utilize the Butterworth resonant filter formula for \(Q \leq \frac{\sqrt{2}}{2}\), and the existing Chebyshev filter formula for \(Q > \frac{\sqrt{2}}{2}\). As \(Q\) approaches \(\frac{\sqrt{2}}{2}\), the Chebyshev filter behaves increasingly like a Butterworth filter. This approach ensures a smooth transition between the two filter types. Notably, we retain the property that for second-order filters, our musical Chebyshev acts as a simple second-order filter with an appropriate definition of \(Q\).
Smoothing the Transition
Although the transition between the Chebyshev and Butterworth resonant filters is continuous, a noticeable jump can occur in practice at higher orders. Thus, implementing a smooth morphing between the two filter types is advantageous.
To achieve this, we decompose the \(Q\) factor into two parameters: \(Q_{\text{res}}\) and \(Q_{\text{damp}}\), ensuring their application compensates for each other by maintaining a consistent gain at the cutoff frequency. This constraint leads to the relationship:
$$ Q = Q_{\text{res}} \cdot Q_{\text{damp}} $$
Here, \(Q_{\text{res}}\) is the \(Q\) factor used for evaluating the Chebyshev filter, and we want \(Q_{\text{res}} > \frac{\sqrt{2}}{2}\). Conversely, \(Q_{\text{damp}}\) represents the additional resonance applied to the most resonant section, similar to the approach used for Butterworth resonant filters, described here. We desire \(Q_{\text{damp}} < \frac{\sqrt{2}}{2}\).
The following functions \(f_1\) and \(f_2\) are suitable candidates for this transition, selected for their mathematical simplicity and symmetric behavior in log-log scaling, as the end user will control the \(Q\) factor through a logarithmic mapping. The empirical value of \(k\) defines the range of \(Q\) values over which the transition occurs; we set it to 8 for efficient computational performance:
$$ f_{1}(x) = \left( x^{\alpha} + 1 \right)^{\frac{1}{\alpha}} $$
$$ f_{2}(x) = \left( x^{-\alpha} + 1 \right)^{-\frac{1}{\alpha}} = \frac{x}{f_{1}(x)} $$
With the transition pivot centered on \(Q_0 = \frac{\sqrt{2}}{2}\), we obtain:
$$ \boxed{ \begin{aligned} Q_{\text{res}} &= \left( Q^{\alpha} + Q_{0}^{\alpha} \right)^{\frac{1}{\alpha}} \ Q_{\text{damp}} &= \frac{Q}{Q_{\text{res}}} \end{aligned} } $$
|
|
Implementation
The code below summarizes the calculation of the second-order sections (SOS) for the musical Chebyshev prototype, as well as the computation of its magnitude without directly using its transfer function. It includes the underdamped capability we just explained, with the smooth transition to the butterworth resonant filter that we studied [here](CITER LE BUTTERWORTH RESONANT).
|
|
|
|
Conclusion
The exploration and implementation of the Musical Chebyshev filter have highlighted its remarkable versatility in sound design, particularly in creating distinctive phaser-style effects. Integrated into UVI Shade as a Multi Resonant filter, it excels in delivering sounds, especially when modulation is applied.
While the filter’s inherent ringing can be pronounced (sometimes overly sharp for certain musical applications), there is an exciting opportunity to develop a new parameter that could mitigate this effect.
Overall, the well-studied Chebyshev filter stands out as a powerful tool for sound designers!