Sampling — Interpolation: Reading Between Samples
Our sampler can read its buffer at 0.5×, 0.944×, 1.5× or almost any other rate. But that creates a new problem: the read head often lands between stored samples.
1. Samples exist at discrete positions
The dots below are stored sample values. Drag the dots vertically to reshape the tiny waveform, then drag the READ POSITION marker horizontally.
2. Three ways to answer “what is at 3.4?”
| Method | Idea | Behaviour |
|---|---|---|
| Nearest neighbour | Use whichever stored sample is closest. | Very simple, but the output jumps abruptly from one value to the next. |
| Linear interpolation | Draw a straight line between two neighbouring samples. | Cheap, intuitive and much smoother. |
| Cubic interpolation | Use neighbouring points to estimate a smoother curve. | A practical local compromise: smooth, inexpensive and often visually convincing. |
| Sinc interpolation | Reconstruct from weighted sinc functions centred on the stored samples. | The ideal band-limited reconstruction model; practical audio systems use finite/windowed approximations. |
Here f is the fractional distance between the two stored samples. At position 3.4, we are 40% of the way from sample 3 to sample 4.
3. Animate the read head
Now let the read position advance automatically. The rate controls how far the read head moves on each step.
4. Interpolation is not time stretching
This distinction matters. Interpolation helps a sampler produce sensible values at fractional read positions. It improves the process of resampling, but pitch and duration are still coupled.
5. Next: break the pitch–duration relationship
What if we want the pitch to move while the duration stays the same, or stretch a recording without lowering its pitch? That requires a different strategy: working with chunks, windows, overlap, spectral information or grains rather than simply moving one read head through the buffer faster or slower.