[Speech denoising] based on matlab soft threshold, hard threshold, compromise threshold voice denoising [including Matlab source code 530]

1. Introduction

Based on matlab soft threshold, hard threshold, compromise threshold speech denoising
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

Second, the source code

clc;
clear;
fs=wavread('C:\Users\lenovo\Desktop\93317443speech-denoising\Ring01.wav');
y=fs(40000:120000);
N=length(y);
figure(1);
subplot(111);
plot(y);
ylabel('幅值 A');
title('原始信号');
s=awgn(y,20,'measured');%加入高斯白噪声
figure(2);
plot(s);
ylabel('幅值 A');
title('加噪信号');
wname='db3';%选db3小波基
lev=5;%5层分解
[c,l]=wavedec(s,lev,wname);
a5=appcoef(c,l,wname,lev); 
d5=detcoef(c,l,5);
d4=detcoef(c,l,4);
d3=detcoef(c,l,3);
d2=detcoef(c,l,2);
d1=detcoef(c,l,1);
cD=[d1,d2,d3,d4,d5];
a=8500;b=13;
sigma=median(abs(cD))/3.647
thr1=(sigma*sqrt(2*(log10(N))))/(log10(2));
cD1=wthresh(d1,'s',thr1);
thr2=(sigma*sqrt(2*(log10(N))))/(log10(3));
cD2=wthresh(d2,'s',thr2);
thr3=(sigma*sqrt(2*(log10(N))))/(log10(4));
cD3=wthresh(d3,'s',thr3);
thr4=(sigma*sqrt(2*(log10(N))))/(log10(5));
cD4=wthresh(d4,'s',thr4);
thr5=(sigma*sqrt(2*(log10(N))))/(log10(6));
cD5=wthresh(d5,'s',thr5);
cd=[a5,cD5,cD4,cD3,cD2,cD1];
c=cd;
ys=waverec(c,l,wname);
figure(3);
plot(ys);
title('软阈值处理');
thr1=(sigma*sqrt(2*(log10(N))))/(log10(2));
cD1=wthresh(d1,'h',thr1);
thr2=(sigma*sqrt(2*(log10(N))))/(log10(3));
cD2=wthresh(d2,'h',thr2);
thr3=(sigma*sqrt(2*(log10(N))))/(log10(4));
cD3=wthresh(d3,'h',thr3);
thr4=(sigma*sqrt(2*(log10(N))))/(log10(5));
cD4=wthresh(d4,'h',thr4);
thr5=(sigma*sqrt(2*(log10(N))))/(log10(6));
cD5=wthresh(d5,'h',thr5);
cd=[a5,cD5,cD4,cD3,cD2,cD1];
c=cd;
yh=waverec(c,l,wname);
figure(4);
plot(yh);
title('硬阈值处理');
thr1=(sigma*sqrt(2*(log10(length(d1)))))/(log10(1+1));
for i=1:length(d1)
    if(abs(d1(i))>=thr1)
        cD1(i)=sign(d1(i))*(abs(d1(i))-b*thr1/(a^(abs(abs(d1(i))-thr1))+b-1));%估计第一层小波系数
    else
        cD1(i)=0;
    end
end
thr2=(sigma*sqrt(2*(log10(length(d2)))))/(log10(2+1));
for i=1:length(d2)
    if(abs(d2(i))>=thr2)
        cD2(i)=sign(d2(i))*(abs(d2(i))-b*thr2/(a^(abs(abs(d2(i))-thr2))+b-1));%估计第二层小波系数
    else
        cD2(i)=0;
    end
end
thr3=(sigma*sqrt(2*(log10(length(d3)))))/(log10(3+1));
for i=1:length(d3)
    if(abs(d3(i))>=thr3)
        cD3(i)=sign(d3(i))*(abs(d3(i))-b*thr3/(a^(abs(abs(d3(i))-thr3))+b-1));%估计第三层小波系数
    else
        cD3(i)=0;
    end
end
thr4=(sigma*sqrt(2*(log10(length(d4)))))/(log10(4+1));
for i=1:length(d4)
    if(abs(d4(i))>=thr4)
        cD4(i)=sign(d4(i))*(abs(d4(i))-b*thr4/(a^(abs(abs(d4(i))-thr4))+b-1));%估计第四层小波系数
    else
        cD4(i)=0;
    end
end
thr5=(sigma*sqrt(2*(log10(length(d5)))))/(log10(5+1));
for i=1:length(d5)
    if(abs(d5(i))>=thr5)
        cD5(i)=sign(d5(i))*(abs(d5(i))-b*thr5/(a^(abs(abs(d5(i))-thr5))+b-1));%估计第五层小波系数
    else
        cD5(i)=0;
    end
end
%%%%开始重构
cd=[a5,cD5,cD4,cD3,cD2,cD1];
c=cd;
yhs=waverec(cd,l,wname);
figure(5);
plot(ys,'LineWidth',1);
ylabel('幅值 A')

Three, running results

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
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 denoising [including Matlab source code 531]

Guess you like

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