Converting pure data biquad coefficients

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

    • Dec 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...
    • Dec 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!*
    • Dec 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?
    • Dec 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?
    • Dec 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).
    • Dec 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!*
    • Jan 05 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!
    • Jan 05 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?
      _ johan
    • Feb 17 2015 | 3:38 pm
      I've just came across the same problem. I fixed this issue asking Nigel Redmon on his - very very useful - website ( 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.
    • Feb 17 2015 | 7:06 pm
      You can roll your own biquads fairly easily using Gen:
    • Feb 18 2015 | 11:25 am
      That's very interesting. I'll have to look at gen~ one day.