For the cookbook LPF the filter takes the form \[ y[n] = a(x[n] + 2 x[n-1] + x[n-2] - b y[n-1] - c y[n-2]) \] where \(f_s\) is the sampling frequency, \(f\) is the cutoff frequency, and \[ \array { t &=& 1 / \tan(\pi f / f_s) \\ a &=& 1 / (t^2 + t/q + 1) \\ b &=& 2 - 2 t^2 \\ c &=& t^2 - t/q + 1 \\ } \] (Of course \(t^2\) and \(t/q\) need only be computed once.)
The cookbook HPF is similar: \[ y[n] = a(x[n] - 2 x[n-1] + x[n-2] - b y[n-1] - c y[n-2]) \] with \[ \array { t &=& \tan(\pi f / f_s) \\ a &=& 1 / (t^2 + t/q + 1) \\ b &=& 2 - 2 t^2 \\ c &=& t^2 - t/q + 1 \\ } \]
Cookbook bandpass: \[ y[n] = a(b(x[n] - x[n-2]) - c y[n-1] - d y[n-2]) \] where \[ \array { \omega &=& 2 \pi f / f_s \\ e &=& 0.5 W \omega / \sin(\omega) \\ B &=& 2^e - 2^{-e} \\ t &=& \tan(\omega / 2) \\ a &=& 1 / (1 + t^2 + B t) \\ b &=& B t \\ c &=& 2 t^2 - 2 \\ d &=& 1 + t^2 - B t \\ } \] \(W\) is the bandwidth in octaves. Note the value given to \(B\) is an approximation. For the bandpass filter with peak gain \(Q\), leave \(b\) out (i.e. \(b=1\)). The cookbook formulas may be better since we must compute \(\sin(\omega)\) anyway.