Noise Reduction Algorithm - Papers/References?


Could someone point me to formal papers or detailed algorithm descriptions behind Audacity’s noise reduction algorithm? I’ve seen the algorithm description at , but I’d like a far more detailed description- I’d like to implement the Audacity algorithm in MATLAB, for the purpose of cleaning up speech contaminated with MRI noise.



I think that is the most detailed documentation that we have. For a more detailed account you would need to look at the source code (

If it would help I could give you my interpretation of what it is doing, but please bear in mind that I am not a C++ programmer and have limited understanding of the language.

I have noise reduction algorithm, It has some drawbacks. In this algorithm noise parameters calculated only for starting noisy frames,
when voice detected, that parameters(noise params calculated upto previous frame), applying on following frames. Here Not updating
the noise parameters for voice frames. I got improved results but not better. i got 30-40% results improvements(without noise reduction
800 passed(28.5%) out of 2800, with noise reduction 1140 passed (41%) ).
Can any one suggest me, in modifying algorithm to improve results or point me where i get better algorithm?

I want to implement the noise reduction algorithm(in matlab), I’ve seen the audacity noise reduction algorithm source code at
http:// Could someone point me to
detailed algorithm description behind Audacity’s noise reduction algorithm?, and how much accurate is this algorithm?


Moderator note: Ramesh, please do not double post - unfortunately we have had to implement post moderation to prevent a flood of spam much of it unpleasant and some of it downright dangerous. I removed the duplicate post for you.

and the code: http://http//
are all that we have.

I merged in at a post Ramesh made in another topic that has more specifics about his code.


We have noise removal algorithm used in Audacity in Matlab… Here is the code:

Fs = 8000;
starting = 1;
ending = 8000;
load('y.mat');%contains the noisy signal 

windowSize = 2048;
noiseGate = zeros(windowSize, 1);
sum = zeros(windowSize, 1);
sumsq = zeros(windowSize, 1);
profileCount = zeros(windowSize, 1);
smoothing = zeros(windowSize, 1);
level = 8;

portion = y(starting:ending);%gets the noise part to build a noise profile

%Noise Profile:
for i=1:floor(length(portion)/windowSize)
    ind = ((i-1)*windowSize)+1;
    in = portion(ind:ind+windowSize-1);

    out = PowerSpectrum(windowSize, in);

    for j=1:windowSize/2
        value = log(out(j));
        if(value ~= inf)
            sum(j) = sum(j)+value;
            sumsq(j) = sumsq(j)+value^2;
            profileCount(j) = profileCount(j)+1;
for i=1:windowSize/2 + 1
    noiseGate(i) = sum(i)/profileCount(i);

%Noise Removal:
for i=1:(windowSize/2):length(y)-windowSize+1
    %ind = ((i-1)*windowSize)+1;
    inr = y(i:i+windowSize-1);

    infft = conj(fft(inr));

    outr = real(infft);
    outi = imag(infft);

    inr = WindowFunc(3, windowSize, inr);
    power = PowerSpectrum(windowSize, inr);

    pLog = zeros((windowSize/2)+1, 1);
    for j=1:(windowSize/2)+1
        pLog(j) = log(power(j));

    half = windowSize/2;
    for j=1:half+1;
        if(pLog(j) < noiseGate(j) + (level/2))
            smooth = 0.0;
            smooth = 1.0;
        smoothing(j) = smooth*0.5 + smoothing(j)*0.5;

   for j=3:half-1
      if (smoothing(j)>=0.5 && smoothing(j)<=0.55 && smoothing(j-1)<0.1 && smoothing(j-2)<0.1 && smoothing(j+1)<0.1 && smoothing(j+2)<0.1)
          smoothing(j) = 0.0;

   outr(1) = outr(1)*smoothing(1);
   outi(1) = outi(1)*smoothing(1);
   outr(half+1) = outr(half+1)*smoothing(half+1);
   outi(half+1) = outi(half+1)*smoothing(half+1);

   for j=2:half
       k = windowSize - (j-2);
       smooth = smoothing(j);
       outr(j) = outr(j)*smooth;
       outi(j) = outi(j)*smooth;
       outr(k) = outr(k)*smooth;
       outi(k) = outi(k)*smooth;     

   outTmp = outr - 1j.*outi;
   inr = real(ifft(conj(outTmp)));
   inr = WindowFunc(3, windowSize, inr);

   yFF(i:i+(windowSize/2)-1) = inr(1:windowSize/2);


 sound(yFF, 8000);

The code actually removes the noise, but the problem is that the resulted signal has some kind of an echo effect… So any body knows what’s wrong?
Can anybody help us to improve this?


I want to implement audacity noise removal code in C language, Is any one already implemented in “C” or
Can I find audacity Noise Removal code in “C” any where?
One doubt in the Algorithm, fft length (window size) is 2048, why it is? Is any reason to take this?. Can I take fft length
as 64 or 128. I think for lower block size resolution is more, and signal is analysed better.
Is it valid doubt. Please any one give me suggestion and help me in finding “C” code.

Ramesh Nagapuri

Audacity is mostly programmed in C++.
The source code for the Noise Removal effect is here:
Why do I feel like I’m repeating myself?

Yeah, and I do always read the same replys and wonder why they are not marked as read.

By the way, a shorter block size is definetly not better. The frequencies do smear much to much (forced smoothing).
1024 is good for speech and 4096 for music.
2048 is probably the best trade-off found so far.
One could work with different sample rates to evaluate this behaviour.

I am using audacity tool to remove noise from my wave files manually using GUI. But I have 1000’s of files, I need to do this using batch files or scripts.
Can anyone suggest me how to automate the Audacity noise removal through scripts, not using GUI?

Ramesh Nagapuri

Audacity only has limited command-line support, unless you compile the Audacity sources and use Scripting .

Alternatively you can use Chains to process perhaps 1000 or 2000 files at a time. You cannot process more than that because the file names will overflow.


"you can use Chains to process perhaps 1000 or 2000 files at a time. "

I am using chains to process more files in audacity tool to remove noise from my wave files. Here I am not profiling (not using “get profiling”) the noise to estimate the noise, In this case what it will do?, will it estimate noise from each stream or uses default noise profile?

If I want to estimate the noise profile for each stream (Get Profile), and need to remove noise from each stream using corresponding noise profile. Can you please suggest me is it possible through chains or any other ways (automated scripts in windows)?

Ringing artefact ? …

If Audacity is opened and the Noise Removal effect is used, that will create a “noise profile” that will be retained until either Audacity is closed, or you create a new profile.

If Noise Removal is used in a Chain:

  1. If a Noise Profile exists, that Noise Profile will be used.
  2. If a Noise Profile does not exist:
  3. If the Chain is applied to files:
    The first file (all of it) is used to create the Noise Profile.
  4. If the Chain is applied to the current project:
    The current Selection is used to create the Noise Profile

If correct, that is clearly inappropriate, until we have “intelligent” noise reduction that gathers its own profile from each file.

Even if the profile happens to be appropriate for each file to be processed, it requires the user to create a prior profile file and to force the first file to be processed to be that profile.

I would use noiseprof then noisered in a SoX script on each file, carefully specifying the selection for noiseprof. As I understand it, this would grab a separate profile for each file. See: .


Thank you very much for the code. Actually I am a new user of Audacity and the Noise reduction function of GUI works pretty well for me. However, either there are magic numbers in the code or I simply missed them, I cannot see where the 3 GUI free parameters (Noise reduction level (in dB), sensitivity and freq. smoothing (bands) are implemented. Also can you provide your PowerSpectrum function or any PS will do the job?
Thanks a lot again,