💥1 概述
谱相减减少背景(加性)噪声影响的最流行方法之一是谱相减。背景噪声是降低录音中语音质量和清晰度的最常见因素。该去噪算法旨在降低噪声水平而不影响语音信号质量。我们需要设计陷波参数均衡器,有选择地滤除噪声发生的频率。由于陷波滤波器也可以去除上述频率下的语音信号的分量,我们将应用峰值滤波器来在陷波滤波器的输出处增强语音信号。
在Matlab上实现。执行时生成并播放去噪信号。
📚2 运行结果
🎉3 参考文献
[1]向瑾,翟成瑞,杨卫,孟令军,张文栋.基于小波变换的音频信号去噪[J].微计算机信息,2007(35):85-86.
👨💻4 Matlab代码
主函数部分代码:
fprintf('--- Audio Signal Denoising using Spectral Subtraction ---\n\n'); %load noise sound example [y,Fe]=audioread('sample.wav'); x=y(100000:end,1).'; %remove the beginning of the sample Nx=length(x); %algorithm parameters apriori_SNR=1; %select 0 for aposteriori SNR estimation and 1 for apriori alpha=0.05; %only used if apriori_SNR=1 beta1=0.5; beta2=1; lambda=3; %STFT parameters NFFT=1024; window_length=round(0.031*Fe); window=hamming(window_length); window = window(:); overlap=floor(0.45*window_length); %number of windows samples without overlapping %Signal parameters t_min=0.4; %interval for learning the noise t_max=1.00; %spectrum (in second) %construct spectrogram [S,F,T] = spectrogram(x+i*eps,window,window_length-overlap,NFFT,Fe); %put a short imaginary part to obtain two-sided spectrogram [Nf,Nw]=size(S); %Noisy spectrum extraction t_index=find(T>t_min & T<t_max); absS_noise=abs(S(:,t_index)).^2; noise_spectrum=mean(absS_noise,2); %average spectrum of the noise noise_specgram=repmat(noise_spectrum,1,Nw); %Estimate SNR absS=abs(S).^2; SNR_est=max((absS./noise_specgram)-1,0); if apriori_SNR==1 SNR_est=filter((1-alpha),[1 -alpha],SNR_est); end %Compute Attenuation Map an_lk=max((1-lambda*((1./(SNR_est+1)).^beta1)).^beta2,0); STFT=an_lk.*S; %Compute Inverse STFT ind=mod((1:window_length)-1,Nf)+1; output_signal=zeros((Nw-1)*overlap+window_length,1); for indice=1:Nw %Overlapp add technique left_index=((indice-1)*overlap) ; index=left_index+[1:window_length]; temp_ifft=real(ifft(STFT(:,indice),NFFT)); output_signal(index)= output_signal(index)+temp_ifft(ind).*window; end