FROM AGPEDIA — AGENCY THROUGH KNOWLEDGE

Resampling (audio)

Resampling, or sampling-rate conversion, computes a digital audio signal's values at new sampling instants, as when its sampling rate is changed. This needs values between the existing samples. Because an audio signal is assumed to be band-limited below half the sampling rate, Shannon's sampling theorem says it can be reconstructed exactly between them by band-limited interpolation. Methods from computer graphics, such as Lagrange interpolation, cubic splines and Bézier curves, are not ideal for audio, where what matters is whether the interpolation error is audible.[1:1]

Methods

Classical sampling-rate conversion interpolates by an integer factor L and decimates by an integer factor M, so that it can convert by any rational ratio L/M, with a low-pass filter whose cutoff depends on the larger of the two factors. It is less convenient for arbitrary sampling times or for ratios that change smoothly. When the new rate is lower, the low-pass cutoff must lie below half the new rate.[1:2] Without that filter, energy above half the new rate would alias: a frequency just above half the sampling rate appears just below it, a mirror image called folding.[2:1]

Julius Smith's resampling algorithm evaluates a signal at arbitrary times and handles smoothly changing ratios, as in audio scrubbing, by interpolated look-up in a table of low-pass filter coefficients, one table serving every conversion ratio. The ideal low-pass filter's impulse response is infinitely long, so in practice it is windowed to a finite length.[1:3]

In converters and production

Modern converters do most of their anti-aliasing filtering digitally at a very high internal rate and then discard the extra samples.[3:1] A 2012 Xiph.Org essay recounts that some recording consoles once recorded at high sampling rates with only analog filters, leaving the digital anti-aliasing and decimation (resampling to a lower rate, for CD or DAT) to the final stages of mastering, and suggests this may be one early reason why 96 and 192 kHz became associated with professional production.[3:2]

Software

Free resamplers include Smith's own resample (LGPL), Erik de Castro Lopo's libsamplerate ("Secret Rabbit Code"), which uses the same basic algorithm, libresample (used in Audacity), SoX with its libsoxr library, and the Python package resampy. Implementations can be compared at src.infinitewave.ca.[1:4]

  1. ^ ↗ rs-bandlimited ^ ↗ rs-classical ^ ↗ rs-method ^ ↗ rs-software Smith III, Julius O. (2020-09-17). Digital Audio Resampling Home Page. Center for Computer Research in Music and Acoustics (CCRMA), Stanford University. https://ccrma.stanford.edu/~jos/resample/.
  2. ^ ↗ js-aliasing Smith III, Julius O. (2007). Mathematics of the Discrete Fourier Transform (DFT), with Audio Applications. W3K Publishing. ISBN 978-0-9745607-4-8. https://ccrma.stanford.edu/~jos/mdft/.
  3. ^ ↗ xi-oversampling ^ ↗ xi-decimation Montgomery, Christopher (2012-03-01). 24/192 Music Downloads ...and why they make no sense. Xiph.Org. https://people.xiph.org/~xiphmont/demo/neil-young.html.

Wikidata: Q333725

Available in