View Single Post
Old 10-09-2014, 10:20 PM   #60
SaulT
Human being with feelings
 
Join Date: Oct 2013
Location: Seattle, WA
Posts: 769
Default

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));

Last edited by SaulT; 10-09-2014 at 10:33 PM.
SaulT is offline   Reply With Quote