Filtering of noisy speech signal based on MATLAB

Realization of GUI Interface Design of MATLAB Digital Filter

one. Brief description of the filter

The design method of IIR digital filter and FIR digital filter in the MATLAB environment is the implementation method, and a graphical user interface is designed to display the design characteristics of the introduced mini-filter.

In the design of the wireless impulse response (IIR) digital filter, the design of the analog filter is carried out first, and then the analog-to-digital filter conversion is carried out, that is, the digital filter is designed by using the impulse response invariant method and the bilinear Z change method, and finally the Filter band conversion. In the design of finite impulse response (FIR) digital filter, the characteristics of FIR linear phase filter and the design of FIR digital filter with window function are discussed. The whole process of the two types of filters is carried out according to the steps of theoretical analysis, programming design, and collective realization. In order to facilitate the analysis of intuitive, visual, and convenient analysis of the characteristics of the filter, a graphical user interface --- filter analysis system is innovatively designed. The whole system is divided into two interfaces, and its content mainly includes four parts: System (system), Analysis (analysis), Tool (tool), Help (help).

Digital filtering occupies an important position in DSP. Digital filters are divided into IIR (infinite impulse response) and FIR (finite impulse response) filters according to the realized network structure or from the unit impulse response. If the IRR filter and the FIR filter have the same performance, then usually the IIR filter can obtain high selectivity with a lower order, faster execution speed, and less storage units, so it is economical and efficient.

two. Design requirements

1. Record a voice signal on the matlab platform;

2. Complete the spectral analysis of the speech signal;

3. Add noise to the speech signal and analyze the spectrum of the signal after noise addition;

4. Select the appropriate filter for filtering and determine the relevant indicators;

5. Realize the filtering process, display the filtered results, and perform spectrum analysis.

three. Experimental content and steps

  1. Recording of voice signals

Open the matlab platform, first use the R=audiorecorder(44100,16,2) function to create an object to store audio information, where 44100 means the sampling frequency is 44100Hz, 16 means 16-bit storage, and 2 means two channels. Then use record (R) to start recording, collect the sound into the computer microphone, and the recorded audio content is "MATLAB course assignment". The stop(R) statement stops recording. The audio information is then stored in a digital matrix. Finally, use the wavwrite function to save this audio.

original voice

R=audiorecorder(44100,16,2);


v2-9d5be021baff16954e286bc2ddf78c57_b.jpg

record(R);

stop(R);

myword=getaudiodata(R);

plot(myspeech)

wavwrite(myspeech,44100,16,'myword');

program map

Waveform diagram:

It can be seen from the output waveform diagram that when the audio information of "Matlab's course assignment" is collected, the fluctuation is obvious, but there are also slight fluctuations in other places due to the influence of the environment.

  1. Spectral Analysis of Speech Signals

wavread reads audio stored on your computer. The suond function plays back the voice signal, and fft(y,n) performs Fourier transform on n points to realize the transition from the time domain to the frequency domain. Then use the plot function to draw the time-domain waveform and frequency-domain waveform of the speech signal.

 [y,fs,bits]=wavread('D:\Matalbe123\bin\souds.wav'); 
sound(y,fs);
n=length(y);
y_f=fft(y,n);
f=fs*(0:n/2-1)/n;
subplot 211;
plot(y);
xlabel('时间s');
ylabel('幅值 ');
title('加噪前的时域波形');
subplot 212;
plot(f,abs(y_f(1:n/2)));
xlabel('频率Hz');
ylabel('频率幅值');
title('加噪前的频谱图');
程序图:


v2-0cd377e7615b8a266bbe2252f0cecc6c_b.jpg

The time domain waveform and spectrum diagram are as follows:

It can be seen from the time-domain waveform diagram that the sound signal is mainly concentrated between 2.5s and 5.0s, and there are only a small amount of fluctuations in other times. It can be seen from the frequency domain waveform diagram that the frequency of the sound signal is consistent with the frequency of human vocalization.

  1. Speech Noise Addition and Spectral Analysis

Add noise to the original speech signal, and use the randn function to generate a Gaussian random noise signal with the same length as the audio signal (the size of the noise depends on the amplitude multiple of the random function). Then through the superposition of signals y_z=y+noise;, a new signal is generated. Then the waveform of the signal in the frequency domain is obtained by Fourier transform, and finally the time domain and frequency domain waveforms are drawn.

L=length(y);
noise=0.1*randn(L,2);
y_z=y+noise;
sound(y_z,fs);
n=length(y);
y_zf=fft(y_z,n);
f=(0:n/2-1)/n;
subplot 211;
plot(y_z);
xlabel('时间s');
ylabel('幅值');
title('加噪后的时域波形');
subplot 212;
plot(f,abs(y_zf(1:n/2)));
xlabel('频率Hz');
ylabel('频率幅值');
title('加噪后的频谱图');
程序图:

The waveform diagram is as follows:

When the above program is executed, the noisy sound layer will be heard, and the frequency is much higher than the original voice. Comparing the spectrogram after adding noise with the spectrogram before adding noise, it is obvious that there are many more frequency changes in the original time. The observed changes in the spectrogram are consistent with our purpose, and the noise addition is successful.

  1. filter design

Because the frequency of the noise signal is higher than the frequency of the original voice signal, the FIR low-pass filter is selected. In digital signal processing, the impulse response invariance method will produce spectrum aliasing, which will make the frequency response deviate from the frequency response characteristics of the analog filter. To avoid this phenomenon, we use the bilinear transformation method. Tried fp=1000;fc=1200;As=100;Ap=1;

fp=1100;fc=1300;As=100;Ap=1;

fp=1300;fc=1500;As=100;Ap=1;

fp=1400;fc=1600;As=100;Ap=1;

fp=1500;fc=1700;As=100;Ap=1;

The group with the best effect is: fp=1300;fc=1500;As=100;Ap=1;

So the design is as follows:

fp=1300;fc=1500;As=100;Ap=1;

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=(wp+wc)/2/pi;

b=fir1(N,ws,wn);

freqz(b,1);

Program diagram:

The frequency characteristics of the filter are shown in the figure

  1. Filtering Results and Spectrum Analysis

The noise-added audio is filtered through this filter, and then the spectrum analysis of the filtered denoising signal is performed. The function x=fftfilt(b,y_z) is selected, and the signal is filtered by the overlap-add method of FFT.

The list of filtering programs is as follows:

x=fftfilt(b,y_z);

X=fft(x,n);

subplot 211;

plot(f,abs(X(1:n/2)));

title('Filtered spectrum');

subplot 212;

plot(x);

title('filtered waveform');

sound(x,fs,bits)

Program diagram:

v2-12c6a021680b707ce185ccdafcdc060f_b.jpg



v2-d37da759b056108375906a16e2d18840_b.jpg

The spectral analysis after denoising is shown below:

The audio heard after executing the program still contains noise signals, which is not as clear as the original voice, but it is significantly improved compared to the noise-added voice, and the original voice can be heard more clearly. It can be seen from the spectral analysis diagram that the audio signal with a frequency higher than 1500Hz has been filtered out, and it is beginning to be a bit close to the waveform diagram of the original signal.

Four. Speech Signal Diagram


v2-e2fd516a0854148c3dab84417aa0dbea_b.jpg

original voice


v2-2bf48bc395e55ab8c9154ee96025793c_b.jpg

After adding noise


v2-d37da759b056108375906a16e2d18840_b.jpg

After noise reduction

  1. Experimental summary and experience

This time, Matlab is used to perform a series of operations on the processing of speech signals. The voice recording, noise addition, filtering and spectral analysis are realized on the Matlab platform. Comparing the noise-added spectrum, it can be found that the noise higher than 1500Hz has been filtered out, and the sharp interference noise can also be found through the playback of the sound. Because the designed filter program has a single function, it can only process speech signals under general conditions, and cannot process speech signals with high precision.

Matlab is the abbreviation of Matrix Laboratory in English. It is a mathematical calculation for graphics processing and numerical calculation launched by Math Word Company in the United States. Under the Matlab environment, users can perform operations such as program design, graphic drawing, digital value calculation, and input and output file management in an integrated manner. MATLAB's excellent numerical calculation ability and excellent data visualization ability make it stand out among similar software.

Guess you like

Origin blog.csdn.net/TuTu998/article/details/120177083