Direct Form 2 Biquad
So I'm working on building filters in gen~ and I made a biquad based on the Direct Form 2 block diagram you can see here:
So it seems like my patch is working pretty well except that I get some clicking when I start moving the filtergraph~ center frequency around rapidly. This doesn't happen with the official "gen~.biquad.maxpat" patch that is included with Max (and looks to be based on the Direct Form 1).
Any ideas what's happening and how to fix it?
Thanks,
Dave
hi stringtapper.
it seems that there is something wrong in your implementation. not too much time now to check. also, remember, you are using param and thus lower control rate via message rate to the implementation which does not help. i think the direct form one msp [biquad~] object has some sort of protection against this.
a while ago i posted three forms of biquad in both gen~ and GenExpr implementations to the forum here:
perhaps that will help if you compare them. although i have not looked at the patch in a while!
Thanks for the response stkr. I have been studying your GenExpr [Bp~] and Six-Pole Butterworth filters, so thanks for those as well!
When I compare the inside of my biquad gen~ with the inside of your "Direct Form 2 as gen~ patch" I can't find any difference between the two. Cosmetically, yes, but it seems like the configuration is ultimately the same. The biggest difference seems to be the use of [param] operators versus inputs.
I didn't figure that there would be a difference between using [param] operators and using input operators because the official "gen~.biquad" example patch uses [param] and it doesn't get the clicks that I'm getting.
Hmm, what to do…
Hi there,
Stkr is exactly right: [param] only updates at 'message rate' so it is essentially driving the filter coefficients with a step function. The fact that the direct form 1 doesn't click with small parameter changes is just a lucky artefact. Adding some kind of smoothing to the filter parameters coefficients is a good idea in most cases.
Graham
Ok this is really good to know. So by "smoothing" we're essentially talking driving the coefficients with signals being sent into the gen~… right?
Thanks.
Dave
Ok I think this modified version does the trick. I basically mirrored what stkr did in his patch using signals to control the coefficients. Well at least I can be satisfied that I built the overall structure of the filter correctly! Thanks for the help guys.
Dave
Would anyone like to take a look at my Direct Form I Biquad made in Codebox? It's my first foray into this and it seems like it should work but it seems like only the low pass is working. Thanks for any advice.
Be gentle… :)