A list,

Spectrum analysis of speech denoising based on MATLAB

Ii. Source code

clear all
clc
[y,fs]=audioread('5.wav');
% fengzhi=0.43;
buchang=10000; % time interval,5.Wav feels smaller with fengzhi=0.2; % Peak value threshold0.2;3.Wav threshold0.43
x=y(:,1);
%sound(y,fs);
n=length(y);
y_p=fft(y,n);
f=fs*(0:n/2- 1)/n;
figure(1);
subplot(2.1.1);
plot(y);
title('Original speech signal sampled in time domain waveform');
xlabel('points');
ylabel(A ' 'amplitude);
subplot(2.1.2);
plot(f,abs(y_p(1:n/2)));
title('Spectrum of the original speech signal sampled');
xlabel('points');
ylabel('Frequency amplitude');
L=length(y);
noise=0.1*randn(L,2);
y_z=y+noise;
%sound(y_z,fs);
n=length(y);
y_zp=fft(y_z,n);
f=fs*(0:n/2- 1)/n;
figure(2);
subplot(2.1.1);
plot(y_z);
title('Noisy speech Signal time domain waveform');
xlabel('points');
ylabel(A ' 'amplitude);
subplot(2.1.2);
plot(f,abs(y_zp(1:n/2)));
title('Spectrum of noised Speech Signal');
xlabel('points');
ylabel('Frequency amplitude'); %FIR high-pass windowed filter? fp=3000,fc=2700;
wp=2*pi*fp/fs;
ws=2*pi*fc/fs;
Bt=wp-ws;
N0=ceil(11*pi/Bt);
N=N0+mod(N0+1.2);
wc=(wp+ws)/2/pi;
hn=fir1(N- 1,wc,'high',bartlett(N));
X=conv(hn,x);
sound(X,fs);
X11=fft(X,n);
f=fs*(0:n/2- 1)/n;
figure(3);
[pks,locs] = findpeaks(X,'minpeakheight',fengzhi);
Copy the code

3. Operation results







Fourth, note

Version: 2014 a