Noise Reduction Alternatives

From Audacity Wiki
Revision as of 16:41, 6 February 2015 by BillWharrie (talk | contribs) (First cut and editing this page for 2.1.0)
Jump to: navigation, search
Peter 15Dec14: The new Noise Reduction effect is replacing Noise Removal in 2.1.0.

This page is for now and until 2.1.0 an orphan page in the Wiki linked to only from the Noise Reduction page in the Manual.

ToDo-210 Once 2.1.0 is released this page can effectively replace Noise Removal in the Wiki and that page will then only remain in the Legacy Wiki.

ToDo-1 This page needs some severe editing from someone who really understands how the effect works - all I have done so far is to copy the existing Noise Removal Wiki page and make textual changes to replace "remove/removal" with "reduce/reduction" throughout. So for all I know this could well be wildly inaccurate. We also have to as ourselves the question: "Do we really need this page, or do we (or should we) have sufficiently adequate documentation in the Manual?".

  • Gale 19Dec14: I think "Special cases of Noise Reduction" and "alternative noise reduction techniques" belong on this page. However it looks like noise reduction using Notch Filter is possibly adequately covered on unless we want more details/more hand holding here.

    Tips on how best to use the effect arguably belong in the Manual. If paragraphs of tips are needed I might cynically observe that we still need a new algororithm... :=)

  • Peter 21Dec12: I'm minded to agree with you about "paragraphs of tips" especially here in the Wiki. Imo the Manual page for the effect should be the full documentation. But I am really an audiot (love that word of Leland's) regarding all this. This page is just a copy of the old page as it related to the old "Noise Removal". I have no real understanding of how this stuff works, particularly the under-the-hood stuff, accordingly I wrote directly to Paul, Steve and Bill (as the principal protagonists for the new Noise Reduction) asking then to review this page, I knew you'd look here anyway. To date none of them has done so.
Audacity's Noise Reduction 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 reduced
  • Return to the effect to apply the noise profile to all the audio.
Related article(s):

How does Audacity's Noise Reduction work?

Audacity's Noise Reduction 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 Reduction may not always eliminate all the noise without affecting the quality of the rest of the audio. If Audacity's Noise Reduction 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 Reduction can be found here.

Noise Reduction steps

Reducing noise is a two-step process: noise profiling followed by noise reduction.

Get Noise Profile

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 Reduction and click Get Noise Profile button. Audacity learns from this selection what the noise sounds like, so it knows what to filter out later.

The Noise Reduction

Then, select the audio from which you want the noise discarded, which you do by clicking in the track and dragging a selection area with your mouse. You must select a minimum of 2048 samples, or about 0.05 seconds at 441000 Hz sample rate. A longer selection is better as the effect is able to get a more accurate picture of the noise. Duplicating a short section of noise and selecting the original and (possibly several) duplicates will not help.

Note however that you may not necessarily want to apply Noise Reduction to the whole track. This is because most Noise Reduction 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 Reduction, you may well want to select only those areas to reduce noise from. But if the spots need a greater amount of Noise Reduction, they may once noise is discarded 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 reduce noise from the whole track so that it sounds consistent. To apply Noise Reduction 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 reduce noise, choose Effect > Noise Reduction again, but this time, click the Image of selected radio button Reduce radio button and then click on the OK button. It may take a few seconds or longer depending on how much track you selected.

If you want to apply Noise Reduction at the current settings, you can use "Repeat Last Effect" CTRL + R (or COMMAND + R on Mac) to run Noise Reduction after obtaining the Noise Profile, rather than reopen the effect dialog.
If not enough noise was eliminated, or too much of the recording was eliminated along with the noise, you can use Edit > Undo and try Noise Reduction again with a different noise reduction 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.

Bill 06Feb2015: I question the need for the first tip (amplifying the noise sample) now that the algorithm has been fixed. I have no experience with the second tip (duplicate and mix), so if someone thinks that tip is still valid please put it back in the main text.
However if the problem is that too much of the signal (music, voice, etc.) has been eliminated 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 reduce noise from before applying Noise Reduction, 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 eliminated 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.

Bill 06Feb2015: I think the controls are adequately covered in the manual.

Noise Reduction controls

There are two additional sliders to give more control over the noise reduction algorithm - one controlling the sensitivity of what is considered noise, the other controlling the smoothness in the frequency domain.

The sensitivity slider controls what is considered noise. Setting this slider to higher values means that more sound will be considered noise and thus filtered out by the Noise Reduction 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 settings are found when most of the noise is filtered with minimum hurt to the audio. If there is still too much 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.

It may be impossible to get a satisfactory reduction in noise 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 frequencies are very similar to those of the music or speech.

Special cases

Noise Reduction 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 the performance of Audacity's Noise Reduction 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 Reduction filter relies on taking a noise sample so that it knows what to eliminate. 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 reducing 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 reduce some noise, but will not discriminate between noise and signal well, so noise elimination will be partial.

Other Techniques

Notch Filter

Gale 19Dec14: If is sufficiently detailed, trim this section to a link to that page. If this section is retained in detail, adjust to allow for the fact that Notch Filter is shipped - no need for a plugin now.
  • Peter 28Jan14: I have updated the Notch Filter page in the Manual with a suitably modified version of this material.

    ToDo-1 Once 2.1.0 is released we can delete the material from this section - but we probably need a rediredt from here to Manual>Notch Filter in case there are Forum posts that will still land here.

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. This is a case where you can get good results using a notch filter.

Bill 06Feb2015: Eliminating this section and instead linking to the manual notch filter page.
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.

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)

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  plugin to save a lot of the typing if you have a stereo track. To install this plugin, 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 2.jpg

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.

Spectral Editing

Use the Spectral Editing Tools to identify and eliminate continuous tones or transient noises.

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 eliminate 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 eliminate 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 reduction 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 Reduction effect to further reduce the noise level during periods that should be silent.

Nyquist Noise Gate Plugin

Nyquist Noise Gate GUI

The Nyquist Noise Gate plugin 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 plugin 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.