Converting pure data biquad coefficients
I'm trying to recreate a pd patch in max, but the biquad~ coefficients seem very different in pd and max.
Does anyone have a method of converting pd coefficients to max ones??
Thanks
Tom
i think in pd the 'a' coefficients (or 'ff' as pd calls them) are last and the b's (fb) first?
pd: b1 b2 a0 a1 a2
max: a0 a1 a2 b1 b2
is that the issue? apologies if not...
yea, a = feedforward coefficients, b = feedback coefficients.
you can just rearrange accordingly as pid described.
________________________________
*Never fear, Noob4Life was never here!*
afaik pd and max use different equations for biquad
http://lists.puredata.info/pipermail/pd-list/2009-09/072608.html
http://en.wikipedia.org/wiki/Digital_biquad_filter
Yes, they are definitely different forms.
I tried rearranging as recommended by pid, but it's not so straightforward.
If I recreate a Direct Form 2 filter by using sample delays in Max will this work as effectively as the biquad~?
Or is that naive?
Ah yes, that is naive... as you can't feed delay~ back on itself...
So, does anyone know how I would implement this Direct Form 2 filter in Max?
I can't really help with the filter design - the most straightforward way would probably be to make an external using the Pd code or other reference code in c or java, but I have no idea how this works or how tricky it is.
Two less than stellar options in Max: Try as you suggested, but with tapin~/tapout~ or send~/receive~ in a poly~ with vector size 1 to achieve the one sample delay (very inefficient). Or use pd~ inside Max, see http://crca.ucsd.edu/~msp/software.html (don't know which Max/Pd versions you'll need).
good to know! i must experiment further with this difference now. thanks for those links grg.
________________________________
*Never fear, Noob4Life was never here!*
Cheers for the info grg.
Will check out the pd~ object I think and see how well that fares - had no idea that it existed!
My guess is that PD's filter definition is the same as ISPW's 2p2z~. I found a 2p2z~ abstraction, part of the ISPW compatibility lib. It shows that values should not only be swapped, as correctly stated but that the b-coeffs should also be negated. Does that work?
_
johan
I've just came across the same problem. I fixed this issue asking Nigel Redmon on his - very very useful - website (http://www.earlevel.com/main/2003/03/02/the-bilinear-z-transform/#comment-35978). You can read the exchange about that at the end of the page (Corentoulf user).
In fact, Max and Pd use a different form of biquad equations (DFI and DFII). But they do the same thing, so coefficients are the same between the two softwares, except these two differences :
- a and b that have to be swapped (as PID said)
- as Pd's w[n] equation only uses additions :
y[n] = b0*w[n] + b1*w[n-1] + b2*w[n-2]
with :
w[n] = x[n] + a1*w[n-1] + a2*w[n-2]
you have to multiply Pd's a1 and a2 by -1 to get Max's b1 and b2 (y[n] = a0 * x[n] + a1 * x[n-1] + a2 * x[n-2] – b1 * y[n-1] – b2 * y[n-2])
.
Here is a patch I made to explain the reasoning (better than my words). Hope it can help.
You can roll your own biquads fairly easily using Gen:
That's very interesting. I'll have to look at gen~ one day.