www.pudn.com > phsscal.zip > subspectrum.m, change:2003-11-26,size:768b


function y=subspectrum(x,n) 
%this function complete speech enhancement with frequence  subtract; 
a=3; 
b=2; 
%[y,fs,bit]=wavread('g:\s.wav'); 
 
sample=n; 
 
snr1=snr_count(x,sample); 
Noise=b*prepower(x,15,sample,a) 
%W=boxcar(160); 
siz=length(x); 
N=ceil(siz/sample); 
 
for n=1:sample:N*sample, 
   for j=1:sample, 
      if(siz(1)-n-j<0), 
         z(j)=0; 
      else  
         z(j)=x(n+j-1); 
      end;   
      
   end; 
   %傅立叶变换 
   X=fft(z,sample); 
   %求相位: 
   phase=angle(X); 
      
   Y=sum2(X,a); 
   S=max((Y-Noise),0.005); 
   S=S.^(1/a); 
   for k=1:sample, 
      S(k)=S(k)*exp(i*phase(k)); 
   end; 
    
   s(n:n+sample-1)=ifft(S,sample); 
end; 
snr2=snr_count(s,sample); 
%wavwrite(s,fs,bit,'g:\11.wav'); 
 db=snr2-snr1   
 y=s;