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]−a1y[n−1]−a2y[n−2]
where a1=−2rcos(2πf0T)a2=r2f0=resonant frequencyT=sampling period
or more "refined:"
y[n]=b0x[n]+b1x[n−1]+b2x[n−2]−a1y[n−1]−a2y[n−2] where b0=1−r22b1=0b2=−b0
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.
See also this question and its answer.
Answer
I'll give you one quick answer (without proofs).
If your mapping from s to z is the Bilinear Transform, then
Q=sin(2πf0T)21+r21−r2
If it's Impulse Invariant, I think it's
Q=−πf0Tln(r)=−2πf0Tln(r2)
For high Q and reasonably low f0T, the two expressions come out nearly equal.
No comments:
Post a Comment