Stabilizing a modulating Biquad Filter?

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Hi everyone, I stumbled into a serious issue I have never known about, I guess it was apparent to a lot of people but totally went by me. When modulating the frequency cutoff of standard Biquad Lowpass filter for example with an lfo, it works fine, but as soon as I increase the speed of the lfo the filter explodes and goes crazy. I never knew about this, and now know that there are ZDF filter as alternatives, but are there any known ways to fix this issue in biquads? Unfortunately filters are not my forte and I wouldn't really understand what it means to "have the poles inside the unit circle" and such, I read some documents but they are like Chinese to me. Would anyone be so kind to give some few tips in layman terms?

Thanks a bunch!
http://www.adamszabo.com/ - Synths, soundsets and music

Post

Yes, you can use transformed direct form 2 that have the first coefficient applied on the input data and not recursively.
The fact that the poles are inside or outside is more relevant to fixed filters, this has more to do with the fact that as the roots and poles move on the plane, the coefficients do not move in the same "way" and dependening on how they are used, it explodes. I think Vadim explained it quite well in his (free) book, before he tackles ZDF. But ZDF is not required for time varying filters.

Post

Another alternative would be State Variable filters.

A nice implementation has been posted here a while ago.

http://www.cytomic.com/technical-papers

Concerning bi-quads: Which form are you using DF1 or DF2? They are different in stability.

Post

That's what we meant by ZDF/SDF.

Post

Isn't a biquad simulated with a DF1 structure actually a ZDF filter ?

(running to the exit)
Last edited by Ivan_C on Tue Apr 12, 2016 4:46 pm, edited 1 time in total.

Post

Miles1981 wrote:Yes, you can use transformed direct form 2 that have the first coefficient applied on the input data and not recursively.
I am infact using a Transposed Direct Form II RBJ Filter, or at least thats what I was told that is. However its still easy to break it with the lfo :(

I am not sure what you mean by applying the first coefficient? Here is my code, from FlowStone, its not c++ but hopefully its not so complicated to understand:

Code: Select all

streamin in;
streamin freq;
streamin q;
streamout out;

float v1,v2;
float a0,a1,a2,b0,b1,b2;
float sin,cos,alpha,abs;

  sin = sin1(0.5*freq);
  cos = cos1(0.5*freq);
  alpha = sin/(2*q);
  a0 = 1/(1 + alpha);
  a1 = a0*-2*cos;
  a2 = a0*(1 - alpha);
  b0 = a0*(1 - cos)*0.5;
  b1 = 2*b0;
  b2 = b0;
  
  out = b0*in + v1;
  v1  = b1*in - a1*out + v2;
  v2  = b2*in - a2*out; 
http://www.adamszabo.com/ - Synths, soundsets and music

Post

Ivan_C wrote:Isn't a biquad simulated with a DF1 structure actually a ZDF filter ?

(running to the exit)
Yes, I should have said SVF.

Post

Is the code I have above actually the correct Transposed Direct Form ii?
http://www.adamszabo.com/ - Synths, soundsets and music

Post

adamtrance wrote:Is the code I have above actually the correct Transposed Direct Form ii?
I think it does (it feels like my implementation https://github.com/mbrucher/AudioTK/blo ... IRFilter.h)

Post

Cool, does your code have the stabilization trick you mentioned?
http://www.adamszabo.com/ - Synths, soundsets and music

Post

Nothing fancier than what you have. SVF are different beasts (but I have second order SVF filters in ATK)
Last edited by Miles1981 on Wed Apr 13, 2016 9:58 am, edited 1 time in total.

Post

Direct Form Biquads belong in DSP literature, not in contemporary plug-ins. They are a theoretical construct which has (had) its uses, but time varying or non-linear filters are not among them.

Use Cytomic's SVF instead. It yields identical frequency/phase response without the computational overhead and numerical inaccuracies of DF Biquads. You can modulate the shit out of them and they won't explode, unlike RBJ biquads.

(heck, you can even "morph" between filter types without division by zero. How great is that?)

Post

Urs wrote:Use Cytomic's SVF instead. It yields identical frequency/phase response without the computational overhead and numerical inaccuracies of DF Biquads. You can modulate the shit out of them and they won't explode, unlike RBJ biquads.
Thanks, I used Cytomics code, and for some reason it behaves differently to the Biquad. I want to save cpu, so I use hop on the coefficent calculation, that is, make it only calculate every 16 samples only, and I used a decaying envelope (also only calculated every 16 samples) on the filter cutoff, and it seems the SVF doesnt like being hopped. The Biquad (Blue) is much more forgiving. The SVF (Red) creates a real nasty bump :(

Image
http://www.adamszabo.com/ - Synths, soundsets and music

Post

Are you sure you are not reinitializing the states after each parameter update?

Post

That SVF is the most forgiving 2-pole structure I know. A bug maybe?

Post Reply

Return to “DSP and Plugin Development”