DC offset removal

I’m running some extremely noisy signals through a bunch of ugens. Eventually, there’s an signal that accumulates somewhere, and I assume that’s from the feedbacking. I’ve asked this before, but, would a final dc offset stage work, or should one tackle this earlier in the audio pipeline?

I’ve got a leakdc within the feedback loop and it seems to help at the expense of some truly awesome but terrible noise.

My intuition is generally that early an early LeakDC is better than a late-stage one, since the DC is magnified by feedback and thus the correction later in the signal chain has to be greater. But the place where this can become very sensitive is cases where you have amplitude-based UGens - anything nonlinear like a tanh, clip, etc., which will sound drastically different depending on the DC offset of the signal.

Something I’ve done occasionally (with some success) in this kind of signal chain is to link several LeakDC’s to a single parameter, which makes it easier to find a sweet-spot in terms of the sound I want to generate. A somewhat simplistic example:

    dcBlend = \dcBlend.kr(0);
    sig = blend(sig, LeakDC.ar(sig), dcBlend.lincurve(0, 1, 0, 1, -2));
    sig = CombC.ar(sig, 1, 1/220, 1.3);
    sig = blend(sig, LeakDC.ar(sig), dcBlend.lincurve(0, 1, 1, 0, -2));
    sig = sig.tanh

In this case, the \dcBlend parameter will effectively crossfade between an early and late DC filter, which can drastically change the signal going in to your tanh (the lincurve is there because in my experience this parameter might need a slightly different mapping at different stages of the signal chain).