nr (input WAVE/RAW* file) (input noise template file) (output WAVE/RAW* file) [/hpf (Hz)] [/keepifover (probability)] [/killifunder (probability)] [/noiseoffset (dB)] [/reducebymax (dB)] [/reducebymin (dB)] [/spectralattack (s)] [/spectraldecay (s)] [/levelnoise] [/precision (int)] [/noisefloor (dB)]
* for reading and writing RAW files, see the common parameters page
Note: It is highly recommended to read the guide for creating good noise templates before reading this document as it provides an introduction to some of the concepts mentioned in this section.
The nr application will use the noise template specified to execute the noise reduction algorithm using the input file for input and the output file for output.
Using the program effectively will require an understanding of the parameters that control it. The default parameters which have been included with the application are a good starting point, but tweaking them will almost always give better results. The sections below will outline what each of the available parameters perform.
Noise Shaping parameters
The /keepifover, /killifunder, /reducebymin, /reducebymax, /noiseoffset, /noisefloor and /levelnoise parameters are used to shape the response of the output FFT.
The /noiseoffset parameter serves to increase the mean amplitude of each frequency in the noise template spectrum by a constant amount. Generally, you don't want to adjust this value - it is provided for flexibility.
For each frequency element in an FFT 'frame' of input data, a probability of that particular frequency element being signal is generated. This is done using the means and standard deviations which are recorded in the noise template of actual background noise and assumes that the noise levels follow a normal distribution. The noise shaping array is generated using the following rules:
- If [probability] > [keepifover] the frequency will stay exactly as it is. No reduction will be performed (multiplier of 1).
- If [killifunder] < [probability] < [keepifover] the frequency will be linearly reduced between [reducebymin] and [the minimum of reducebymax or the amount required to push the bin to the noise floor] decibels.
- If [probability] < [killifunder] the frequency will be reduced by [the minimum of reducebymax or the amount required to push the bin to the noise floor] decibels.
The /noisefloor parameter specifies the noise floor (or minimum level of each FFT bin). No bins will be reduced beyond this absolute level under any circumstance.
The /levelnoise switch toggles the noise levelling feature which defaults to "ON". Noise levelling adjusts the maximum reduction that can be applied to each bin in the FFT making it equal to the lesser of either:
- The reduction required to push the bin to the noise floor or
- The user defined "reducebymax" parameter
As an example: if the noise floor is at -60dB, reducebymax is -20dB, and noiseleveling is on. If a bin had a value of -50dB, reducing it by -20dB would take it to -70dB (which would be below the noise floor) and so the actual maximum reduction for that bin would be -10dB. Most blower samples will contain more bass sound than high frequency hiss and this feature is useful for removing the bass heavily, but not affecting the hiss too heavily - which may be necessary to preserve chiff.
When noise levelling is off, the maximum reduction is fixed by the user-specified /reducebymax parameter.
Once this shaping array is generated, it is filtered with the parameters shown in the following Noise Shaping Filtering Parameters section.
Noise Shaping Filtering Parameters
The noise shaping parameters work by filtering the scaling array which is multiplied to each FFT after it has been generated by the above noise shaping parameters.
/spectraldecay (float) and /spectralattack (float) parameters
These essentially apply a low pass filter to the actual noise shaping parameters. If they take the same value, each multiplier is low-pass filtered by a one-pole filter centred on the given frequency. If they take different values and the multiplier has increased since the last FFT, it will be filtered by the /spectralattack parameter. If the multiplier has decreased since the last FFT, it will be filtered by the /spectraldecay parameter.
The /spectraldecay parameter is now on by default but MUST be tweaked to attain good performance. As the filter does not apply directly to the output FFT spectrum data, it should not increase the lengths of decays (apart from possibly adding a small amount of extra noise to the end of the decay). If it is set too small however and the /spectralattack parameter is disabled, it could make the noise reduction seem like it is doing nothing!
The /spectralattack parameter again must be set to attain good performance. If it is set too low, attack transients could be totally removed. If it is set too high, the noise reduction could appear to do almost nothing. The value for this setting will depend heavily on the audio which is being processed. It can stay very low (2-4Hz) for audio samples where transients are not that important (such as English swell gambas which have insignificant starting transients) whereas higher values (4-8Hz) will be needed for pipes with lots of wind noise or very defined starting transients. This parameter will play a large role in the success of your reduction.
To disable either of these filters, set the value to zero.
Audio Filtering Parameters
There is only one Audio Filtering parameter included which is the /hpf parameter. This is a high pass filter which works by setting all of the FFT bin values in the noise reduction algorithm which correspond to frequencies lower than the specified cutoff frequency to zero - resulting in a zero-phase high pass filter. 0.14b note: it is advised to disable this "filter" currently. A simple bit of maths shows that this is a poor way of achieving a low pass filter. A future version will replace this with a good linear-phase filter on the output.
Reconstruction Precision Parameter
/precision (int) parameter
The /precision parameter is one of the new parameters introduced in version 0.14b. It has made massive improvements to the quality of the output and precision of the filtering over previous versions. It specifies the overlap of FFT frames that the noise reduction algorithm operates on. With a value of 2, all of each FFTs data is used in the output. With a value of 4, half is used, With a value of 8, a quarter is used... and so on. As the windowing function is "de-applied" after the noise reduction takes place, values at the edges of the resulting data are unreliable (as they are being divided by very small numbers close to zero) and if they are used in the output, the result will almost certainly have poor transient or general output quality. All previous versions of NR would could be simulated in this version by setting this factor to 2. The current version defaults to 16 and this number should rise with the fftsize / samplerate ratio. A future version will set automatic defaults based on the input file details.
So what's the best approach...?
The best results will require the most patience and experimentation.
A good starting point would be to follow the steps below.
- Generate a few noise profiles using different FFT sizes with the gnp operator.
- Use the templates on a few audio samples with the /spectralxxx parameters disabled, keep the /keepifunder and /killifover parameters the same and everything else at the defaults. Slowly raise the /keepifunder and /killifover parameters until artefacts start to appear often.
- Once this level has been found, reduce the /killifunder parameter to about 0.05 less than the /keepifover parameter and experiment with the /spectralxxx parameters (when you run the noise reduction operation, the line directly above the progress indicator will indicate this percentage).
- Keep adjusting values and repeat until a satisfactory result has been found. For the final run, it is recommended to boosed the /precision factor.
This will usually give you good results, if the artefacts are still too dominant, you can either reduce the /spectralcutoff and /spectralattack parameters or increase the /keepifover parameter.
The amount of background noise will be governed by the /reducebymin, /reducebymax, /noisefloor and /spectralxxx parameters. The defaults give quite good results but if more reduction is needed, reduce /reducebymax by a few dBs. The /reducebymin parameter should be ZERO and will probably be removed in a future version!
Good indications of the quality of the results would be to run the noise reduction over something like a person talking, or a musical performance. If the quality is good, then your samples should be good as well... If a person talking sounds like they are under-water, chances are that even if you think your samples sound good while editing, they won't sound musical on playback. I personally overlay the end result with the noise sample and compare what the original recording sounds like to the reduced version with noise overlayed on top of it. If my ears can tell the difference, good settings haven't been found yet.
Remember: a good ethic for noise reduction would be not to think about how much noise you can remove, but instead: how much noise can you keep?