Audio Interpolation

Audio interpolation is a method of making digital audio sound better than it really is. These days, almost every digital playback device (CD players*, digital receivers, sound cards, et cetera) uses interpolation to improve your listening experience. And with computers ever increasing in speed, it's now possible to use software implementations as well without a serious decrease in performance.

So how does it work?  Well first let's review how sound is digitized.

As a sound wave enters an ADC (analog to digital converter) samples are taken at timed intervals.  Higher sample rates produce better recordings, but also use more memory.   So, despite the drawbacks of lower quality, people sometimes use lower sample rates to conserve space.

The following is a 1046Hz sine wave (C above high-C?) being sampled at 8kHz.  The black dots represent the samples.

Audio sampled at 8kHz

For this example, our sound source is sampled at 8kHz, but our output device is set to 32kHz.  To play back the 8kHz source, we can send each sample four times, like so:

Expanded to 32kHz

This works effectively, but if we look at the actual sound wave being output, we see that there is a vague resemblance to the original.  Also notice the hard edges after each sample.  This is what gives lower sampled audio that static sound.

Output at 32kHz

What interpolation does is instead of repeating each sample it creates new samples between the originals.  Thus a smoother wave form is output.  There are different methods that can be used, but the easiest is linear interpolation.  This method takes two samples and creates new samples between them that change at an even rate.

Linear Interpolated Output at 32kHz

Here we can see that interpolation creates a wave that's closer to the original.  The problem with linear interpolation is that it makes straight lines between each sample, and sound waves don't follow straight paths (with the exception of synthesised sounds like a sawtooth).  Is it possible to recreate the natural curves of the sound wave?  Yes, to an extent.  To illustrate another method, I'm going to keep the same situation (a 1046Hz sound wave sampled at 8kHz), but use a more complicated sound wave, i.e. a guitar.  The first image is the original sound with markers placed at the sampling points.  The second is the playback with linear interpolation.

Guitar Sampled at 8kHzLinear Interpolation

Cubic interpolation is basically an algorithm that tries to reproduce a more natural waveform by "bending" the interpolated points around the original samples.  I won't go into the details of the mathematics of how it works, but you've probably seen this method before.  Almost all graphic and drawing programs have a spline tool where you lay down points that are then connected by means of a curving line.  This same method can be applied to audio by using the samples as points on a plane.

Cubic Interpolation

Though cubic interpolation is a better method than linear, it still doesn't completely reconstruct the wave.  Peaks that are lost between samples during digitizing are lost permanantly.

I hope that makes audio interpolation more clear. If you'd like to see some better examples, Here are some larger clips that show more detail.

*CD players often sport labels that say "8x Oversampling". This term means nothing more than that the CD player upsamples and interpolates the original 44.1kHz PCM data.

Copyright © 1999,2004 Alpha-II Productions