# Avoiding clicks with changing biquad coefficients

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. 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?

• 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? – Juha P Jul 6 '17 at 10:48
• 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. – robert bristow-johnson Jul 6 '17 at 15:07

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.

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.

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.

• "wavetables of coefficients" - what's that? – robert bristow-johnson Jul 6 '17 at 15:10
• My bad, I mixed wavetable and look up tables... just corrected, sorry about that – Florent Jul 8 '17 at 16:50
• 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.) – robert bristow-johnson Jul 8 '17 at 17:06
• 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 – Florent Jul 8 '17 at 17:12
• 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". – robert bristow-johnson Jul 8 '17 at 17:13