Parameter smoothing
Sometimes its nice to have your sliders change gracefully so as to not cause abrupt changes to the sound. One example usage is minimizing zipper noise when changing the frequency of an oscillator. This is a simple one-pole parameter smoother.
Code:
coff = exp(-1/(ms/1000*srate));
function singlepole(in,target,coeff)
(
in*coeff + target*(1-coeff);
);
an example usage could be (assuming that slider1 controls the frequency, say)
Code:
smooth_coeff = exp(-1/(20/1000*srate)); // 20 ms
@sample
freq = singlepole(freq,slider1,smooth_coeff);
Obviously there are different ways to code it, but that's the basic idea. You could also put it in a @block if you wanted, you'd just have to tweak the code a bit.
Code:
smooth_coeff = exp(-1/(ms/1000*srate/samplesblock));