Class BiquadDesign
Second-order filter coefficients from the RBJ "Audio EQ Cookbook" and their exact magnitude response, used to draw equalizer curves that match a biquad implementation sample for sample.
public static class BiquadDesign
- Inheritance
-
BiquadDesign
- Inherited Members
Remarks
Coefficients are normalized (a0 = 1). MagnitudeDb(in Coefficients, double, double) evaluates |H(e^jω)| of the digital filter, so the curve shows the real response near Nyquist (cramping of bells and shelves) instead of the analog prototype.
Methods
Design(EqBandType, double, double, double, double)
Designs one band.
public static BiquadDesign.Coefficients Design(EqBandType type, double frequency, double gainDb, double q, double sampleRate)
Parameters
typeEqBandTypeFilter shape.
frequencydoubleCenter / corner frequency in Hz (clamped to 1 Hz … 0.499 × sample rate).
gainDbdoubleGain in dB (bells and shelves only).
qdoubleQuality factor (bandwidth of bells, notches and band passes; resonance of cuts; slope of shelves, 0.7071 = maximally steep without overshoot).
sampleRatedoubleSample rate in Hz.
Returns
- BiquadDesign.Coefficients
The normalized coefficients.
Exceptions
- ArgumentOutOfRangeException
sampleRateis not positive.
MagnitudeDb(in Coefficients, double, double)
Magnitude response in dB of a biquad at a frequency.
public static double MagnitudeDb(in BiquadDesign.Coefficients c, double frequency, double sampleRate)
Parameters
cBiquadDesign.CoefficientsNormalized coefficients.
frequencydoubleFrequency in Hz.
sampleRatedoubleSample rate in Hz.
Returns
- double
20·log10 |H(e^jω)|, floored at −300 dB.