It looks like the juce compressor makes a step in gain when env hits the threshold (threshold = 0.5 and ratio = 2 for example).
// Ballistics filter with peak rectifier
auto env = envelopeFilter.processSample (channel, inputValue);
auto gain = (env < threshold) ? static_cast<SampleType> (1.0)
: std::pow (env * thresholdInverse, ratioInverse - static_cast<SampleType> (1.0));
return gain * inputValue;
Can someone explain how this works and what I’m missing?
I did a deep dive on this recently, what do you want to know, exactly?
Are you getting at it’s triggered by env, instead of straight up input, as you might expect?
Thanks for the reply. I made a mistake when I plotted the function for verification. All ok now. It looks like this for threshold 0.5 and ratio 2:
I wonder why we didn’t take a linear function. Is it because of decibels or because it should not cross zero?
Also, do you have an idea how we can make a smooth knee?