std :: dsp::biquad
Struct std::Biquad
struct Biquad {
double b0;
double b1;
double b2;
double a1;
double a2;
double z1;
double z2;
}Fields
Methods
process() over a block: out[i] = filter(in[i]), keeping the state in registers for the whole block. in == out is allowed. Real-time safe.
Z-domain frequency response at 'freqHz' (evaluates H(e^{jomega}), omega = 2pi*freqHz/fs) — magnitude (linear, not dB) and phase (radians).
A section with these (a0-normalized) coefficients and zero state.
fs = sample rate (Hz), f0 = cutoff/center frequency (Hz), q = Q factor (> 0; higher = narrower/more resonant).
constant 0 dB peak gain
dbGain: boost (positive) or cut (negative) at f0, in decibels.
s: shelf slope (1.0 = maximally steep without overshoot — the RBJ cookbook's own recommended default when no other constraint applies).
static struct Biquad bilinear(
double B0,
double B1,
double B2,
double A0,
double A1,
double A2,
double fs,
)source · definitionGeneral analog-to-digital 2nd-order section via the bilinear transform. H(s) = (B2s^2 + B1s + B0) / (A2s^2 + A1s + A0) is the analog prototype; fs is the target digital sample rate. Frequencies in H(s) should already be pre-warped (w_analog = 2fstan(w_digital/(2*fs))) by the caller if matching a specific digital cutoff matters — this function performs the algebraic substitution only, the same division of responsibility real bilinear-transform tools use.