3
$\begingroup$

I have a DSP application that filters a signal with five cascaded biquads whose coefficients are determined by the Audio EQ Cookbook formulae (Thanks for this work, Mr. Bristow-Johnson btw). Each filter's coefficients can be changed individually via RS232 from a matlab app, however doing so produces audible click noises.

To prevent clicking, my first idea was to lowpass filter the individual coefficients to smoothen the transition. A friend of mine told me that this could cause instability. He is way more experienced in the field than I am, also I still lack the proficiency to prove/-disprove his claim or finding out which circumstances can cause instability in this case, so I take his word for granted.

However, his solution (Smoothing parameters instead and then calculating the correct coefficients) doesn't work for me. Calculating intermediate values in Matlab and transmitting them is not an option because of bandwidth constraints, calculating them on the DSP is not an option because of limited CPU time.

One solution would be to employ two parallel filters and crossfade between them. But I don't particularly like it, because it doubles my computational load, also two changes in rapid succession would lead to audible clicks anyways.

The next idea I had was to employ Gold-Rader structure (see below) for the biquad denominator. Since this structure uses the pole radius, which is always kept below 1 (as long as I filter it with a filter that doesn't overshoot...), it can't become unstable... except for the fact that the radius is multiplied with $sin(\phi)$ and $cos(\phi)$ before introduced in the signal flow graph. So if I'm transmitting the calculated products $r \cdot sin(\phi)$ and $r \cdot cos(\phi)$, I'm again not sure about how filtering those coefficients would affect stability. Gold&Rader block diagram of recursive part Each of the five biquads must be tunable across 20 Hz to 20 kHz, -18 to +18dB gain (where applicable) and a Q from 0.5 to 10 for the Peaks. The type of filter stays the same though (i.e. a highpass will always stay a bypass, a peak filter will always be a peak filter...).

So my question is: what is the most efficient way to avoid clicks while not risking instability of the filter?

$\endgroup$
2
  • 1
    $\begingroup$ In my experience there's not much more to do than smoothen the coefficient change by calculating intermediate coefficients after/while changing the parameter values. Choosing bigger I/O and data buffers in your DSP application might help a bit with the CPU issue you say you're suffering of. BTW, what is the max baud rate you RS232 connection supports? $\endgroup$
    – Juha P
    Jul 6, 2017 at 10:48
  • 5
    $\begingroup$ there is a concept we call "coefficient slewing". when a knob is turned and new coefficients are calculated, those new coefficients should be written to locations in memory that you call target coefficients. the actual coefficients used in the sample processing should not be those target coefficients but should be slewed coefficients. i've seen two ways of slewing coefficients: one is linearly interpolating from the coefficient's actual value to the target value. the other is a simple one-pole LPF on each coefficient. $\endgroup$ Jul 6, 2017 at 15:07

4 Answers 4

6
$\begingroup$

Another possibility is to send the coefficients as poles and zeros and interpolate/smooth in the z-plane instead of the coefficient domain. This is always guaranteed to be stable. You can either interpolate in real/imaginary presentation or, if you want to get fancy, in magnitude and phase. The first one is a lot easier, since the phase interpolation has to handle wrap around.

Coefficient calculation from real and imaginary part is straight forward and suitable for real time. Only exception may be if you have a dual real pole/zero instead of a complex conjugated pair.

$\endgroup$
4
$\begingroup$

I think the basic premise of your question is incorrect. Interpolating coefficients doesn't lead to unstable filters in biquads; moreover, it is very easy to prove. Just plot a1 vs a2 and you'll see that the stability region for the triplet of coefficients in the denominator is a convex spaces. Because of that, interpolating coeffs (as long as the same interpolation method is used) will always produce stable filters... however, that doesn't imply that there won't be discontinuities in the internal state of the filter. Due to this it is not a matter of avoiding stability but using a topology that doesn't produce discontinuities. SVF TPT seems to be, in general, the way to go in that setting.

I added a quick plot to show the convexity of the stability region (big nice triangle :) )

enter image description here

$\endgroup$
2
$\begingroup$

You could limit the rate of sending a change of coefficients to that of the cross fade duration. But send the latest setting at each duration tick (every 16 mS video frame or equivalent, for instance).

You could send two sets of changes of coefficients per setting change. One to where the poles are well within the unit circle and then another back out to the destination filter setting. Then interpolate on the feeble DSP.

$\endgroup$
2
$\begingroup$

The reason why interpolating the coefficients would cause instability is that intermedite set of coefficients values could potentially produce poles outside the unit circle, thus making your filter unstable. Moreover, the values of the coefficients is not linearly related to the parameters of your filter, which means that it's not even going to avoid the clicks.

Another method would be to have look-up tables of coefficients for different frequencies, and then use your friend's method of interpolation between 2 filters.

If it's classical virtual analog filter, you could also use a SVF filter with the "zero feedback delay" topology, which offers the advantage of having only one coefficient to change for each filter's parameter (if you change your Q for example, you would only have to calculate 1 single coefficient). This combined with look-up tables could maybe solve your issue.

Finally, there are other topologies and methods to model virtual analog VCFs that might be more adequate to your problem.

$\endgroup$
6
  • 1
    $\begingroup$ "wavetables of coefficients" - what's that? $\endgroup$ Jul 6, 2017 at 15:10
  • $\begingroup$ My bad, I mixed wavetable and look up tables... just corrected, sorry about that $\endgroup$
    – Florent
    Jul 8, 2017 at 16:50
  • $\begingroup$ there is a Japanese guy that goes by the pseudonym "Clusternote" who is crapping up the english-language Wikipedia articles related to wavetable synthesis and additive synthesis and has inserted his own neologism calling wavetable synthesis "table-lookup synthesis". (i hope you're not that person.) $\endgroup$ Jul 8, 2017 at 17:06
  • $\begingroup$ I'm in tokyo indeed but I'm not japanese and I wouldn't dare edit wikipedia pages! But to be honest, this neologism is fine with me, wavetables are lookup tables after all $\endgroup$
    – Florent
    Jul 8, 2017 at 17:12
  • $\begingroup$ wow. so your not Clusternote, i hope. i have had some Wikipedia run-ins with that person. being in Tokyo, you might run into him. Wavetables are tables with the samples of a waveform in them. and there are some semantic issues because back in the 1990s, Creative Labs used the term "wavetable synthesis" to denote basic PCM sample-playback "synthesis". $\endgroup$ Jul 8, 2017 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.