资源简介

非平稳噪声估计,适用于实时噪声估计,可以用在语音增强算法中。

资源截图

代码片段和文件信息

close all;
clear;
clc;

N=1024;
halfN=N/2;
Apy=0.7;
beta=0.96;
%beta=0.96;
gama=0.998;
Api=0.2;
fi=0.8;
Ad=0.99;
%fi=0.8;
ham=hamming(N)‘;

delta=zeros(1N);
for k=1:N
    if k<=6
        %delta(k)=1.3;
        delta(k)=2;
    elseif k>=18
        delta(k)=5;
    else
        %delta(k)=0.0578125*k-0.63;
        delta(k)=2;
    end
end

[speechfsnbits]=wavread(‘soft.wav‘); % 读入数据
%speech=speech(:1);
size=length(speech);
numofwin=floor(size/N); % 帧数
numframe=2*numofwin-1;

%numframe=256*10;
len=halfN*(numframe+1);
%noise=0.8*randn(1len);
[nofsnbits]=wavread(‘white.wav‘);
m=5;
tm=no(1:len/m)‘;
noise=zeros(1len);
%{
noise(len*0/5+1:len*0/5+len/5)=0.01*randn(1len/5);
noise(len*1/5+1:len*1/5+len/5)=0.03*randn(1len/5);
noise(len*2/5+1:len*2/5+len/5)=0.05*randn(1len/5);
noise(len*3/5+1:len*3/5+len/5)=0.07*randn(1len/5);
noise(len*4/5+1:len*4/5+len/5)=0.09*randn(1len/5);
%}
noise(len*0/m+1:len*0/m+len/m)=0.25*tm;
noise(len*1/m+1:len*1/m+len/m)=0.5*tm;
noise(len*2/5+1:len*2/5+len/5)=0.75*tm;
noise(len*3/5+1:len*3/5+len/5)=1*tm;
noise(len*4/5+1:len*4/5+len/5)=1.25*tm;
%noise=speech(1:len)‘+noise;
tmp=noise(1:N);
tmp=tmp.*ham;
Ppre=abs(fft(tmp)).^2;
Pmin=Ppre;
ppre=zeros(1N);
Dpre=Ppre;
I=zeros(1N);

ave1=zeros(1numframe);
ave2=zeros(1numframe);


for q=1:numframe
    frame=noise(1+(q-1)*halfN:N+(q-1)*halfN); %50 percent overlap
    y=fft(frame.*ham);
    X=abs(y).^2;
    %追踪带噪语音子带平滑功率谱最小值
    Pcur=Apy*Ppre+(1-Apy)*X;
    for k=1:N
       if Pmin(k)           Pmin(k)=gama*Pmin(k)+(1-gama)*(Pcur(k)-beta*Ppre(k))/(1-beta);
       else
           Pmin(k)=Pcur(k);
       end
    end
    
    %计算带噪语音子带中语音出现的概率
    S=Pcur./Pmin;
    for k=1:N
       if S(k)>delta(k);
           I(k)=1;
       else
           I(k)=0;
       end
    end
    pcur=Api*ppre+(1-Api)*I;
    As=Ad+(1-Ad)*pcur;
    
    %更新噪声谱
    %Dcur=pcur.*Dpre+(1-pcur).*(fi*Pmin+(1-fi)*X);
    Dcur=As.*Dpre+(1-As).*X;
    %D=1.65*Dcur;
    
    Dpre=Dcur;
    Ppre=Pcur;
    ppre=pcur;
    
    ave1(q)=mean(X);
    ave2(q)=mean(Dcur);
    
end

figure(1);
t=1:numframe;
%plot(tave1‘r‘tave2*1.75‘b‘);
plot(tave1‘r‘tave2‘b‘);
%plot(tave2‘b‘)



 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2314  2013-04-25 16:44  noise_estimate.m

----------- ---------  ---------- -----  ----

                 2314                    1


评论

共有 条评论