Stabilizing a modulating Biquad Filter?
-
- KVRian
- 1238 posts since 29 Sep, 2004
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!
Thanks a bunch!
http://www.adamszabo.com/ - Synths, soundsets and music
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
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.
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.
- KVRAF
- 3231 posts since 10 Nov, 2013 from Germany
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.
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.
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
-
- KVRian
- 1240 posts since 11 Aug, 2004 from France
Isn't a biquad simulated with a DF1 structure actually a ZDF filter ?
(running to the exit)
(running to the exit)
Last edited by Ivan_C on Tue Apr 12, 2016 4:46 pm, edited 1 time in total.
-
- KVRian
- Topic Starter
- 1238 posts since 29 Sep, 2004
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 lfoMiles1981 wrote:Yes, you can use transformed direct form 2 that have the first coefficient applied on the input data and not recursively.
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
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
Yes, I should have said SVF.Ivan_C wrote:Isn't a biquad simulated with a DF1 structure actually a ZDF filter ?
(running to the exit)
-
- KVRian
- Topic Starter
- 1238 posts since 29 Sep, 2004
Is the code I have above actually the correct Transposed Direct Form ii?
http://www.adamszabo.com/ - Synths, soundsets and music
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
I think it does (it feels like my implementation https://github.com/mbrucher/AudioTK/blo ... IRFilter.h)adamtrance wrote:Is the code I have above actually the correct Transposed Direct Form ii?
-
- KVRian
- Topic Starter
- 1238 posts since 29 Sep, 2004
Cool, does your code have the stabilization trick you mentioned?
http://www.adamszabo.com/ - Synths, soundsets and music
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
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.
- u-he
- 30247 posts since 8 Aug, 2002 from Berlin
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?)
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?)
-
- KVRian
- Topic Starter
- 1238 posts since 29 Sep, 2004
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 bumpUrs 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.

http://www.adamszabo.com/ - Synths, soundsets and music
-
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
Are you sure you are not reinitializing the states after each parameter update?
- u-he
- 30247 posts since 8 Aug, 2002 from Berlin
