design_biquad (2)
Biquad filter design.
Prototype
FRat<float> design_biquad(cstring type, float f, float Q, float gain_dB=0)
Parameters
type | Filter type ("lp", "hp", "bp", "sb", ...). |
f | Normalized cut-off frequncy (or central frequency for band-pass and band-stop), between 0 and 0.5. |
Q | Quality factor (note: for \(Q>1/\sqrt(2)\sim 0{,71}\), there will be some resonnance). |
gain_dB | Gain, in dB, used only for the filter of type resonnance or plateau. |
Description
These second order RII filter are adapted from analog prototype through the bilinear transform.
The analog prototypes are the following ones (defined for a cutoff pulsation of 1 radian/s, and \(Q\) being the quality factor):
- Low-pass filter:
\[ H(s) = \frac{1}{s^2+\frac{1}{Q}s+1} \] - High-pass filter:
\[ H(s) = \frac{s^2}{s^2+\frac{1}{Q}s+1} \] - Band-pass filter:
\[ H(s) = \frac{s/Q}{s^2+\frac{1}{Q}s+1} \] - Band-stop filter:
\[ H(s) = \frac{s^2+1}{s^2+\frac{1}{Q}s+1} \]
Example: low-pass filters, with different values for the quality factor
Bibliography
- Cookbook formulae for audio equalizer biquad filter coefficients, Robert Bristow-Johnson, https://webaudio.github.io/Audio-EQ-Cookbook/audio-eq-cookbook.html,
- F0 and Q in filters, Mini tutorial, Analog Devices,