Changing Sample Rate Makes Export Lose Data

Okay, so this occurs in Audacity 3.3.3. We have an example.wav file that reaches EXACTLY 8 kHz in a spectogram.

If I change the sample rate to 16 kHz and export it as a lossless format (WAV or FLAC), the audio no longer reaches exactly 8 kHz but a little less, so it looses data instead of being a lossless export:

The audio MUST be filtered before down-sampling to prevent aliasing (“false frequencies”).

There are no perfect “brick wall” filters so you have to start rolling-off before you get to the cutoff frequency.

The Nyquist limit of half the sample rate is a true-limit and if you were to allow aliasing you could go exactly up to the limit but that’s not done by competent programmers.

1 Like

Thanks for the answer. I’m a complete noob at this, if I downsampled that audio to a sample rate higher than the limit, let’s say from 22.050 kHz to 18 kHz, will I have aliasing aswell? And how do I filter the audio?

Audacity uses a code library called soxr to resample audio. This is a very high quality resampling library (one of the best). When reducing the sample rate, soxr automatically filters out frequencies that are above half of the new sample rate (half the sample rate is called the “Nyquist frequency”). This is necessary because frequencies above half of the sample rate cannot be correctly represented in digital form. No user interaction is required - the filtering is necessary and automatic.

When filtering, there are a number of trade-offs. If the filter is too steep it causes ringing near the filter’s corner frequency, which has a detrimental effect on the transient response. If the filter is not steep enough, it will either let through some frequencies that are higher than the Nyquist frequency, which causes “aliasing distortion”, or it will reduce the level of frequencies that are just below the Nyquist frequency. Ideally the anti-aliasing filter should have a “brick wall” cut off at the Nyquist frequency, with a totally flat response from 0Hz (DC) to the Nyquist frequency, and no ringing, and a totally linear phase response. It should also be very fast (no delay). Unfortunately it is impossible to exactly match the requirements of an “ideal brick-wall filter”, but modern “Sync filters” (such as used in soxr) can get very close to it.

In this image we can see Audacity’s (soxr) resampling stops a little bit short of the Nyquist frequency (the line does not go quite to the top, whereas the ProTools 2021 filter allows a little aliasing distortion (the line “bounces back” from the Nyquist frequency. The dark blue (rather than black) background to the ProTools version is noise, which is most likely due to 24-bit samples compared to Audacity’s 32-bit samples.

Note that these images are extremely discerning and shows up the tiniest deviations from perfection. The ProTools plot is actually very good, though not quite as “ideal” as Audacity’s resampling.

(Images from:

1 Like

Thanks for the reply and thanks for the explanation. Good to know SOXR automatically filtered the audio when I downsampled it (mostly because I downsampled more than 100 audio files from old flash games).