Smooth filter changes
-
soundmodel
- KVRian
- Topic Starter
- 802 posts since 28 May, 2010 from Finland
How are smooth filter changes made?
I'm thinking it involves recalculating the coefficients (in every sample), but does it involve interpolation as well?
I'm thinking it involves recalculating the coefficients (in every sample), but does it involve interpolation as well?
-
alexirae
- KVRer
- 25 posts since 21 Dec, 2010
There are many different ways to achieve this, I'll tell you how I do it:
Let's take as an example a 2nd Order IIR Low Pass Filter with fixed Q (Butterworth).
1) Smooth the frequency cut of the filter when you get a notification from the DAW that this parameter has changed doing any kind of interpolation you like.
2) Recalculate the filter coefficients with frequency parameter value obtained from the smoothing.
3) Update output and filter delay units (I use Direct Form II Transposed).
4) Do steps 1, 2, 3 again on each sample you process in your audio buffer until the interpolation has reached its destination frequency value.
When there is no change in the filter frequency cut you only do step 3.
If you want you can have a look into the parameter smoother posted in this link:
http://www.musicdsp.org/showArchiveComm ... hiveID=257
If you look at the last comment in that link you'll find an improved version that I've suggested.
Hope it helps!
Let's take as an example a 2nd Order IIR Low Pass Filter with fixed Q (Butterworth).
1) Smooth the frequency cut of the filter when you get a notification from the DAW that this parameter has changed doing any kind of interpolation you like.
2) Recalculate the filter coefficients with frequency parameter value obtained from the smoothing.
3) Update output and filter delay units (I use Direct Form II Transposed).
4) Do steps 1, 2, 3 again on each sample you process in your audio buffer until the interpolation has reached its destination frequency value.
When there is no change in the filter frequency cut you only do step 3.
If you want you can have a look into the parameter smoother posted in this link:
http://www.musicdsp.org/showArchiveComm ... hiveID=257
If you look at the last comment in that link you'll find an improved version that I've suggested.
Hope it helps!
-
Miles1981
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
You don't want to filter the coefficients if you can have access to the underlying parameters and if you can cheapely compute the former from the latter.
If you can't, then the compromise is either to filter the coefficients (like I do for my time varying filters, but definitely not the best solution, even with more stable configurations) or compute the coefficients kess often, every 32 samples for instance.
If you can't, then the compromise is either to filter the coefficients (like I do for my time varying filters, but definitely not the best solution, even with more stable configurations) or compute the coefficients kess often, every 32 samples for instance.
-
soundmodel
- KVRian
- Topic Starter
- 802 posts since 28 May, 2010 from Finland
What do you mean by filtering the coefficients?Miles1981 wrote:You don't want to filter the coefficients if you can have access to the underlying parameters and if you can cheapely compute the former from the latter.
If you can't, then the compromise is either to filter the coefficients (like I do for my time varying filters, but definitely not the best solution, even with more stable configurations) or compute the coefficients kess often, every 32 samples for instance.
What's done during those 32 samples?
I'm trying to understand whether e.g. this:
http://musicdsp.org/files/CFxRbjFilter.h
could be used with "smooth" parameter changes somehow.
-
Miles1981
- KVRian
- 1379 posts since 26 Apr, 2004 from UK
Filtering the IIR coefficients is not the same as filtering the underlying parameters.
During the 32 samples, the coefficients stay the same, until the next update.
The filter you mention seems to be a direct form 1, so not suited for parameters changes.
During the 32 samples, the coefficients stay the same, until the next update.
The filter you mention seems to be a direct form 1, so not suited for parameters changes.
-
soundmodel
- KVRian
- Topic Starter
- 802 posts since 28 May, 2010 from Finland
I'm just trying to understand the theory behind this:
This sounds like the filter changes really become stepped (but OTOH digital audio itself is stepped), but perhaps the core idea here is that the sample interval is chosen small enough so that e.g. steps occurring every 32 sample or so are non-audible?
This sounds easier that (what I assumed it to be) finding filter forms that have continuous parametrizations.
-
soundmodel
- KVRian
- Topic Starter
- 802 posts since 28 May, 2010 from Finland
The general topic is discussed on a good introductory level on this paper though:
http://www.dafx14.fau.de/papers/dafx14_ ... s_for_.pdf
http://www.dafx14.fau.de/papers/dafx14_ ... s_for_.pdf
-
mystran
- KVRAF
- 7362 posts since 12 Feb, 2006 from Helsinki, Finland
You will have a much easier time reasoning about digital filters if you drop this (wrong) idea.
Digital audio is not "stepped" but rather a series of samples representing the values of a unique, smooth (infinitely differentiable), continuous, band-limited (to half the sampling rate) signal. Whenever you are manipulating samples, you really forcing this continuous signal to take a different form.
This means that digital audio cannot really represent any kind of "true" discontinuity. A discontinuity (or a "click" as it's perceived) for our purposes is a situation where a concentration of broadband energy is required to allow the underlying smooth signal to interpolate (= pass through) all the sampling points. To avoid "clicks" your digital processing must produce a set of sample values such that the interpolating continuous signal does not require significant concentrations of broadband signal content.
If you try to approach this from the idea that "samples are steps" then you will not get anywhere.
Seeking asylum in any country willing to acknowledge my right to exist.
-
Z1202
- KVRian
- 1474 posts since 12 Apr, 2002
Except that here we're talking of control signals rather than audio signals, and it's noticeably more difficult to apply the same concept to those. OTOH the stepped signal idea might be actually not so far from truth in the case of lower control rates.mystran wrote: ↑Thu Feb 02, 2023 3:09 amYou will have a much easier time reasoning about digital filters if you drop this (wrong) idea.
Digital audio is not "stepped" but rather a series of samples representing the values of a unique, smooth (infinitely differentiable), continuous, band-limited (to half the sampling rate) signal.
Edit: the problem with modulation of filter coefficients is not just the spectrum of control signals, it's to a much larger degree topological effects. I guess, if one would build a countinuous-time counterpart of a discrete-form filter (which can be done by replacing z^-1's with allpasses), it would behave comparably poorly in modulations (esp. with stepped "control-rate signals"), similarly to a digital direct form.
-
Z1202
- KVRian
- 1474 posts since 12 Apr, 2002
I think what the article doesn't mention is that for the standard ZDF approach, pretty much any continuous-time cutoff variations are representable as dilations/contractions of the time axis, and in that sense produce no artifacts at all. It's natural to assume that ZDF, being a discrete-time approximation of that, is close to that.soundmodel wrote: ↑Thu Feb 02, 2023 12:18 am The general topic is discussed on a good introductory level on this paper though:
http://www.dafx14.fau.de/papers/dafx14_ ... s_for_.pdf
-
soundmodel
- KVRian
- Topic Starter
- 802 posts since 28 May, 2010 from Finland
But are all digital synth filters ZDFs then?Z1202 wrote: ↑Thu Feb 02, 2023 8:02 amI think what the article doesn't mention is that for the standard ZDF approach, pretty much any continuous-time cutoff variations are representable as dilations/contractions of the time axis, and in that sense produce no artifacts at all. It's natural to assume that ZDF, being a discrete-time approximation of that, is close to that.soundmodel wrote: ↑Thu Feb 02, 2023 12:18 am The general topic is discussed on a good introductory level on this paper though:
http://www.dafx14.fau.de/papers/dafx14_ ... s_for_.pdf
-
soundmodel
- KVRian
- Topic Starter
- 802 posts since 28 May, 2010 from Finland
The U-He Repro document here:
https://www.u-he.com/downloads/UrsBlog/ ... veiled.pdf
discusses a "post-filter sanity check" for filter stability analysis.
What does "reinitialization" mean here?
Why does this deal with filter stability?
https://www.u-he.com/downloads/UrsBlog/ ... veiled.pdf
discusses a "post-filter sanity check" for filter stability analysis.
I'm not sure how to interpret this though.As digital filters can behave erratically (“explode”), there is a post-filter sanity check which
observes audio levels. To guard against extreme noise bursts at critical settings, the filter is
reinitialized whenever an output sample exceeds +30dB.!
What does "reinitialization" mean here?
Why does this deal with filter stability?
-
JustinJ
- KVRist
- 87 posts since 31 Oct, 2017
Concentrate on making your coefficient calculation fast using good math approximations. Then recalculate your coefficients every 4/8/16 samples. In between, just filter using the coefficients. No need to interpolate the coefficients per sample.soundmodel wrote: ↑Wed May 11, 2016 9:39 am How are smooth filter changes made?
I'm thinking it involves recalculating the coefficients (in every sample), but does it involve interpolation as well?
-
soundmodel
- KVRian
- Topic Starter
- 802 posts since 28 May, 2010 from Finland
How does this guarantee that some coefficients would not produce a filter that blows up?JustinJ wrote: ↑Sat Mar 25, 2023 1:49 amConcentrate on making your coefficient calculation fast using good math approximations. Then recalculate your coefficients every 4/8/16 samples. In between, just filter using the coefficients. No need to interpolate the coefficients per sample.soundmodel wrote: ↑Wed May 11, 2016 9:39 am How are smooth filter changes made?
I'm thinking it involves recalculating the coefficients (in every sample), but does it involve interpolation as well?
-
soundmodel
- KVRian
- Topic Starter
- 802 posts since 28 May, 2010 from Finland
Based on seeing ZDF paired with a bilinear transform in:
https://www.adsrsounds.com/reaktor-tuto ... s-part-ii/
The Time-Varying Bilinear Transform
https://www.aes.org/e-lib/browse.cfm?elib=18490
seems like another prominent method.
https://www.adsrsounds.com/reaktor-tuto ... s-part-ii/
The Time-Varying Bilinear Transform
https://www.aes.org/e-lib/browse.cfm?elib=18490
seems like another prominent method.