How to implement SmoothedValue with DSP Compressor

i have been test running DSP module and building Reverbs, Compressors etc. All works well bar one specific thing, dragging the slider in a DAW causes slight crackling. I thought it may have something to do with sample rate so i ensured my DAW and my plugin used the same (48,000) sample rate. This unfortunately did not fix the issue.

I have been searching and found that the juce framework has a “SmoothedValue” that can be used to fix this issue, i just don’t know how to actually implement it correctly.

here is how i am updating my values in processBlock:


    juce::dsp::AudioBlock<float> block(buffer);
    juce::dsp::ProcessContextReplacing<float> replaced(block);


if for example i use:

    juce::SmoothedValue<float, juce::ValueSmoothingTypes::Linear> smoothing;

then how to i implement this into my compressor.setPARAM() function?

the idea of smoothedValue is that instead of instantly updating the dsp processors’ values to the new parameter values, the parameter values run through some sort of filter that slows down their rate of change to prevent crackle. if set up correctly it will give you a unique value for each sample of each block, rather than just one parameter value per block. this sort of “parameter signal” can be feed forward to your dsp processors then

yes sorry, i think you may be confused, i am asking how can i implement this function rather than what it is. hopefully this clarifies things @Mrugalla

i have not used it myself yet but according to the docs whenever you wanna let something go to a new value (parameter change) you call reset with the length in samples, how long it takes to go there, and setTargetValue for where to go. then you can just just call getNextValue() for each sample in your sample loop and forward the resulting value to your dsp objects