Hi everyone!
I have a bit of a problem with smoothing my dsp::Gain in my audio plugin. What I basically would like to achieve is that whenever the buffer is hitting a certain threshold (set by a parameter) of the amplitude (volume) I want the gain to go down and then back up. The time that takes should be determined by another parameter (gain.setRampDurationSeconds()
). The code kind of works but I still get this “glitches” everytime the threshold is reached, kind of as the gainramp only works to lower the volume and not when it is moving back up. Here is the relevant code from the process block:
float sample = *buffer.getWritePointer(0);
convGain.setRampDurationSeconds(*smoothingParameter);
if (abs(sample) > *thresholdParameter) {
convGain.setGainLinear(0);
convGain.process(wetContext);
}
convGain.setGainLinear(1);
I have tried values of the smoothing between 0 and 5 seconds. I can hear some difference, especially between 0 and 1 seconds, but it is still glitchy.
I appreciate all the help and suggestions I can get, thank you for taking your time!
/Patrik