From Hydrogenaudio Knowledgebase
Jump to: navigation, search

Resampling or Sample Rate Conversion[edit]

Digital audio is always sampled, which means that any digital audio file is created with a fixed sample rate (and resolution). Red Book 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.1 kHz to 48 kHz); downsampling (aka decimation) is the process of converting from a higher to a lower sample rate (e.g. from 96 kHz to 48 kHz).

Changes in bit depth, e.g. from 16-bit to 24-bit, or from 24-bit to 16-bit, may be performed at the same time as resampling, but care should be taken to avoid conflating the two principles. Resampling or the more specific terms upsampling or downsampling usually mean sample rate conversion only.

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 translation to the frequency domain. Modern PC processors (~2 GHz 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 Red Book Audio CD spec uses a 44.1 kHz sample rate. Different media are recorded at different sample rates (CD at 44.1kHz, DAT at 48kHz, DVD audio at 96 kHz, 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).