[Speech denoising] Wiener filtering algorithm speech denoising based on matlab prior SNR [with Matlab source code 572]

1. Introduction

This chapter proposes a speech enhancement algorithm based on the Wiener filtering method based on prior signal-to-noise ratio estimation. The initial noise power spectrum is obtained by calculating the statistical average of the silent section, and the initial noise power spectrum and the noisy speech power spectrum are smoothed, and the noise power spectrum is updated. Finally, the situation where the noise increases sharply at a certain frequency point is considered. Correlative verification shows that the algorithm can effectively suppress noise with a small or stable range, but it is not very effective for noise with a wide range of changes in practice.
1. Overview of speech enhancement
1.1 Related concepts of speech enhancement
Embedded in the speech system, the speech signal will inevitably be interfered by the surrounding noise, thereby affecting the quality and intelligibility of the speech.
Speech enhancement: In fact, it is to extract as pure as possible speech from noisy speech, improve speech quality and intelligibility, and improve the performance of speech communication system in noisy environment.
Noise is generated randomly, and it is impossible to completely eliminate it. The goal of speech enhancement is to reduce noise, eliminate background noise, improve speech quality, make the listener receptive, and improve speech intelligibility.
1.2 Related algorithms
for speech enhancement Due to the many sources of noise, the characteristics are different. The application scenarios of speech enhancement processing systems vary greatly.
Therefore, there is no speech enhancement algorithm that can be used in various noisy environments. For different environments, different speech enhancement algorithms are adopted.
According to the processing methods, speech enhancement algorithms can be divided into: enhancement algorithms based on voice periodicity, enhancement algorithms based on all-pole models, enhancement algorithms based on short-time spectrum estimation, enhancement algorithms based on signal subspace, and enhancement algorithms
based on HMM.
Judging from the current development, the method based on short-time spectrum estimation is the most effective method. Specifically, it includes spectral subtraction, Wiener filtering, minimum mean square error short-time spectral amplitude estimation method (MMSE-STSA) and minimum mean square error logarithmic spectral amplitude estimation method (MMSE-LSA). This article mainly discusses the use of Wiener filters to achieve speech enhancement processing.
2 Wiener filter speech enhancement theory based on prior signal-to-noise ratio estimation
The prior signal-to-noise ratio is a very important parameter in the speech enhancement algorithm. The method of calculating the prior signal-to-noise ratio through the "direct decision" estimation proposed by Ephraim and Malah is the most effective and easiest to calculate.
Insert picture description here
Insert picture description here

Second, the source code

clear all; clc; close all;

[xx, fs] = wavread('C5_3_y.wav');           % 读入数据文件
xx=xx-mean(xx);                         % 消除直流分量
x=xx/max(abs(xx));                      % 幅值归一化
IS=0.25;                                % 设置前导无话段长度
wlen=200;                               % 设置帧长为25ms
inc=80;                                 % 设置帧移为10ms
SNR=5;                                  % 设置信噪比SNR
NIS=fix((IS*fs-wlen)/inc +1);           % 求前导无话段帧数
alpha=0.95;

signal=awgn(x,SNR,'measured','db');               % 叠加噪声
output=Weina_Im(x,wlen,inc,NIS,alpha) ;
output=output/max(abs(output));
len=min(length(output),length(x));
x=x(1:len);
signal=signal(1:len);
output=output(1:len);

snr1=SNR_Calc(x,signal);            % 计算初始信噪比
snr2=SNR_Calc(x,output);            % 计算降噪后的信噪比
snr=snr2-snr1;
fprintf('snr1=%5.4f   snr2=%5.4f   snr=%5.4f\n',snr1,snr2,snr);

% 作图
time=(0:len-1)/fs;                        % 设置时间
subplot 311; plot(time,x,'k'); grid; axis tight;
title('纯语音波形'); ylabel('幅值')
subplot 312; plot(time,signal,'k'); grid; axis tight;
title(['带噪语音 信噪比=' num2str(SNR) 'dB']); ylabel('幅值')
function frameout=enframe(x,win,inc)

nx=length(x(:));            % 取数据长度
nwin=length(win);           % 取窗长
if (nwin == 1)              % 判断窗长是否为1,若为1,即表示没有设窗函数
   len = win;               % 是,帧长=win
else
   len = nwin;              % 否,帧长=窗长
end
if (nargin < 3)             % 如果只有两个参数,设帧inc=帧长
   inc = len;
end
nf = fix((nx-len+inc)/inc); % 计算帧数
frameout=zeros(nf,len);            % 初始化
indf= inc*(0:(nf-1)).';     % 设置每帧在x中的位移量位置
inds = (1:len);             % 每帧数据对应1:len
frameout(:) = x(indf(:,ones(1,len))+inds(ones(nf,1),:));   % 对数据分帧
if (nwin > 1)               % 若参数中包括窗函数,把每帧乘以窗函数
    w = win(:)';            % 把win转成行数据
    function frameout=filpframe(x,win,inc)

[nf,len]=size(x);
nx=(nf-1) *inc+len;                 %原信号长度
frameout=zeros(nx,1);
nwin=length(win);                   % 取窗长
if (nwin ~= 1)                           % 判断窗长是否为1,若为1,即表示没有设窗函数
    winx=repmat(win',nf,1);
    x=x./winx;                          % 除去加窗的影响
    x(find(isinf(x)))=0;                %去除除0得到的Inf
end

 
for i=1:nf
    start=(i-1)*inc+1;    
    xn=x(i,:)';
    sig(start:start+len-1)=sig(start:start+len-1)+xn;
end

Three, running results

Insert picture description here

Four, remarks

Complete code or writing add QQ 1564658423 past review
>>>>>>
[Feature extraction] Audio watermark embedding and extraction based on matlab wavelet transform [Include Matlab source code 053]
[Speech processing] Voice signal processing based on matlab GUI [Include Matlab Source code issue 290]
[Voice acquisition] based on matlab GUI voice signal collection [including Matlab source code 291]
[Voice modulation] based on matlab GUI voice amplitude modulation [including Matlab source code 292]
[Speech synthesis] based on matlab GUI voice synthesis [including Matlab Source code issue 293]
[Voice encryption] Voice signal encryption and decryption based on matlab GUI [With Matlab source code 295]
[Speech enhancement] Matlab wavelet transform-based voice enhancement [Matlab source code 296]
[Voice recognition] Based on matlab GUI voice base frequency Recognition [Including Matlab source code 294]
[Speech enhancement] Matlab GUI Wiener filtering based voice enhancement [Including Matlab source code 298]
[Speech processing] Based on matlab GUI voice signal processing [Including Matlab source code 299]
[Signal processing] Based on Matlab speech signal spectrum analyzer [including Matlab source code 325]
[Modulation signal] Digital modulation signal simulation based on matlab GUI [including Matlab source code 336]
[Emotion recognition] Voice emotion recognition based on matlab BP neural network [including Matlab source code 349 Issue]
[Voice Steganography] Quantified Audio Digital Watermarking Based on Matlab Wavelet Transform [Include Matlab Source Code Issue 351]
[Feature extraction] based on matlab audio watermark embedding and extraction [including Matlab source code 350 period]
[speech denoising] based on matlab low pass and adaptive filter denoising [including Matlab source code 352 period]
[emotion recognition] based on matlab GUI voice emotion classification Recognition [Including Matlab source code 354 period]
[Basic processing] Matlab-based speech signal preprocessing [Including Matlab source code 364 period]
[Speech recognition] Matlab Fourier transform 0-9 digital speech recognition [Including Matlab source code 384 period]
[Speech Recognition] 0-9 digital speech recognition based on matlab GUI DTW [including Matlab source code 385]
[Voice playback] Matlab GUI MP3 design [including Matlab source code 425]
[Voice processing] Speech enhancement algorithm based on human ear masking effect Noise ratio calculation [Including Matlab source code 428]
[Speech denoising] Based on matlab spectral subtraction denoising [Including Matlab source code 429]
[Speech recognition] BP neural network speech recognition based on the momentum item of matlab [Including Matlab source code 430]
[Voice steganography] based on matlab LSB voice hiding [including Matlab source code 431]
[Voice recognition] based on matlab male and female voice recognition [including Matlab source code 452]
[Voice processing] based on matlab voice noise adding and noise reduction processing [including Matlab source code Issue 473]
[Speech denoising] based on matlab least squares (LMS) adaptive filter [including Matlab source code 481]
[Speech enhancement] based on matlab spectral subtraction, least mean square and Wiener filter speech enhancement [including Matlab source code 482 period】
[Communication] based on matlab GUI digital frequency band (ASK, PSK, QAM) modulation simulation [including Matlab source code 483]
[Signal processing] based on matlab ECG signal processing [including Matlab source code 484]
[Voice broadcast] based on matlab voice Broadcast [Including Matlab source code 507]
[Signal processing] Matlab wavelet transform based on EEG signal feature extraction [Including Matlab source code 511]
[Voice processing] Based on matlab GUI dual tone multi-frequency (DTMF) signal detection [Including Matlab source code 512 】
【Voice steganography】based on matlab LSB to realize the digital watermark of speech signal 【Include Matlab source code 513】
【Speech enhancement】Speech recognition based on matlab matched filter 【Include Matlab source code 514】
【Speech processing】Based on matlab GUI voice Frequency domain spectrogram analysis [including Matlab source code 527]
[Speech denoising] based on matlab LMS, RLS algorithm voice denoising [including Matlab source code 528]
[Voice denoising] based on matlab LMS spectral subtraction voice denoising [including Matlab Source code issue 529]
[Voice denoising] based on matlab soft threshold, hard threshold, compromise threshold voice denoising [including Matlab source code 530]
[Voice recognition] based on matlab specific person's voice recognition discrimination [including Matlab source code 534]
[ Speech denoising] based on matlab wavelet soft threshold speech noise reduction [including Matlab source code 531]
[speech denoising] based on matlab wavelet hard threshold speech noise reduction [including Matlab source code 532]
[speech recognition] based on matlab MFCC and SVM specific Human gender recognition [including Matlab source code 533]
[Voice recognition] GMM speech recognition based on MFCC [including Matlab source code 535 period]
[Voice recognition] Based on matlab VQ specific person isolated words voice recognition [including Matlab source code 536 period]
[Voice recognition] based on matlab GUI voiceprint recognition [including Matlab] Source code issue 537]
[Acquisition and reading] based on matlab voice collection and reading [including Matlab source code 538]
[Voice editing] based on matlab voice editing [including Matlab source code 539]
[Voice model] based on matlab voice signal mathematical model [including Matlab source code 540]
[Speech soundness] based on matlab voice intensity and loudness [including Matlab source code 541]
[Emotion recognition] based on matlab K nearest neighbor classification algorithm voice emotion recognition [including Matlab source code 542]
[Emotion recognition] based on matlab Support vector machine (SVM) speech emotion recognition [including Matlab source code 543]
[Emotion recognition] Neural network-based speech emotion recognition [including Matlab source code 544]
[Sound source localization] Sound source localization based on matlab different spatial spectrum estimation Algorithm comparison [Include Matlab source code 545]
[Sound source localization] Based on matlab microphone receiving signal under different signal-to-noise ratio [Include Matlab source code 546]
[Sound source localization] Room impulse response based on matlab single sound source and dual microphones [ Contains Matlab source code 547]
[Sound source localization] Matlab generalized cross-correlation sound source location [Matlab source code 548 is included]
[Sound source location] Matlab array manifold matrix-based signal display [Matlab source code 549]
[Features Extraction] based on matlab formant estimation [including Matlab source code 550 period]
[Feature extraction] based on matlab pitch period estimation [including Matlab source code 551]
[Feature extraction] based on matlab voice endpoint detection [including Matlab source code 552]
[Voice coding] based on matlab ADPCM codec [including Matlab source code 553]
[Voice Encoding] based on matlab LPC encoding and decoding [including Matlab source code 554]
[Voice encoding] based on matlab PCM encoding and decoding [including Matlab source code 555]
[Speech analysis] Based on matlab cepstrum analysis and MFCC coefficient calculation [including Matlab source code 556]
[Speech analysis] based on matlab linear prediction coefficient comparison [including Matlab source code 557]
[speech analysis] based on matlab voice short-time frequency domain analysis [including Matlab source code 558]
[speech analysis] based on matlab voice short-time time domain analysis [including Matlab Source code issue 559]
[Speech analysis] based on matlab voice line spectrum pair conversion [including Matlab source code 560]
[speech synthesis] signal framing and restoration based on matlab proportional overlap and addition [including Matlab source code 561]
[Speech synthesis] Speech synthesis based on matlab linear prediction formant detection and pitch parameters [with Matlab source code 562]
[speech synthesis] based on matlab linear prediction coefficients and pitch parameters [with Matlab source code 563]
[speech synthesis] based on matlab linear prediction Coefficient and prediction error speech synthesis [Include Matlab source code 564]
[Speech synthesis] Matlab-based voice signal speed change [Include Matlab source code 565]
[Speech synthesis] Matlab voice signal-based tone change [Include Matlab source code 566]
[Speech synthesis] signal framing and restoration based on matlab overlap storage method [including Matlab source code 567]
[Speech synthesis] signal framing and restoration based on matlab overlap addition method [including Matlab source code 568]
[Voice denoising] Improved spectral subtraction speech denoising based on matlab [including Matlab source code 569]
[Voice denoising] Based on matlab basic Wiener filter algorithm speech denoising [including Matlab source code 570]
[Voice denoising] Based on matlab spectral subtraction voice denoising[ Including Matlab source code 571 period]

Guess you like

Origin blog.csdn.net/TIQCmatlab/article/details/115003326