I'm not sure how to do it with biquads, but I'm sure it's possible. It is absolutley possible to design an IIR filter that approximates this and then build it out of biquad sections, but I would have to look long and hard at my DSP theory texts to figure it out.
I do know how to do it with [czero~] objects, though. The difference equation for a mean across m samples is:
y(n) = 1/m * (x(n) + x(n-1) + ... + x(n-m+1))
so the z-transform is:
h(z) = 1/m * (1+ z^(m-1) + z^(m-2) + ... + z)
This is a polynomial in z and the roots of this polynomial (which are complex) are the locations of the zeros. I'm bad at algebra, so I used octave (the function is called roots) to find the roots. It turns out that whatever the value is for m, you will have n zeros spaced at equal intervals around the unit circle for the mean filter except for an absent zero at 1 (m-1 zeros in all). So for an m=8, your zeros would be at [.707, .707] [0,1] [ -.707, .707] [-1, 0] etc. I attach the pole-zero plot of the filter for m=8.
Your biquad-based solution to the 4 point average is very clever. It is very challenging (for me anyway) to generalize this filter design problem with biquads, so I have something to think about when I'm on the bus for a little while. If I come up with anything I'll post it.
Cheers,
David
On 9/7/2015 9:00 PM, Alexandre Torres Porres wrote:
Hi, I was able to implement a 4 point average filter with raw filters and biquad~ in Pd (find attached patch). I'm struggling to finda a way to implement an 8 point average filter with biquads~ and raw filters...
Anyone can help?
thanks
_______________________________________________ Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list