Okay, so you want to do interpolation between values. If you're talking specifically about parameter smoothing then one way to approach it would be to set up your control points like so -

<current value> .... parameter smoothing time ... <target value>

Any time the knob value is changed, that changes the target value. If you are working with 4 control points, like cubic interpolation, then use the target value twice, then you've got your current state value, then maybe use whatever the current value was some number of ms ago.

In other words, take the following cubic hermite interpolation function (again using RJS, written for clarity not optimization) -

// from

http://www.xoxos.net/sem/dsp2public.pdf
// xoxos' formula has tension and bias set to 0

function hermite(x0,x1,x2,x3,mu)

instance(a,b,c,d,out)

(

a = ((3 * (x1- x2)) - x0 + x3) * 0.5;

b = x2 + x2 + x0 - (5*x1 + x3) * 0.5;

c = (x2 - x0) * 0.5;

d = mu;

out = ((a*d+b)*d+c)*d+x1;

);

Note that the interpolation is between the values in x1 and x2, and mu is the fractional interval between them.

on knob update

total_samples_until_update = (time_in_ms*0.001*samplerate);

prev_knob_value = current_knob_value;

sample_counter = 0;

frac = 0;

and each sample you could end up calling

current_knob_value = hermite(prev_knob_value,current_knob_value,target_knob_val,target_knob_val,frac);

sample_counter += 1;

frac = sample_counter/total_samples_until_update;

frac = min(frac,1);

So this is just sample code and there is definitely room for optimization, but this should be enough to get you on your way I think. If it was me doing this, I would consider graphing out different results using the different algorithms, whether using a real-time graphical display or via some kind of graphing utility.

If the end result is a presentation then the idea to graph out different functions with different interpolation algorithms is a good one. Including a spectral analysis of the result would be pretty boss, too, that way you could show why when quality is a factor you might use a 6-pt 3rd order interpolation algorithm rather than linear interpolation. You could even go one further and list the number of operations in each function to give another order of comparison, or the execution time of running each algorithm 1000 times, stuff like that.

I suggest checking out Oli's PDF on interpolation for some good examples of different algorithms. Keep in mind that his "optimal" algorithms don't preserve the control points, so are basically useless for this type of thing.

http://yehar.com/blog/wp-content/upload ... 8/deip.pdf