# [PD] Resonant filter using cpole~ czero~

Mike Moser-Booth mmoserbooth at gmail.com
Fri Feb 3 01:13:47 CET 2012

```On Thu, Feb 2, 2012 at 1:37 PM, Mathieu Bouchard <matju at artengine.ca> wrote:
> Le 2012-02-02 à 11:40:00, Mathieu Bouchard a écrit :
> Actually, [bp~] is pretty much a 2-pole resonant real filter, right ?

Yep. Both poles sit right on top of each other along the real axis.

> The input parameters f (centre freq) and s (sampling rate) and Q are transformed
> like this :
>
> ω = 2πf/s
> r = 1-ω/Q
> a = -r²
> b = 2r*cos(ω)
> c = 1 (an overall gain is applied separately, which is like scaling a,b,c
> all at once)

I don't think this is entirely accurate. I think a and c should be
switched here, though of course when finding b²-4ac that doesn't
really matter. Also, when applying a gain to a recursive filter, it's
not really the same as scaling all the coefficients. If you were to
scale them first, then the gain would affect the feedback portions of
the filter. Applying the gain after means the feedback samples are not
scaled by the gain.

If you think of it in terms of its transfer function, it would look
more like this:

H(z) = g*(1 / (1 - 2r*cos(ω)*(z^-1) + r^2 * z(^-2) ))

Looking at it that way, the gain simply becomes the numerator and does
not affect the feedback coefficients in the denominator. This equates
to simply scaling the input of the filter.

> It seems that [bp~] is
> a mere combination of a [lop~], a [hip~] and a [*~] (plus the calculation of
> their coefficients).

But [hip~] isn't an all-pole filter. It has a zero at DC.

.mmb

--
Mike Moser-Booth - mmoserbooth at gmail.com
Master's Student in Music Technology
Schulich School of Music, McGill University
Centre for Interdisciplinary Research in Music Media and Technology

"If you think education is expensive, try ignorance" -Derek Bok

```