Tech Tip 105 - Cleaning Up Audio Files with Audacity

By Scott Nesbitt

Sunday, Dec. 10, 2006

When you're dealing with audio files, there will be times when you run into a few problems. This is especially true with voice recordings and audio that was converted to a digital format from a cassette tape or a vinyl record.

One of the biggest problems is noise. This could be hissing or background noise like the sound of the wind or even someone inadvertently breathing into a microphone. No matter what the source is, that noise is distracting. While it's difficult to eliminate all of the noise from a digital audio recording, it is possible to clean up the file so that the noise isn't all that noticeable.

I found this out recently when I was helping a friend set up a podcast. He'd recorded the first couple of episodes using his iRiver MP3 player. Unfortunately, the recording was colored by some annoying noise and the occasional sound drop outs. I managed to help him fix his recordings using a tool called Audacity.

Enter Audacity

Audacity is an Open Source sound recorder and editor. It has a number of features that enable you to record, modify, and export audio files. Best of all, Audacity is free and there are versions that run on Windows, Mac OS, and Linux.

While Audacity is a powerful and fairly easy to use piece of software, it's not a professional-level tool. There's a lot Audacity can do, but there's just as much that it can't do. After using Audacity to work on your audio files, you shouldn't expect the quality of audio you get from a store-bought CD. The results, however, will be more than adequate for most purposes.

This article looks at the techniques I used to clean up my friend's podcast using the Linux version of the software. However, the Windows and Mac versions work in the same way.

Getting Going

If you don't have a copy of Audacity installed, download it from the maker's Web site. Since MP3 is the dominant digital audio format, chances are you'll be working with MP3 files almost exclusively. Audacity doesn't, however, have built-in support for MP3s. You can add that support by downloading and installing LAME. LAME is an Open Source audio encoder that creates MP3s. When used in conjunction with software like Audacity, LAME enables the software to import and export MP3 files that are comparable in quality to those produced by expensive commercial encoders and applications.

Get going by starting Audacity. Then, select Project>Import Audio. Find the audio file that you want to clean up and then click OK. Here's what my friend's raw audio looked like in Audacity:

Notice that the audio is represented by a set of densely packed vertical lines called a waveform. The longer portions of the waveform are louder than the shorter portions. This will become important later.

Audacity can import files in several formats. Out of the “box,” it supports .WAV and .OGG (Ogg Vorbis) files, as well as a couple of older and infrequently-used formats. With LAME installed on your computer, you can import MP3 files as well.

It's useful to listen to some or all of the audio beforehand. This will give you an idea of the quality of the recording, and help you plan how to edit the file. It will also help you identify where noise is in the file, which (as you'll soon learn) is a necessary part of cleaning up the file.

After a bit of trial and error, I found that the best results come by using the following two-stage process:

1) Removing Noise

Audacity has a great built-in noise reduction tool. To get it to do its job properly, you need to get your hands a bit dirty. So, first you need to get a noise profile. A noise profile lets Audacity recognize what noise actually is. The profile also gives Audacity a baseline from which to work.

To get a good noise profile, you need to find a section of the audio file in which there's no talking. You can recognize this because it appears as a flat line in Audacity. Several seconds worth of dead air is best. If you don't have that much, use what you can.

By clicking and dragging with your mouse, highlight the noise as shown below:

Then, select Effect > Noise Removal. Click the Get Noise Profile button. Depending on the size of the noise sample that you selected, this can take anywhere from one to a few seconds.

Then, highlight the entire audio file by pressing CTRL+A on your keyboard. Select Effect > Noise Removal again. Move the slider near the bottom of the dialog box to the left (for less) or the right (for more), depending on how much noise you want to remove. Click the Preview button to test your selection out.

I've found that if you move the slider too far to the right, you get a noticeable echo. While the echo replaces the noise that you're trying to eliminate, it too is annoying. With many audio files -- especially ones that are just voice recordings – that moving the slider slightly left of center works best.

When you're satisfied that you've chosen the optimal settings, click the Remove Noise button. Once again, depending on the length of the audio file the noise removal process can take anywhere from a couple of seconds to 10 or 20 seconds depending on your PC.

Test the noise level by playing the entire file. Do this by clicking the Play button on the Audacity toolbar. Remember that what you do isn't permanent. If the result isn't what you expected, undo it by pressing CTRL+Z on your keyboard. Then, repeat the noise removal process with different settings.

At the end of the noise removal phase, you'll find that much (if not all) of the noise is gone. Whatever's left isn't that annoying or distracting. But, you can clean the file even more using an Audacity utility called the Compressor.

2) Evening Out the Sound

Most audio files don't have a uniform volume; there are sections that are louder than others. Audacity can even out the loud and soft sections with its Compressor utility. The Compressor looks at the louder and softer portions of your audio file and then lowers the volume of the louder bits while not touching the softer portions. This is called “dynamic range compression,” hence the name of the utility.

To use the Compressor, first highlight the section of the file containing the sound that you want to even out. Then, select Effect > Compressor.

The Compressor dialog box looks intimidating, but once you get going it is fairly easy to use. Focus on the Threshold setting. The threshold is the maximum amount of volume that the Compressor will tolerate. The threshold is measured in decibels (db). Any bit of audio that is louder than the threshold has its volume reduced.

You should set a threshold somewhere between the loudest and softest parts of your audio. So, if the loudest part is -7db and the softest is -13db, then you should set a threshold of -10db. Set the threshold by clicking and dragging the Threshold slider.

Next, look at the Ratio setting. This sets the level of compression. Usually, the default of 2:1 is good enough for most recordings. There will be times when a higher ratio, like 3:1, might be better. I've never had any reason to set the ratio higher than 4:1.

Leave the Attack Time setting as it is. This just tells Audacity how quickly to apply the compression ratio that you set. The default setting of 0.2 is just fast enough for voice recordings.

Also, leave the Apply Gain after compressing option checked. This will increase the overall volume of your recordings slightly and, in many cases, help alleviate any sound drop outs.

Click the Preview button to test whether or not you chose the right settings. Once you finalize those settings, click OK. The compression process takes several seconds, depending on the size of the file.

As with the noise removal process, test the compression by playing the appropriate section of the file. Do this by highlighting that section and then clicking the Play button on the Audacity toolbar. Remember, you can undo your edits by pressing CTRL+Z on your keyboard. Then, repeat the compression process with different settings.

Going Back to MP3

Once you're satisfied that enough of the noise has been removed, save the audio as an MP3. Just select File > Export as MP3 and select the folder on your computer in which you want to put the file. Then, post it to the Web or move it over to your MP3 player.

Conclusion

You'll need to experiment with Audacity and its tools in order to get the results that you want. It takes a bit of work, but you'll quickly come up with a set of settings and remedies that work for you. Just remember that no two audio files are alike. With each new file that you're cleaning up, you'll need to tweak settings somewhat to get them optimal.

While Audacity isn't a professional tool, it is a very good choice for most audio cleanup tasks. With a little practice, you will become quite adept at using it to make your audio files sound better.

On a more serious note:

If you go to the website LetsSayThanks.com you can pick out a thank you card that Xerox will print and send to a soldier that is currently serving in Iraq. You can't choose who gets it, but it will go to a member of the U.S. armed services. How AMAZING it would be if we could get everyone we know to send one!