Interpolation
Interpolation
Types
Nearest neighbor
Linear
Use the two points around the desired point
Assume the signal is a line between these two points to determine the new point
A technique to reduce the time to calculate interpolation, the difference between table points can be pre-computed
images from
paulbourke.net > Miscellaneous > Interpolation
Cosine
Half cosine functions fill the space between the known points
Polynomial
Quadratic
Use three points to estimate the missing one
However, this makes the selection asymmetric, as two points must be chosen on one side and one on the other
For this reason, in audio Cubic interpolation is more common
Cubic
Construct a polynomial with four points around the desired one.
crca.ucsd.edu > Msp > Techniques > Latest > Book-html > Node31
paulbourke.net > Miscellaneous > Interpolation
Higher order
Possible although gains are not worth the increase in computation cost
Allpass
Not useful for random access
Only for forward moving lookup
https://ccrma.stanford.edu/~jos/pasp/First_Order_Allpass_Interpolation.html
Windowed sinc
"Analog" interpolation, through a mechanism equivalent to ADC and DAC again at the new sample rate.
Bandlimited!
But very expensive computationally
Typically used fro resampling where highest quality is needed
Resampling factor must stay constant
https://ccrma.stanford.edu/~jos/pasp/Theory_Ideal_Bandlimited_Interpolation.html
Many other types, but these are the most commonly used for audio
Spline
Curvature between points can be described throough the derivative (slope) at the point and the second derivative (change in slope) to each side
Catmull-Rom splines
double a0,a1,a2,a3,mu2;
frac2 = frac*frac;
a0 = -0.5*y0 + 1.5*y1 - 1.5*y2 + 0.5*y3;
a1 = y0 - 2.5*y1 + 2*y2 - 0.5*y3;
a2 = -0.5*y0 + 0.5*y2;
a3 = y1;
return(a0*frac*frac2+a1*frac2+a2*frac+a3);
paulbourke.net > Miscellaneous > Interpolation
Generic. Polynomial interpolation is a particular case of spline interpolation
Comparison
paulbourke.net > Miscellaneous > Interpolation
Considerations
Speed vs. presicion
Interpolation application
band-limited or just smooth?
Random access vs. linear access
Looping vs. one shot
Cross-fades?
Implementations
Gamma
Gamma/ipl.h
Many different types
CSL
https://svn.mat.ucsb.edu/svn/CSL/CSL/Sources/Oscillator.cpp
Truncation and Linear
Csound
Many types
Oscillators typically end in 'i' to indicate linear interpolation and in '3' to indicate cubic interpolation
Some ugens like tablexkt can do sinc interpolation
SC
Osc - linear interpolation
Deltas are stored within the buffer class
BufRd offers linear or cubic interpolation