Smooth filter changes

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

How are smooth filter changes made?

I'm thinking it involves recalculating the coefficients (in every sample), but does it involve interpolation as well?

Post

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!

Post

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.

Post

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 do you mean by filtering the coefficients?

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.

Post

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.

Post

Miles1981 wrote: Thu May 12, 2016 9:54 am 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.
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.

Post

The general topic is discussed on a good introductory level on this paper though:

http://www.dafx14.fau.de/papers/dafx14_ ... s_for_.pdf

Post

soundmodel wrote: Thu Feb 02, 2023 8:06 am(but OTOH digital audio itself is stepped)
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.

Post

mystran wrote: Thu Feb 02, 2023 11:09 am
soundmodel wrote: Thu Feb 02, 2023 8:06 am(but OTOH digital audio itself is stepped)
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.
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.

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.

Post

soundmodel wrote: Thu Feb 02, 2023 8: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
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.

Post

Z1202 wrote: Thu Feb 02, 2023 4:02 pm
soundmodel wrote: Thu Feb 02, 2023 8: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
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.
But are all digital synth filters ZDFs then?

Post

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.
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.!
I'm not sure how to interpret this though.

What does "reinitialization" mean here?

Why does this deal with filter stability?

Post

soundmodel wrote: Wed May 11, 2016 5:39 pm How are smooth filter changes made?

I'm thinking it involves recalculating the coefficients (in every sample), but does it involve interpolation as well?
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.

Post

JustinJ wrote: Sat Mar 25, 2023 9:49 am
soundmodel wrote: Wed May 11, 2016 5:39 pm How are smooth filter changes made?

I'm thinking it involves recalculating the coefficients (in every sample), but does it involve interpolation as well?
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.
How does this guarantee that some coefficients would not produce a filter that blows up?

Post

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.

Post Reply

Return to “DSP and Plugin Development”