Home > other >  MATLAB digital signal processing filter design
MATLAB digital signal processing filter design

Time:11-02

Design purpose and the content

Through digital signal processing (DSP) great job design, consolidate and use of digital signal processing course of theoretical knowledge and experimental skills, to master the basic theory and method of digital signal processing, the topic of this design is: speech signal processing and filtering,
Specifically to a voice signal sampling; Draw the speech signal after sampling time domain waveform and spectrum graph; And then to the sampling signal to noise, using the bilinear transform IIR filter design; And then used to design the filter for filtering, plus noise signals of the filtered signal time domain waveform and spectrum, and compared the filter before and after the signal, analyzing the change of the signal; Replay the original respectively, add noise, speech signal after filtering, feel the visual change,

Design principle of

1. Speech signal acquisition
Speech signal is a analog signal, must first convert them into digital signals through sampling and essence is the continuous signal into pulse or sequence of Numbers, we use Windows 10 bring the tape recorder to record a mp3 format audio, and then use MATLAB audioread function sampling, cooperate with the sound function to use,
2. The spectrum characteristics of speech signal is
In MATLAB, can use the function FFT to fast Fourier transform of signal, get signal spectrum characteristics,

3. The voice signal analysis of time domain
Speech signal in the time domain analysis is to analyze and extract the time domain parameters of speech signal, speech analysis, it is the first come into contact with and is also the most intuitive of the time domain waveform, the speech signal is time domain signals, thus the time domain analysis is the first to use, is also one of the most widely used analytical method, this method directly using speech signal in the time domain waveform,

The design process

1. Speech signal acquisition
We use Windows 10 bring the tape recorder to record a mp3 format audio, I recorded a period of 30 seconds of music, will then use the MATLAB audioread function for this section of speech samples, fit the sound function can broadcast the voice signal

2. On speech signal spectrum analysis
Processing speech signal in the time domain waveform figure of speech signal to carry on the fast Fourier transform, the signal spectrum,



After the operation can play original music, and the time domain waveform and spectrum graph:






Speech signal with noise and playback noise speech signal
Randn function noise and should be added to the original speech signal,


After the operation, will play after add noise speech signal, can hear there is a clear "snow", and in the following figure the time domain waveform and spectrum graph:


According to the index design digital filter
Can use window function method, bilinear transformation method design low-pass, high-pass, band-pass, three kinds of filter, I choose bilinear transformation method to carry on the design of low pass filter,

After the operation can get filter characteristic figure

With filter for signal filtering and playback filtering speech signal

After the operation, the signal to noise ratio and noise is small, but also can hear some sound "snow", its waveform, spectrum is as follows:
(I also use the ellipord function, respectively designed low-pass, high-pass, band-pass filter, but in addition to the low pass filter has a certain effect, qualcomm and bandpass filter are not well effect)

Design summary
Through this course design, let me have a thorough knowledge of MATLAB, because only a computer installed the 2018 a version of the MATLAB, in class I used MATLAB is different, so to check a lot of information, large, to finish the work on this design main reference the CSDN design, some bosses do see them much code, oneself slowly learned how to write some code, and the effect of some code, this design let me know how, to do one thing needs a lot of a lot of effort, effort will have harvest,

Appendix: experimental program

Double-click the icon to open the recording, the program in the operation of the press any key to continue
===============big job experiment program===============
[x, fs]=audioread (' E: \ \ music MATLAB mp3 '); % voice read
Sound (x, fs); % played the original voice
X=x (:, 1);
FS=length (x); % and the length of the original speech signal
X=FFT (X); Fourier transform %
T=(0: FS - 1)/FS.

Figure (1)
subplot(211);
The plot (t, x);
The title (' original speech signal time domain waveform);
Xlabel (' time ');
Ylabel (' margin ');
The grid on;
% according to coordinate grid lines
subplot(212);
The plot (abs (X));
The title (' original speech signal spectrum);
Xlabel (' frequency ');
Ylabel (' margin ');
The axis (20] [0. 1400000);
The grid on;
Pause; % to suspend

FS=length (x);
Whose=0.01 * randn (FS, 1); % noise adding
S=x + noise;
Sound (s, fs); % play plus noise speech
N=length (s); % draw after adding noise, the time domain and frequency domain
S=FFT (S, N);

Figure (2)
Subplot (211)
The plot (s);
The title (' after add noise signal waveform)
Xlabel (' time ');
Ylabel (' margin ');
The grid on;

Subplot (212)
The plot (abs (fftshift (S)));
Xlabel (' frequency ');
Ylabel (' margin ');
The axis (20] [0. 1400000);
The title (' after add noise signal spectrum);
The grid on;
Pause;


% design IIR low-pass filter
The Rp=2; Rs=80;
Ft=8000; % sampling frequency
Fp=2000;
Fs=1000;
Wp=2 * PI * Fp/Ft;
Ws=2 * PI * Fs/Ft; % and to design the boundary of the analog filter frequency

[N, wn]=buttord (wp, ws, Rp, Rs, 's'); % analog filter design transition: calculate the cut-off frequency of the corresponding analog filter order number N and wn
[b, a]=butter (N, wn, 's'); % S frequency domain response parameters: calculate the corresponding analog filter system function
[bz, az]=bilinear (b, a, 0.5); % by using bilinear transformation converts digital filter

Figure (3);
% drawing[h, w]=freqz (bz, az); % low-pass filter feature
The title (' IIR low-pass filter);
The plot (fs/w * (2 * PI), abs (h));
The grid on

% filteringZ=filter (bz, az, s); % filtering draw its spectrum, waveform
Z=FFT (Z); % after filtering signal spectrum
Figure (4)
subplot(211);
The plot (z);
The title (' after low pass filtering of signal waveform);
Xlabel (' time ');
Ylabel (' margin ');
The grid on;

subplot(212);
The plot (abs (fftshift (Z)));
The title (' after low pass filtering signal spectrum);
Xlabel (' frequency ');
Ylabel (' margin ');
The axis (20] [0. 1400000);
The grid on;
Sound (z, fs); % playback after filtering signal
Pause;

=================additional test procedure================

[x, fs]=audioread (' E: \ \ music MATLAB mp3 '); % voice read

X=x (:, 1);
FS=length (x); % and the length of the original speech signal
X=FFT (X); Fourier transform %
T=(0: FS - 1)/FS.
Figure (1)

subplot(211);
The plot (t, x);
The title (' original speech signal time domain waveform);
Xlabel (' time ');
Ylabel (' margin ');
The grid on;
% according to coordinate grid lines
subplot(212);
The plot (abs (X));
The title (' original speech signal spectrum);
Xlabel (' frequency ');
Ylabel (' margin ');
The axis (20] [0. 700000);
The grid on;
Sound (x, fs); % played the original voice
Pause; % to suspend

FS=length (x);
Whose=0.01 * randn (FS, 1); % noise adding
S=x + noise;
N=length (s); % draw after adding noise, the time domain and frequency domain
S=FFT (S, N);

Figure (2)
Subplot (211)
The plot (s);
The title (' after add noise signal waveform)
Xlabel (' time ');
Ylabel (' margin ');
The grid on;

Subplot (212)
The plot (abs (fftshift (S)));
Xlabel (' frequency ');
Ylabel (' margin ');
The axis (20] [0. 700000);
The title (' after add noise signal spectrum);
The grid on;
Sound (s, fs); % play plus noise speech
Pause;


% design IIR low-pass filter
The Rp=2;
Rs=80;
Ft=8000; % sampling frequency
Fp=2000;
Fs=1000;
Wp=2 * PI * Fp/Ft;
Ws=2 * PI * Fs/Ft; % and to design the boundary of the analog filter frequency

[N, wn]=buttord (wp, ws, Rp, Rs, 's');
[b, a]=butter (N, wn, 's');
[bz, az]=bilinear (b, a, 0.5);

Figure (3);
% drawing[h, w]=freqz (bz, az); % low-pass filter feature
The title (' IIR low-pass filter);
The plot (fs/w * (2 * PI), abs (h));
The grid on

% filteringZ=filter (bz, az, s); % filtering draw its spectrum, waveform
Z=FFT (Z); % after filtering signal spectrum

Figure (4)
subplot(211);
The plot (z);
The title (' after low pass filtering of signal waveform);
Xlabel (' time ');
Ylabel (' margin ');
The grid on;

subplot(212);
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related