Forums > MaxMSP

Converting pure data biquad coefficients

December 19, 2010 | 6:32 pm

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??



December 19, 2010 | 6:41 pm

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…

December 19, 2010 | 11:20 pm

yea, a = feedforward coefficients, b = feedback coefficients.

you can just rearrange accordingly as pid described.

*Never fear, Noob4Life was never here!*

December 20, 2010 | 1:21 pm

afaik pd and max use different equations for biquad

December 20, 2010 | 4:15 pm

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?

December 20, 2010 | 4:26 pm

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?

December 22, 2010 | 7:35 am

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 (don’t know which Max/Pd versions you’ll need).

December 22, 2010 | 9:04 am

good to know! i must experiment further with this difference now. thanks for those links grg.

*Never fear, Noob4Life was never here!*

January 5, 2011 | 12:55 pm

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!

January 5, 2011 | 1:16 pm

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?


– Pasted Max Patch, click to expand. –

Viewing 10 posts - 1 through 10 (of 10 total)