Help with audio EQ cookbook BPF filters and Q I am fairly new DSP, and am using maths that I have not used in 20-30 years.  I have been working with Cookbook formulae for audio EQ biquad filter coefficients by Robert Bristow-Johnson and am having a few problems.  

I am trying to design a biquad band pass filter with a sampling rate of 48000 Hz, a center frequency of 20000 Hz, and a bandwidth of 500Hz.  Q = fc/delta f, so Q should = 20000/500 = 40.  I have run these numbers through a few different tools that use the Robert Bristow-Johnson formulas, and calculated them manually, and get the following coefficients:

a1 = 1.72129273
 a2 = 0.98757764
 b0 = 0.00621118
 b1 = 0.00000000e+0
 b2 = -0.00621118

I have plotted the frequency response with various tools (https://arachnoid.com/BiQuadDesigner/, source from http://www.earlevel.com/main/2016/12/01/evaluating-filter-frequency-response/ and others).  I expected to see a -3db roll off at about 19750Hz/20250Hz, but I see it at about 19950Hz/20050Hz.  Could anyone point out what I am doing wrong.  

Thank you
i believe that what you're seeing is the compression of bandwidth done by the frequency warping inherent with the bilinear transform.  now, if you look at cookbook, the bandwidth $BW$ is expressed in terms of octaves.  so, for your spec:

$$ BW = \log_2(20250) - \log_2(19750) = 0.036069 \text{ octave} $$

try using that number for $BW$ or the corresponding $Q$ as shown in the cookbook:

$$ \frac{1}{Q} = 2 \sinh\left( \frac{\ln(2)}{2} BW \frac{\omega_0}{\sin(\omega_0)} \right) $$

i come up with $Q = 7.63359$.

your formula relating bandwidth in linear frequency to Q is accurate for analog filters but is accurate for digital filters (designed using bilinear transform) only for frequencies much lower than Nyquist.  the reason why is that frequency warping of the BLT moves frequency points downward and even after compensating the center frequency, it compresses the bandwidth in comparison to the analog counterpart.  and 20 kHz is quite close to Nyquist, so we expect this frequency warping and bandwidth compression.

note that for analog, the equation relating $Q$ and $BW$ (in octaves) is slightly different:

$$ \frac{1}{Q} = 2 \sinh\left( \frac{\ln(2)}{2} BW \right) $$

note that the factor $\frac{\omega_0}{\sin(\omega_0)}$ increases the effect of bandwidth, so the digital bandwidth need be smaller than the analog bandwidth especially as $\omega_0 \to \pi = $ Nyquist.