Slight audio glitch (click/pop) sometimes when dynamically switching between saturation algorithms - can this be avoided?

I’ve got a plugin with a few saturation algorithms to choose from.

As I am playing the audio, I switch between the algorithms to hear the difference each one makes to the sound. More often than not, the switch is smooth, but sometimes there is a slight glitch sound - a click or a pop.

Is there a technique to avoid these audio glitches ?


Well if you can afford processing the two saturation algorithms in parallel for a short amount of time (I’d say about 20ms) then you can crossfade between these two effects and this should smooth out the glitch. You could for instance do this using SmoothedValue:

Hope this helps


Is there a way to set the intial value of the smoothing ? .setCurrentValue(), this isn’t a method in the class of course, but is there something that will do it for me?

        crossfadesmoothingValue.reset(currentSampleRate, 0.02); // Set the ramp time 20 milliseconds

        crossfadesmoothingValue.setCurrentValue(0.0); // Start from 0.0
        crossfadesmoothingValue.setTargetValue(1.0);  // Transition to 1.0

I was looking at this, I think it does the job, but wondering why the combination of setCurrentAndTarget…(), I’m sure there’ll be a reason, just curious.: