specific code below
% of speech signal to do the original time domain waveform and spectrum analysis
[y, fs]=audioread (' C: \ Users \ wangzhen \ Desktop \ set class 2 \ ghost. Wav ');
Sound playback speech signal (y, fs) %
Pause
N=length (y); % points selected transform
Y_p=FFT (y, n); % n points for Fourier transform in frequency domain
F=fs * (0: n/2-1)/n. The frequency of the corresponding points %
Figure (1)
Subplot (2,1,1);
The plot (y); % speech signal in the time domain waveform figure
Title (' original speech signal after sampling time domain waveform);
Xlabel (' time axis')
A 'ylabel (' amplitude)
Subplot (2,1,2);
The plot (f, abs (y_p (1: n/2))); % speech signal spectrum
The title (' original speech signal after sampling spectrum);
Xlabel (' frequency HZ);
Ylabel (' frequency amplitude);
% of the audio signal noise
L=length (y);
% calculation of audio signal lengthWhose=0.1 * randn (L, 2); % create
the length of the random noise signals, such asY_z=y + noise; % to the superposition of two signals into a new signal - noise processing
Sound (y_z, fs)
Pause
% to add noise speech signal are analyzed after
N=length (y); % points selected transform
Y_zp=FFT (y_z, n); % n points for Fourier transform in frequency domain
F=fs * (0: n/2-1)/n. The frequency of the corresponding points %
Figure (2)
Subplot (2,1,1);
The plot (y_z); % add noise speech signal in the time domain waveform figure
The title (' add noise speech signal time domain waveform);
Xlabel (' time axis')
A 'ylabel (' amplitude)
Subplot (2,1,2);
The plot (f, abs (y_zp (1: n/2))); % add noise speech signal spectrum
The title (' add noise speech signal spectrum);
Xlabel (' frequency HZ);
Ylabel (' frequency amplitude);
% to add noise speech signal denoising procedure is as follows:
Fp=1500; Fc=1700; As=100; Ap=1; % low-pass filter performance index
Wc=2 * PI * fc/fs. Wp=2 * PI * fp/fs.
Wdel=wc - wp;
Beta=0.112 * (As 8.7);
N=ceil ((As - 8)/2.285/wdel);
Wn=Kaiser (N + 1, beta);
Ws=+ wc (wp)/2/PI;
B=fir1 (N, ws, wn);
Figure (3);
Freqz (b, 1); % above designs for the low-pass filter
Rid of the noise signal %
X=fftfilt (b, y_z);
X=FFT (X, n);
Figure (4);
Subplot (2, 2, 1);
The plot (f, abs (y_zp (1: n/2)));
The title (' before filtering signal spectrum);
Subplot (2,2,2);
The plot (f, abs (X (1: n/2)));
The title (' after filtering signal spectrum);
Subplot (2, 2, 3);
The plot (y_z (1: n/2));
The title (' filtering signal waveform before ');
Subplot (2, 2, 4-trichlorobenzene);
Plot (x (1: n/2));
Title (' after filtering signal waveform)
Sound (x, fs) % audio playback after filtering