Feedback Compressor

How do I create a feedback leg for a compressor’s detector? I can’t seem to figure out how to do it.


Depending on how you mean that question, you can’t figure it out because it’s impossible to do! (At least not the same way it works for analog circuits.)

A compressor with a feedback topology means you are feeding the output of the gain reduction process into the detector. But you can’t know the output of that gain reduction process, for a given input sample, until you have told that value to the detector circuit to begin with. So trying to do a feedback loop with digital signals creates a paradox of sorts.

The first workaround that comes to mind is to just use the output from the previous sample n - 1 to feed the detector for the current sample n (and for your very first sample where there is no n - 1, you just feed it a zero). Given the slowish speed of compressor attack times, the detector’s reaction time is going to be much slower than 1 sample anyways.

However, I recall that feedback compressor plug-ins will often report having 1 sample of latency to the DAW, and now I’m forgetting why that is… you wouldn’t need to report latency if the 1-sample lag is just in the detector’s sidechain.

That’s great! Thank you for clarifying for me.

I have another basic question: how do I delay the side chain signal by one sample, and feed the first sample as a zero?

I just meant something simple, like making this a Processor member:

float lastOutput = 0.0f;

And then within the processBlock where you’re looping through the input buffer sample-by-sample:

  1. feed lastOutput to the compressor’s detector sidechain
  2. feed the current sample from the input buffer to the compressor’s signal input
  3. take that result from the compressor and save it to lastOutput (in addition to writing it to the output buffer or whatever else you’re doing with it)

Sorry if that’s a little vague, it’s hard to be more specific without seeing code of how you’re approaching organizing the processing.

1 Like