If you found this page useful perhaps you might like to join WSRS, click here to find out more

Technical Note: Audacity resampling

Audacity is an open source free editor, which runs on all three of the common operating systems in use today. This technical note arises from the observation by WSRS member Roger Boughton that resampling in Audacity audibly impaired signal quality, and its performance was measure to see if this observation correlated with any objective measurements. This is not a criticism of Audacity in itself - the program is free, and provided its limitations are known about and you work around them you can achieve excellent results.

Recordists starting out need three basic functions of an editor -

  1. Trimming - removing parts of the recording before and after the wanted sound
  2. Volume adjustment - bringing quieter recordings up to the required volume level, as you often need to give a lot of headroom in recording
  3. Resampling - where the original recording was not made at 44.1kHz the sample rate needs to be converted to that so it can be put on CD (which only accepts 16-bit 44.1Khz stereo recordings)
Audacity is well suited for the newcomer, as it performs the first two basic functions of trimming out unwanted parts of your recordings and controlling signal levels efficiently and without significant audible effects other than the desired result.

Sample rate conversion, a.k.a. resampling, however, is a different matter. There are very serious deficiencies in Audacity's sample-rate conversion, which mean you should avoid resampling with it. In practice it means if you are recording for CD distribution, then set your recording sample rate to 44.1 kHz. HiMD recordists are already set correctly and can't even change that. Users of solid state recorders should switch their recorders to record at 44.1kHz. Alternatively use Audacity to edit at the recorded sample rate and do not change the project sample rate to 44.1. So if you record at 48kHz then export the project at 48kHz.

Nearly all computer sound cards internally resample to 48kHz on the mixing bus. If you wish to perform listening tests on Audacity's resampling compared to others you should burn the 44.1kHz results to a CD and use your hifi, unless you have taken the steps to configure your computer audio playback to avoid sound card resampling. This is not possible with the majority of computer audio cards.

You can get Audacity from http://audacity.sourceforge.net/. The following tests were performed using Audacity 1.2.6. and the old Syntrillium Cool Edit 2000 program, dating from 1999 or so, and Adobe Audition 1.5.

Resampling measurements

Cool Edit 2000 was used to generate 10 seconds of 7kHz tone. RightMark Audio Analyser was used to run a spectrum analysis with the default 2.9Hz resolution (2.7Hz for the 44.1kHz samples later).

spectrum plot of original 7kHz tone

Fig.1: spectrum plot of original 7kHz tone

Cool Edit was then used to downsample this signal to 44.1kHz and saved, using the highest quality setting (999). RightMark was used again to plot the spectrum. The result is as it should be - no obvious differences other than a slight increase in noise level. 

spectrum plot of CE2k resampling

Fig.2: spectrum plot of CE2k resampling

Adobe bought Syntrillium and built on the program, releasing it as Adobe Audition. The test was repeated with Audition 1.5, this time comparing the lowest quality resampler setting of 30 on the left channel and highest quality at 999 on the right. (This was achieved by creating two 44.1kHz files one at 30 and one at 999, and pasting the left channel of the 30 quality file into the left channel of the 300 sample). You can see some spurs in the low quality trace but even at the low quality setting the result is serviceable.

spectrum plot of CE2k resampling

Fig.3: spectrum plot of Audition 1.5 resampling at lowest quality of 30 (white trace) and highest quality of 300 (green trace).  

The exercise was repeated using Audacity, importing the original 48k sampling rate file into a project, setting the project sample rate to 44100 and exporting the project to a wav file. Under Edit -> Preferences, both real-time and high-quality sample rate converters were set to High-quality sinc interpolation. Clearly the result is not right, and a large number of spurious tones have appeared.

spectrum plot of Audacity resampling

Fig.4: spectrum plot of Audacity resampling

By copying the right-hand channel of the resampled Audacity wav into the right-hand channel of the resampled Cool Edit wav and running this through Rightmark a direct comparison was possible.

spectrum plot of Cool Edit vs Audacity resampling

Fig.5: spectrum plot of Cool Edit (L) vs Audacity (R) resampling

The obvious charge to this method is that the tone may not be dithered and that the essential difference between CoolEdit and Audacity is that CE correctly adds dither to resample where Audacity does not. In real wildife sound recordings the system noise will in practice always add dither. So white noise was generated using CoolEdit at 48kHz sampling rate at added at about -60dB to the left- hand channel of the tone. This was then resampled in Audacity as before. The result is shown below, and clearly the spurious signals are not reduced by the addition of what would be a quite outrageously high level of dither in practice. This implies a fairly serious issue with the resampling algorithm and therefore resampling should be avoided in Audacity until this is improved.

spectrum plot of Cool Edit vs Audacity resampling

Fig.6: spectrum plot Audacity dither (L) non-dithered (R) resampling

Some readers may wonder whether this would be visible in a sonogram, so I used Cornell's Raven Lite 1.0. Experienced users of the program will observe I had to adjust the contrast down a little bit from the default 50 to 40 to show the spurious tones, but they are there, and could appear under normal usage of the program, and are curiously enough not harmonically related to the 7kHz tone.

sonogram of Cool Edit vs Audacity resampling

Fig.7: sonogram of Cool Edit (L) Audacity (R) resampling


Do not resample in Audacity by setting the project sample rate other than that of the constituent wav files

a corollary of this is keep constituent wav files of a project all at the same sample rate wich should be the same as that of the project.

Open source projects by their nature are continuously developed. These tests were made in January 2007 using Audacity 1.2.6. on the Windows platform (XP Pro). I provide the test signals below so that you can repeat the tests to confirm if this reservation is still valid - or if your own audio editor resamples adequately. (right click and Save As)

Sample Rate conversion - alternatives

If you are in the market for quality free resampling, you can take a look at Shibatch Sampling Rate converter (SSRC) using google - this command-line utility delivers the following result. One source of SSRC at the time of writing is http://www.videohelp.com/tools?tool=SSRC

spectrum plot of SSRC

Fig.7: spectrum plot of SSRC resampling using SSRC 1.30 and command line
ssrc --rate 44100 --dither 2 7khz_48k.wav out.wav

Using this you could edit your files in Audacity at the original sampling rate and save at the original sampling rate, and convert the final result to 44.1kHz for output to CD.


Back to Editing

Useful links

  1. http://audacity.sourceforge.net/ Audacity
  2. http://www.adobe.com/products/audition/ Adobe Audition
  3. http://audio.rightmark.org/ RightMark Audio Analyzer
  4. http://www.birds.cornell.edu/BRP/Raven/Raven.html Cornell Raven

Valid XHTML 1.0 Transitional Valid CSS!