Noise Reduction Algorithm - Papers/References?

Audio software developers forum.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
ram_nagapuri
Posts: 8
Joined: Thu Apr 03, 2014 4:28 am
Operating System: Please select

Noise Removal using audacity - How to automate?

Post by ram_nagapuri » Tue Apr 08, 2014 5:31 am

Hello,
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?

Thanks
Ramesh Nagapuri

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Noise Removal using audacity - How to automate?

Post by Gale Andrews » Tue Apr 08, 2014 8:32 pm

ram_nagapuri wrote: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?
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.


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

ram_nagapuri
Posts: 8
Joined: Thu Apr 03, 2014 4:28 am
Operating System: Please select

Re: Noise Removal using audacity - How to automate?

Post by ram_nagapuri » Mon Apr 14, 2014 4:41 am

>>"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)?

Trebor
Posts: 9987
Joined: Sat Dec 27, 2008 5:22 pm
Operating System: Windows 8 or 8.1

Re: Audacity noise removal algorithm implemented in matlab.

Post by Trebor » Tue Apr 15, 2014 10:12 am

ram_nagapuri wrote:... 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?
Ringing artefact ? ... http://en.wikipedia.org/wiki/Ringing_artifacts

steve
Site Admin
Posts: 81858
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Noise Reduction Algorithm - Papers/References?

Post by steve » Tue Apr 15, 2014 12:44 pm

ram_nagapuri wrote: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 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:
    1. If the Chain is applied to files:
      The first file (all of it) is used to create the Noise Profile.
    2. If the Chain is applied to the current project:
      The current Selection is used to create the Noise Profile
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Noise Reduction Algorithm - Papers/References?

Post by Gale Andrews » Tue Apr 15, 2014 6:00 pm

steve wrote:If Noise Removal is used in a Chain and a Noise Profile does not exist, if the Chain is applied to files, the first file (all of it) 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: http://sox.sourceforge.net/sox.html .


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

roger_alimi
Posts: 1
Joined: Fri Jun 18, 2021 10:52 am
Operating System: Windows 10

Re: Audacity noise removal algorithm implemented in matlab.

Post by roger_alimi » Fri Jun 18, 2021 11:04 am

ram_nagapuri wrote:
Fri Apr 04, 2014 5:09 am
We have noise removal algorithm used in Audacity in Matlab.. Here is the code:

Code: Select all

clc;
clear;
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;
        end
    end
end
for i=1:windowSize/2 + 1
    noiseGate(i) = sum(i)/profileCount(i);
end


%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));
    end

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

   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;
      end
   end

   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;     
   end

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

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

end

 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?

Thanks
Ramesh

Hi,
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,
Roger

Post Reply