Speech/Audio Signal Processing in MATLAB/Simulink
Speech/Audio Signal Processing in MATLAB/Simulink
Outline
Wave file manipulation
Reading, writing, recording ...
Time-domain processing
Delay, filtering, sptools …
Frequency-domain processing
Spectrogram
Pitch determination
Auto-correlation, SIFT, AMDF, HPS ...
Others
Formant estimation, speech coding
3
110/12/07 3
2006 Speech/Audio Signal Processing in MATLAB/Simulink
Toolbox/Blockset Used
MATLAB
Simulink
Signal Processing Toolbox
DSP Blockset
4
110/12/07 4
2006 Speech/Audio Signal Processing in MATLAB/Simulink
MATLAB Primer
Before you start, you need to get familiar with MATLAB.
Please read “MATLAB Primer” at the following
page:
http://neural.cs.nthu.edu.tw/jang/demo/demoDownload.
asp
Exercise:
1. Please plot two curves y=sin(2*t) and y=cos(3*t) in
the same figure.
2. Please plot x vs. y where x=sin(2*t) and y=cos(3*t).
5
110/12/07 5
2006 Speech/Audio Signal Processing in MATLAB/Simulink
6
110/12/07 6
2006 Speech/Audio Signal Processing in MATLAB/Simulink
Exercise :
1. Plot the waveform of “rrrrr.wav”. Use MATLAB’s “zoom” button to find the c
onsecutive curling “R” occurs.
2. Plot the two-channel waveform in “flanger.wav”.
7
110/12/07 7
2006 Speech/Audio Signal Processing in MATLAB/Simulink
8
110/12/07 8
2006 Speech/Audio Signal Processing in MATLAB/Simulink
9
110/12/07 9
2006 Speech/Audio Signal Processing in MATLAB/Simulink
Frame-based operation!
Exercise:
Create a model as shown above.
10
110/12/07 10
2006 Speech/Audio Signal Processing in MATLAB/Simulink
Solution
Solution to the previous exercise:
slWavFilePlay01.mdl
11
110/12/07 11
2006 Speech/Audio Signal Processing in MATLAB/Simulink
12
110/12/07 12
2006 Speech/Audio Signal Processing in MATLAB/Simulink
13
110/12/07 13
2006 Speech/Audio Signal Processing in MATLAB/Simulink
14
110/12/07 14
2006 Speech/Audio Signal Processing in MATLAB/Simulink
15
110/12/07 15
2006 Speech/Audio Signal Processing in MATLAB/Simulink
16
110/12/07 16
2006 Speech/Audio Signal Processing in MATLAB/Simulink
Synthetic Sounds
Use a sine wave generator (under DSP blocksets) to produce
sounds
Single frequency:
Multiple frequencies:
Amplitude modulation:
Exercise:
Create the above models.
17
110/12/07 17
2006 Speech/Audio Signal Processing in MATLAB/Simulink
Solution
Solution to the previous exercise:
sineSource01
sineSource02
sineSource03
18
110/12/07 18
2006 Speech/Audio Signal Processing in MATLAB/Simulink
Delay in Speech/Audio
What is a delay in a signal?
y(n) --> y(n-k)
What effects can delay generate?
Echo
Reverberation
Chorus
Flanging
19
110/12/07 19
2006 Speech/Audio Signal Processing in MATLAB/Simulink
Simulink model:
Exercise:
Create the above model.
20
110/12/07 20
2006 Speech/Audio Signal Processing in MATLAB/Simulink
-k
Input z Output y(n)
u(n)
21
110/12/07 21
2006 Speech/Audio Signal Processing in MATLAB/Simulink
22
110/12/07 22
2006 Speech/Audio Signal Processing in MATLAB/Simulink
23
110/12/07 23
2006 Speech/Audio Signal Processing in MATLAB/Simulink
Audio Flanging
Flanging sound:
• A sound similar to the sound of a jet plane flying overhead, or a "whooshing" sound
• “Pitch modulation” due to a variable delay
Simulink demo:
• dspafxf.mdl (all platforms)
• dspafxf_nt.mdl (for 95/98/NT)
24
110/12/07 24
2006 Speech/Audio Signal Processing in MATLAB/Simulink
Audio Flanging
Simulink model:
25
110/12/07 25
2006 Speech/Audio Signal Processing in MATLAB/Simulink
26
110/12/07 26
2006 Speech/Audio Signal Processing in MATLAB/Simulink
Speech Production
How is speech produced?
Speech is produced when air is forced from the
lungs through the vocal cords (glottis) and along
the vocal tract.
Analogy to System Theory:
Input: air forced into the vocal cords
Output: media vibration
System (or filter): vocal tract
Pitch frequency: frequency of the input
Formant frequency: resonant frequency
27
110/12/07 27
2006 Speech/Audio Signal Processing in MATLAB/Simulink
Zoom in
Overlap
Frame
29
110/12/07 29
2006 Speech/Audio Signal Processing in MATLAB/Simulink
Spectrogram
Spectrogram (specgram.m) displays short-time fre
quency contents:
Wave form :
Spectrogram :
30
110/12/07 30
2006 Speech/Audio Signal Processing in MATLAB/Simulink
Real-time Spectrogram
Try “dspstfft_win32”:
Spectrum: Spectrogram:
31
110/12/07 31
2006 Speech/Audio Signal Processing in MATLAB/Simulink
32
110/12/07 32
2006 Speech/Audio Signal Processing in MATLAB/Simulink
Spectrogram Reading
Spectrogram Reading
• http://cslu.cse.ogi.edu/tutordemos/SpectrogramRe
ading/spectrogram_reading.html
Waveform:
Spectrogram:
110/12/07 “compute” 33
33
2006 Speech/Audio Signal Processing in MATLAB/Simulink
34
110/12/07 34
2006 Speech/Audio Signal Processing in MATLAB/Simulink
s(k):
s(k-):
Autocorrelation
x():
Exercise:
Construct the above model and try it.
36
110/12/07 36
2006 Speech/Audio Signal Processing in MATLAB/Simulink
37
110/12/07 37
2006 Speech/Audio Signal Processing in MATLAB/Simulink
Formant Analysis
Characteristics of formants:
• Formants are perceptually defined.
• The corresponding physical property is the
frequencies of resonances of the vocal tract.
• Formant analysis is useful as the position of the
first two formants pretty much identifies a vowel.
Computation methods:
• Peak picking on the smoothed spectrum
• Peak picking on the LP spectrum
• Factoring for the LP roots
• Fitting of mixture of Gaussians
38
110/12/07 38
2006 Speech/Audio Signal Processing in MATLAB/Simulink
Formant Analysis
Track Draw:
• A package for formant synthesis with options to sk
etch formant tracks on a spectrogram.
• http://www.utdallas.edu/~assmann/TRACKDRAW/tr
ackdraw.html
Formant Location Algorithm
• MATLAB code by Michelle Jamrozik
• http://ece.clemson.edu/speech/files.htm
39
110/12/07 39
2006 Speech/Audio Signal Processing in MATLAB/Simulink
40
110/12/07 40
2006 Speech/Audio Signal Processing in MATLAB/Simulink
Conclusions
Ideal tools for speech/audio signal processing:
• MATLAB
• Simulink
• Signal Processing Toolbox
• DSP Blockset
Advantages:
• Reliable functions: well-established and tested
• Visible graphical algorithm design tools
• High-level programming language yet C-compatible
• Powerful visualization capabilities
• Easy debugging
• Integrated environment
41
110/12/07 41
2006 Speech/Audio Signal Processing in MATLAB/Simulink
References
42
110/12/07 42