www.pudn.com > phsscal.zip > B28mmse_g.m, change:2003-11-19,size:840b


function y=mmse_g(x,n) 
%this function complete speech enhancement with mmse ; 
% n is the number of a speech frame; 
%clear; 
 
sample=n;  
a=0.6; 
b=5; 
%[y,fs,bit]=wavread('G:\5.wav'); 
N=ceil(length(x)/sample); 
noise=prepower(x,15,sample,2); 
j=N*sample; 
for k=1:sample, 
   if(j>length(x)), 
   x(j)=0; 
   j=j-1; 
   end; 
end; 
state=0; 
for k=1:N-1, 
   for n=1:sample, 
      z(n)=x((k-1)*sample+n); 
   end; 
   Y=fft(z,sample); 
   phase=angle(Y); 
   Y=sum2(Y,2); 
   r=Y/noise; 
   if(state>0), 
      r_e=max((1-a)*r/b+a*r_e_last,1+0.005); 
       
   else  
      r_e=max((1-a)*r/b,1+0.005); 
   end; 
   u_e=r_e-1; 
   r_e_last=r_e; 
   state=state+1; 
   u_e=u_e./(1+u_e); 
   A=u_e.*(Y.^0.5); 
   S=A.*exp(i*phase); 
   s((k-1)*sample+1:((k-1)*sample+sample))=ifft(S,sample); 
end; 
y=s; 
%wavwrite(s,fs,bit,'G:\9.wav');