Noise Removal

From Audacity Wiki
Jump to: navigation, search
Audacity's Noise Removal effect can be used to attenuate constant background noise such as tape hiss, electric fans or hums. It will not work very well for removing talking or music in the background. There are two steps:
  • Show Audacity a "noise profile" - a short section of audio containing only the noise to be removed
  • Return to the effect to apply the noise profile to all the audio.
 
Related article(s):


Contents

Audacity Noise Removal

How does it work?

Audacity's Noise Removal effect is in essence a multi-band digital noise gate, automatically shaped by the Noise Profile you supply.

In other words it looks at the noise sample, works out what the noise floor is in each of the frequency bands, and uses this as the threshold for a bank of noise gates.

When the audio is processed, it is processed into the same frequency bands, and passed through the noise gates, so if that frequency band has only noise in it, the noise will be blocked. If there is signal in that band (which will also mask the noise from being heard) then the noise gate opens and the noise is let through.

As with all noise filters, Noise Removal may not always remove all the noise without affecting the quality of the rest of the audio. If Audacity's Noise Removal effect does not work as well as you would like, or if you have no sample of audio that is only noise, go to Other Techniques below.

A more technical explanation of Noise Removal can be found here.

Noise Removal steps

Removing noise is a two-step process. In the first step, you select a portion of your sound which contains all noise and no signal, in other words, select the part that's silent except for the noise. Usually this will be at the start or end of the track, but if the track has no lead-in or lead-out, try zooming in to hit a precise spot between a note or word. You select the part of the track that is just noise by clicking in the track and dragging a selection out with your mouse or with the arrow keys on your keyboard. Then choose Effect > Noise Removal and click "Get Profile". Audacity learns from this selection what the noise sounds like, so it knows what to filter out later.

Then, select the audio from which you want the noise removed, which you do by clicking in the track and dragging a selection area with your mouse. Note however that you may not necessarily want to apply Noise Removal to the whole track. This is because most Noise Removal takes some of the music away with the noise, and adds or exposes artefacts in the recording. If you only have a few spots in the track that need a small amount of Noise Removal, you may well want to select only those areas to remove noise from. But if the spots need a greater amount of Noise Removal, they may once noise is removed have a rather different "feel" or timbre than the rest of the track, and betray that it has been treated at those points. In this case it may be better to remove noise from the whole track so that it sounds consistent. To apply Noise Removal to the entire track, select all of it by clicking in the Track Control Panel where the Mute/Solo buttons are (or if you only have one track on the screen you can use Edit > Select > All or the hotkey CTRL + A or (CMND + A on a Mac).

Having selected the length of audio from which you want to remove noise, choose Effect > Noise Removal again, but this time, click the "Remove Noise" button. It may take a few seconds or longer depending on how much track you selected.

If you want to apply Noise Removal at the current settings, you can use "Repeat Last Effect" (CTRL + R or COMMAND + R on Mac) to run Noise Removal after grabbing the Noise Profile, rather than reopen the effect dialog.

If not enough noise was removed, or too much of the recording was removed along with the noise, you can use Edit > Undo and try Noise Removal again with a different noise removal level on the slider, which adjusts the noise threshold. You don't have to get a new Noise Profile again if you think the first one was fine.

However if the problem is that too much of the signal (music, voice, etc.) has been removed along with the noise, you can also try going back to the selection chosen for the Noise Profile and reducing its amplification (Effect > Amplify). Then use this as a new Noise Profile. Sometimes running the filter a second time using a Noise Profile that is a de-amplified section of track can give a good result. Another possibility is to select and Edit > Duplicate the track you want to remove noise from before applying Noise Removal, and adjust the relative volume of the two tracks (using the -....+ gain slider on the Track Control Panel) so you get the best mix of the original and noise removed tracks.

Note that if the nature of the background noise changes significantly during the course of the audio, it will be best to take an individual sample of the changed noise and apply that noise sample to the section of audio affected by that particular noise.

Improved Noise Removal in current Audacity

In the new Noise Removal in current Audacity there are now three additional sliders to give more control over the removal algorithm - one controlling the sensitivity of what is considered noise, one controlling the smoothness in the frequency domain, and the other controlling the smoothness in the time domain via an attack/delay control. If you set both of the "smoothness" sliders to zero, you'll get something very similar to the old noise removal algorithm in legacy Audacity 1.2.x which is prone to artifacts and distortion when the reduction slider in step 2 is set to higher removal levels.

So to begin with, try setting the two "smoothness" sliders at about the halfway point and adjust them leftwards if necessary to make the noise removal more "aggressive", and rightwards if you need to make the the result sound more "natural" or more like the original music or speech was before Noise Removal.

The main slider controlling the amount of noise reduction works differently now: instead of adjusting the threshold, it adjusts the gain applied to the noisy part of the signal - i.e. the amount by which the noise should be reduced in volume. If you have a very small amount of noise, you can often reduce it by a large number of dB with no penalty in added distortion. If you have a lot of noise, you will often be able to reduce it much less before you start to add distortion, so in effect you will be putting it more in the background rather than reducing its volume so much that it is no longer audible.

The sensitivity slider controls what is considered noise. It applies a gain to the noise thresholds that were profiled in step 1. Setting this slider to higher values means that more sound will be considered noise and thus filtered out by the noise removal effect. Setting it to lower values means that less sound will be considered noise and bypass the filter. Both sensitivity and reduction sliders control how much audio will be filtered, but in different ways: the reduction slider controls "how much" will be filtered, while the sensitivity slider controls "what" will be filtered.

The best setting for the noise filter is one in which most of the noise is filtered with minimum hurt to the audio, that means with reduction and sensitivity sliders as close to 0 dB as possible. If there is still noise, try increasing the value of the sensitivity or reduction slider. Generally, increasing the value of one of these sliders filters more noise, allowing the other one to be decreased. Try that to get both to the minimum possible value. If the sound gets distorted try to increase smoothness with the other two sliders. Of course, increasing the smoothness sliders will allow more noise to bypass the filter or will muffle the sound. If noise is bypassing the filter, increase sensitivity or reduction levels or decrease attack/decay time. If the sound is getting muffled reduce sensitivity or reduction levels or decrease the frequency smoothness value.

In either current Audacity or legacy 1.2.x versions of Audacity, it may still be impossible to get a satisfactory removal when the noise is very loud, when the noise is variable, when the music or speech is not much louder than the noise or when the noise spectrum is very similar to the signal spectrum.

Special cases

Noise Removal with Cassettes

Cassettes are slightly different from other sources in that its not uncommon for the noise profile to change through the course of the tape, due to accumulation of dirt on the tape heads, either during play or during record, or both.

To optimise function of Audacity noise removal it is best to use a noise sample near the beginning of the tape rather than the end. Using a sample late in the tape will sometimes cause poorer discrimination between noise and signal, as some of the higher frequency noise will be missing or reduced in amplitude.

No silent noise sample

Audacity's Noise Removal filter relies on taking a noise sample so that it knows what to remove. But sometimes a recording has no noise sample available because there is no passage which is silent except for the background noise. Examples of this could include tape recordings of music radio, or an audio file recorded from a continuous LP track where the lead-in and lead-out have been edited away.

There is an option that often works, although it's far from guaranteed, and sometimes fails. Consequently it's wise to back up the original file first if you are planning to export the result from Audacity so as to overwrite the original file.

The plan is to use a recording made in identical conditions that does contain silence, and use a noise sample from that for removing noise from the recording with no silence.

This method works very well if the noise in the second recording is identical to the noise in the first. For a cassette source, that means using the same type of tape, same source, same deck and same recording amplitude. In the example of a recording made from an LP, you could try recording a band between tracks (or lead-in or lead-out) on any LP that sounds as if it has the same general level and type of background noise. This will be less likely to give a good result than recreating cassette noise, as the noise source is not identical, but in the case of a noisy recording, it will probably be better than doing nothing.

If the substitute noise sample is not identical, it will still remove some noise, but will not discriminate between noise and signal well, so noise removal will be partial.


Other Techniques

Notch Filter

Current Audacity now includes a Nyquist Notch Filter underneath the divider in the Effect menu.


Suppose you've loaded your audio into Audacity and listened to it, only to be disappointed to find it's contaminated with a continuous, fairly pure tone of some kind:

Audio contaminated with tone


Let's check first to see if the technique that this tip offers will apply to your case. To do this, select the entire track with CTRL + A (or CMND + A on a Mac), then click Analyze > Plot Spectrum. If your recording is of any significant length then Audacity 1.2 will warn you with a message that begins with the words "Too much audio". Unless you have reason to believe that the initial part of your recording differs much from the rest just accept the dialogue box. It will only analyze the first 23.8 seconds of the recording.

You will need to see a spectrum with the following kind of pattern for this tip to work successfully:

Spectrum before applying Notch Filter


Notice that the spectrum is fairly smooth except for a few evenly spaced peaks. I placed my mouse over the first one of these peaks on the left (ie, the one at the lowest frequency, just above 3 kHz) and Audacity identified the peak more accurately for me at 4255 Hz. I make a note of this number for later use because this is the first of the troublesome frequencies, and perhaps the only frequency in the whistling, that I need to eliminate.

To eliminate one narrow band of frequencies one uses a so-called "notch" filter (named for the fact that it makes a notch in the frequency spectrum). To do this with Audacity, click on Effect > Nyquist Prompt and enter the following code:

(notch2 s 4255 50)


In Audacity 1.2 you'll have to use slightly more complicated code for stereo tracks, for example:

(vector (notch2 (aref s 0) 4255 50) (notch2 (aref s 1) 4255 50) )


The line above tells Nyquist to process the notch filter on both channels.

Substitute "4255" with the frequency that you identified in your own spectrum. That other number, 50 in this example, is the Q factor of the filter. You might find that you need to experiment with it. Varying this value influences the width of the notch. A lower value makes for a wider notch and vice-versa - just experiment a bit.

Alternatively to using the built-in Nyquist prompt, you can download a Notch Filter  plug-in to save a lot of the typing if you have a stereo track. To install this plug-in, place the unzipped notch.ny file in the Plug-Ins folder inside Audacity's installation folder and restart Audacity. On Windows computers, your installation folder is usually under Program Files while on Mac OS X, it is usually under Applications. After restarting Audacity you will find Notch Filter in Audacity's Effect menu underneath the divider. Simply enter the notch frequency and notch Q value you want - as before, the smaller the Q value, the wider the notch.

If you now play your recording you might find that you have eliminated the continuous sound. If not, you could try recalculating the spectrum as described above to get the next frequency peak for elimination and so on. In the case of my recording here is how the spectrum appears after I notched it:

Spectrum after applying Notch Filter


As you see, that first peak has been eliminated. In fact you can see the dip in the spectrum and perhaps I could consider experimenting with that value that was set to 50. However, as it happens, the recording is good enough for my purposes.


Noise Gate

A Noise Gate is a type of "audio gate" that is "open" and allows sounds to pass unaltered when the level is above a "threshold" level. When the audio signal is below the threshold level, the gate "closes" and stops, or reduces the signal making it substantially quieter. A Noise Gate does not remove noise from a signal but reduces the noise level during the quiet periods between sounds. There are many situations where this can be useful.

  • When there is very low level noise that is effectively masked by the recorded material, a Noise Gate can lower the noise level during silent parts of the recording where the low level noise would otherwise be apparent.
    Example: Noise Gate can remove dither noise that may be evident in silent passages in 16-bit audio files. Be sure in Quality Preferences to enable 32-bit Default Sample Format and to disable "High-quality" dither - more explanation here.
  • When noise removal by other methods causes unacceptable degradation of the sound quality, a Noise Gate can reduce the noise level to some extent between sounds without affecting the actual recorded sounds.
  • Where there is low level intermittent noise of a similar type to the actual recorded sound (for example, if sound from a distant television or radio is audible during pauses in a speech recording) a Noise Gate can make the pauses more silent.
  • A Noise Gate may be used after the Audacity Noise Removal effect to further reduce the noise level during periods that should be silent.


Nyquist Noise Gate Plug-in

Nyquist Noise Gate GUI

The Nyquist Noise Gate plug-in has a number of features and settings that allow it to be both effective and unobtrusive. One of the most critical settings when using a Noise Gate is to set the Threshold carefully. This plug-in provides an analysis tool to assist with setting the threshold level correctly:

  1. Make a selection that is "noise only" and open the Noise Gate effect.
  2. Select Function > Analyse Noise Level and make a note of the suggested threshold level.
  3. Select a section of the audio track that includes both sound and silence.
  4. Apply the Noise Gate with the following settings: Select Function > Gate Level reduction > -100. Listen carefully to the result to check that the noise is being cut and the audio is still present. This effect will probably sound unnatural as the gate is fully closing and producing absolute silence when closed, but it will allow you to easily hear if the threshold level is set correctly. Click CTRL + Z to undo and if necessary adjust the threshold level and retest.
  5. When you are happy that the threshold level is correct, raise the "Level reduction" setting to the highest setting that produces an acceptable amount of gating (the default level of -12 dB usually works well).
  6. When you are happy with the settings, apply to the entire song.

Advanced Tip: By default the Noise Gate will take 1/4 second or 250 milliseconds (ms) to fully open and fully close. In some cases it is desirable to make the gate open faster or more slowly. At the minimum (10 ms) the gate will fully open and close almost instantly as the audio level crosses the threshold. This could cause the gate to 'flutter' or 'snap'. At the maximum (1000 ms) the gate will begin to slowly open (fade-in) 1 second before the sound level exceeds the Threshold, and will gradually close (fade-out) after the sound level drops below the Threshold for a period of 1 second. Longer gate times (up to 10 seconds) may be achieved by typing in the text box instead of using the slider.

Personal tools

Donate securely by PayPal, using your credit card or PayPal account!