What Is Audio Resampling? How to Change Sample Rates Safely
Learn how resampling changes a digital audio sample rate, why filtering limits aliasing, and how to convert 44.1 kHz to 16 kHz with Python.
Short answer
Audio resampling changes the sample rate of a digital recording by calculating values for new sample times. Changing only the metadata number changes playback speed and pitch. When reducing the rate, a low-pass filter must reduce content above the new Nyquist frequency. SciPy resample_poly librosa
What changes
The sample rate is samples per second. Converting 44,100 Hz to 16,000 Hz reduces samples per second while keeping playback duration about the same. The ratio simplifies to 160/441. Resamplers combine upsampling, low-pass filtering, and downsampling; SciPy’s resample_poly uses polyphase filtering. SciPy
At 16 kHz, the Nyquist limit is 8 kHz. Higher content that is not sufficiently removed can fold into false lower frequencies, called aliasing. Filtering reduces this risk, but removed frequencies cannot be recovered. librosa
Example: 44.1 kHz to 16 kHz
Requirements: Python, SciPy, SoundFile. This reads float audio, retains channel layout, and writes a separate 16-bit PCM WAV without overwriting the original.
import soundfile as sf
from scipy.signal import resample_poly
x, original_rate = sf.read("input.wav", dtype="float32", always_2d=True)
if original_rate != 44100:
raise ValueError(f"Expected 44100 Hz input, got {original_rate} Hz")
y = resample_poly(x, up=160, down=441, axis=0)
sf.write("output_16000.wav", y, 16000, subtype="PCM_16")up=160 and down=441 apply 44,100 × 160/441 = 16,000. axis=0 selects samples and processes channel columns separately. The output is 16 kHz PCM WAV quantized to 16-bit PCM. This example does not replace a model’s input requirements.
Verify and recover
Reopen the output and confirm 16,000 Hz and the intended channel count.
Check that playback durations are nearly equal; rounding and filter boundaries can slightly change sample count.
Listen for gaps, speed changes, or severe noise. Check the model’s documented channel, encoding, and rate requirements.
If only metadata changed, start from the original and resample. If downsampling adds distortion, return to the original and use suitable filtering. If a model rejects the file, also check channel count, PCM encoding, bit depth, and container. SciPy assumes zero beyond finite input boundaries by default; padtype can change that assumption. Listen to the converted file. SciPy
Keep the original and verify output properties and receiver requirements so the conversion is traceable.