Compressor implementation details

DSP, Plug-in and Host development discussion.
Kraku
KVRian
1469 posts since 13 Oct, 2003 from Oulu, Finland

Post Sun Oct 17, 2021 1:37 am

What's the best approach to implement a compressor? I.e. when the envelope generator/detector circuit decides to start gain reduction, it can be at any sub-sample location. What's the best approach to find that location and act accordingly? Is oversampling the best option combined with some linear interpolation/solving for the "accurate enough" location? Or would something more complex be a better approach?

What about if there's some non-linearities in the signal before the volume level detector circuit? Like in Empirical Labs Distressor: right after the VCA the signal goes to distortion/saturator circuit and from there it goes to detector/envelope generator. Obviously with tons of oversampling and with a delay in the feedback loop it becomes a "trivial" problem to solve, but I doubt that's anywhere near the best approach, especially when you need to apply antialiasing to the saturator/distortion after the VCA and to the VCA itself during the gain reduction... Maybe something more along the lines of a ZDF approach would work the best?

mystran
KVRAF
6593 posts since 12 Feb, 2006 from Helsinki, Finland

Post Sun Oct 17, 2021 10:10 am

Why'd you even need the sub-sample location? I mean.. yes, you want to avoid aliasing somehow, but that seems like the same problem as avoiding aliasing in any other non-linear filter.
Preferred pronouns would be "it/it" because according to this country, I'm a piece of human trash.

Kraku
KVRian

Topic Starter

1469 posts since 13 Oct, 2003 from Oulu, Finland

Post Sun Oct 17, 2021 11:31 am

I don't know. I haven't actually tried writing the compressor algorithm yet. Currently it feels in my mind like it's fundamentally different to regular non-linear ZDF filter algorithm, due to there being IF statements in the envelope generator etc.

Hmm, then again the envelope generator always acts quite slow, so maybe that part can have the 1 sample delay and keep the VCA/saturator/distortion circuit in the ZDF land... And now that I think of it, there isn't going to be any kind of feedback in that circuit either, unless I'm mistaken...

So the only hard part seems to be figuring out a suitable method for antialiasing the saturation/distortion I was thinking of adding after the VCA. It's starting to sound like regular 2x oversampling will do the trick.

Return to “DSP and Plug-in Development”