I've been trying to figure out the bi-quad node by using the linked bi-quad cookbook numbers. The first problem I encountered is in the formula. The cookbook shows the normalized formula as: y[n] = b0*x[n] + b1*x[n-1] + b2*x[n-2] - a1*y[n-1] - a2*y[n-2] (assuming a0=1) but the formula listed for the module in the docs is: out[n] = a1 * in[n] + a2 * in[n-1] + a3 * in[n-2] - ( b1 * out[n-1] + b2 * out[n-2] ) By comparison it would appear that: module cookbook a1 = b0 a2 = b1 a3 = b2 b1 = a1 b2 = a2
Following the formula in the cookbook for a low-pass filter:
OK, I turned the Q down to zero and the filter didn't white out, but it was still resonating. There's obviously still something wrong. It would be nice to get some confirmation from Taylor as to what he actually implemented. It would be nice to have it working since we don't have a second order bandpass filter node. In order to implement this you need z-2 so I don't think you could do it with a z-1 node.
@stschoen - Taylor says he thinks the z-1 doesn't stack, but do you have a good idea of how to test that? You might be able to combine them, but he's not sure.
I'm not really trying to stack the z-1 node. I figured that it almost certainly wouldn't work. I was just pointing out that the bi-quad algorithm use z-2 so that it would be hard to duplicate using the z-1 node. I would appreciate it if you would show my post to Taylor and get his comments. I've double checked my work and I can't find any error, but the bi-quad node doesn't seem to be working as I would expect. It would be a nice add to the filter arsenal as it should be possible to create a set of efficient filters.
Thanks again @SansNom. I located my problem thanks to your modules. I forgot to divide the terms of the equation by the a0 coefficient. I should have checked the forum more closely, seems I was re-inventing the wheel. Interesting comment from Taylor in one of the other threads that the built-in filter node is a bi-quad, optimized by not re-evaluating the co-efficients at the sample rate. I thought that might be the case. It would be nice to have the other variants (HP, BP etc) as built-ins.