When to use LeakDC

Hey,
can someone explain me the concept of LeakDC and when it should be used, as it has a huge impact on the sound of following SynthDef. I have used it for other FFT Ugens and Wavetables before, so I thought it would be a good idea to implement it here as well, but its removing all the “good stuff”:

SynthDef(\drums, {
	arg atk=0, sus=0, rel=3, c1=1, c2=(-1),
	buf=0, rate=1, spos=0, freq=440, pan=0, amp=1, out=0, 
	rect=0.5, sBelow=1.2, sAbove=0.25, thresh=25, ffreq=8500;
	var sig, chain, env, lfo;
	env = EnvGen.kr(Env([0,1,1,0],[atk,sus,rel],[c1,0,c2]),doneAction:2);
	lfo = SinOsc.kr(0.2, [0,0.5pi], 0.0024, 0.0025);
	sig = PlayBuf.ar(1, buf, rate * BufRateScale.ir(buf),startPos:spos);
	sig = Select.ar(sig.ceil, [sig.abs * rect, sig]);

	chain = FFT(LocalBuf(512), sig, 0.25);
	chain = PV_Compander(chain, thresh, sBelow, sAbove);
	sig = IFFT(chain);
	//sig = LeakDC.ar(sig);

	sig = DFM1.ar(sig, ffreq, type:0);
	sig = DelayL.ar(sig, 0.1, lfo, 0.5, sig);
	sig = SoftClipAmp8.ar(sig, 0.5);
	sig = Pan2.ar(sig, pan, amp);
	sig = sig * env;
	sig = sig + NHHall.ar(sig, 0.2);
	sig = Limiter.ar(sig, 0.999, 0.05);
	Out.ar(out, sig);
}).add;

I’m not totally sure, but I can guess, because I’ve hit myself with the same problem before… SoftClipAmp is a waveshaper, and so is heavily dependant on the level of the signal. The same signal with DC offset of 0.5 vs 0.0 will achieve radically different results. If the signal coming out if your FFT process has a lot of offset then the LeakDC would for sure change the output from the SoftClipAmp.

LeakDC is a filter - I’m not sure exactly what the implementation uses, but it’s effectively a very low frequency high-pass filter.

thank you @scztt
ive now put it at the end of the chain and receive totally different results but in my taste.

	sig = LeakDC.ar(sig);
	Out.ar(out, sig);

Do you also know how exactly the hop value of the FFT is influencing the compression?