How to Stop Clicks When Changing / Turning On a Delay Synth

Hi everyone:

I have a DSP question. I’m getting click sounds whenever I switch to a new delay duration quickly, or quickly turn on the synth with a gate. I’ve attached a recording of both examples.

Anyone have any advice on how to stop this? I tried changing envelope times in the second attempt but no luck. Thanks!

Example 1: First Half of the Recording:

SynthDef("delay", {
	arg duration=1/2;
	var input,delay;
	input =; // Takes in Dry Mic Output Channel
	delay =
		maxdelaytime: 4,
		delaytime: duration,
		decaytime: 4,
		mul: 0.5);
	//duration.poll;,delay); // Send to Bus 11...Called  "Delay Bus Out Channel";

~delay_synth  ="delay",[\duration,~half],target:~delay_group);

Example 2: Second Half of the Recording:\delay1, {
	arg in=0, out=0,mul = 0,gate=0,attackTime=3.5;
	var sig,env, amp_env;
	sig =, 2);
	sig =
		maxdelaytime: 1,
		delaytime: 1/6,
		decaytime: 4,
		mul: mul,
	env =
		attackTime: attackTime,
		decayTime: 0.5,
		sustainLevel: 1,
		releaseTime: 3,
		peakLevel: 1.0,
		curve: -4.0,
		bias: 0.0),

	sig = sig * env;, sig);

["/s_new",["delay1", 300,0,delay_group, "in", delay1_bus_index, "out", 0,"gate",1,"mul",1.0]],

A couple of suggestions:
Add a Fade In envelope to the input signal

// input =; // Takes in Dry Mic Output Channel
input =, 1, 1) *; // added fade in envelope

Add Lag or Ramp to the delay time

delaytime:, 1), // added Ramp
// delaytime:, 1), // added Lag


1 Like

Thanks for the response! I’m going to play around with it tomorrow and report back!

@TXMod worked like a charm. thanks you a million times!

Also check out XFadeDelay from wslib:

1 Like