I am trying to build a resonance filter with real-time control of both center frequency and Q. I've come across what looks to me like a suitable "recipe" for a second-order IIR filter that might do the job, at http://www.music.mcgill.ca/~gary/307/week2/filters.html (toward the bottom of the page, quoted here with some loss of formatting):
$$y[n] = x[n] - a_1 y[n-1] - a_2 y[n-2]$$
where $a_1 = -2r \cos(2 \pi f_0 T) \\ a_2 = r^2 \\ f_0 = \text{resonant frequency} \\ T = \text{sampling period} $
or more "refined:"
$$y[n] = b_0 x[n] + b_1 x[n-1] + b_2 x[n-2] - a_1 y[n-1] - a_2 y[n-2]$$ where $ b_0 = \frac{1 - r^2}{2} \\ b_1 = 0 \\ b_2 = -b_0 $
The text says of the parameter $r$ that "the closer $r$ is to 1.0, the narrower the bandwidth of the resonance peak." This sounds to me like the definition of $Q$, but I suspect that it's not identical.
My question: What is the relationship between $r$ above and the more usual filter parameter $Q$?
I am just beginning to learn (self-teach) how to build filters, and I am still unclear on some of the concepts. Thanks in advance for any help.