8
$\begingroup$

I'm implementing a digital audio delay effect using a simple circular delay line. Changing the delay time by making the delay line longer or shorter introduces discontinuities in the audio signal, resulting in clicks.

What would be the best (most pleasing for the ears) strategy to avoid such clicks when changing delay time?

$\endgroup$
1
  • $\begingroup$ Changing the delay time causes discontinuities as the pointer suddenly jumps to a different index in your circular buffer (delay line). A sudden jump in the waveform causes these click. You can try smoothing out these jumps every time the user changes the delay setting on the delay line. See the RemoveClicks() function here: github.com/audacity/audacity/blob/master/src/effects/… $\endgroup$
    – Atul Ingle
    Commented Jan 12, 2017 at 20:28

3 Answers 3

8
$\begingroup$

If you are not changing the delay length very often, and you don't want to have a Doppler effect that comes from continuously changing the delay length, then try a cross-fade. Both delay lengths should be running simultaneously for a moment, and you would fade the old one out while fading the new one in.

$\endgroup$
2
  • $\begingroup$ Was about to suggest interpolating/decimating temporarily to change the delay, but that would have had the frequency change. Still sounds like an interesting choice - like speeding up/slowing down an LP. $\endgroup$ Commented Jan 12, 2017 at 23:46
  • 2
    $\begingroup$ That can be musically pleasing/useful, too, and appropriate for continuously changing delay control. It needs a fractional delay line with interpolation. $\endgroup$ Commented Jan 13, 2017 at 8:08
4
$\begingroup$

The problem here is a discontinuity in the signal, which results in the click you're hearing. A possible solution is to make the delay variation as smooth as possible so that step-like discontinuities are avoided. If $x(n)$ represents the signal associated to the delay-line control (e.g. a knob) and $y(n)$ represents the signal associated to the effective change in delay that you allow, a possible relationship between the two could be: $$ y(n) = \alpha x(n) + (1 - \alpha) x(n-1) $$ with $0<\alpha<1$. This is a computationally inexpensive way of low-pass filtering $x(n)$.

$\endgroup$
2
  • 2
    $\begingroup$ You mean $y(n-1)$ rather than $x(n-1)$ right? $\endgroup$ Commented Jan 13, 2017 at 7:53
  • $\begingroup$ In my experience that doesn't work. If you just have a simple delay line you still need to quantize the delay value to an integer multiple of the sample time. Even one sample delay changes cause audible zipper noise. $\endgroup$
    – Hilmar
    Commented Jan 13, 2017 at 12:48
4
$\begingroup$

If you have a continuously varying delay like, for example, a chorus or flanger, you need a to implement a time varying fractional delay in addition to your regular (integer) delay line.

If you only need to change the delay occasionally in discrete steps, a cross fade will work fine.

$\endgroup$

Your Answer

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

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