Resampling

From Hydrogenaudio Knowledgebase
Revision as of 09:22, 23 November 2006 by Gigapod (talk | contribs) (→‎References)

Resampling or Sample Rate Conversion

Digital audio is always sampled, which means that any digital audio file is created with a fixed sample rate (and resolution). Redbook Audio CD's sample rate is 44.1kHz (16-bits resolution). Audio on DVDs is sampled at 96kHz (24-bit resolution). Resampling or Sample Rate Conversion is required when one wants to convert a digital audio file (i.e. an analog audio signal that has already been digitized) from a given sample rate into a different sample rate (resolution can stay the same or change). Upsampling (aka interpolation) is the process of converting from a lower to higher sample rate (e.g. from 44.1kHz to 48kHz); downsampling (aka decimation) is the process of converting from a higher to a lower sample rate (e.g. from 96kHz to 48kHz).

Resampling can also be used to describe resolution changes (changes in bit depth, e.g. from 16-bit to 24-bit, or from 24-bit to 16-bit).

Low-quality resampling algorithms, whether upsampling or downsampling, can introduce artifacts which are clearly audible in the resampled audio file. A typical low-quality, but extremely fast resampling algorithm will just be based on linear interpolation. High-quality resampling algorithms use more CPU time, since they require tranlation to the frequency domain. Modern PC processors (~2GHz clock) can easily deal with very high-quality resampling in real time. Sound cards that do resampling in real time require a good DSP.

Resampling is very often required and is in fact part of the audio mastering process for CDs, since professional audio equipment uses 96kHz or 192kHz for masters, whereas the RedBook Audio CD spec uses a 44.1kHz sample rate. Different media are recorded at different sample rates (CD at 44.1kHz, DAT at 48kHz, DVD audio at 96kHz, etc). Digitally mixing different sources sampled at different rates will require resampling to a common rate and resolution.

Many PC audio cards (most notably the 10k1 and 10k2 based Creative Labs ones) and AC97 codecs can only input, output or internally process audio data at 48kHz and forcefully resample any digital audio data at one stage or another. Sometimes the audio software or the drivers will add a resampling step (e.g. ALSA when software mixing, see this thread: ALSA sample rate conversion, ALSA uses a poor-quality linear interpolator).

References