Skip to content Skip to navigation

Connexions

You are here: Home » Content » Speech Processing: LPC Exercise in MATLAB

Navigation

Content Actions

Speech Processing: LPC Exercise in MATLAB

Module by: Douglas L. Jones, Swaroop Appadwedula, Matthew Berry, Mark Haun, Jake Janovetz, Michael Kramer, Dima Moussa, Daniel Sachs, Brian Wade

Summary: You will write MATLAB code to compute the autocorrelation sequence of a simple signal. Then you will implement the Levinson-Durbin algorithm in MATLAB and analyze a recording of your own voice.

MATLAB Exercises

First, take a simple signal (e.g., one period of a sinusoid at some frequency) and plot its autocorrelation sequence for appropriate values of l l. You may wish to use the xcorr MATLAB function to compare with your own version of this function. At what time shift l l is r s s l r s s l maximized and why? Is there any symmetry in r s s l r s s l ? What does r s s l r s s l look like for periodic signals?

Next, write your own version of the Levinson-Durbin algorithm in MATLAB. Note that MATLAB uses indexing from 1 1 rather than 0 0. One way to resolve this problem is to start the loop with i=2 i 2 , then shift the variables k k, E E, α α, and r s s r s s to start at i=1 i 1 and j=1 j 1 . Be careful with indices such as i-j i j , since these could still be 0 0.

Apply your algorithm to a 20 20- 30 30 ms segment of a speech signal. Use a microphone to record .wav audio files on the PC using Sound Recorder or a similar application. Typically, a sample rate of 8 8 kHz is a good choice for voice signals, which are approximately bandlimited to 4 4 kHz. You will use these audio files to test algorithms in MATLAB. The functions wavread, wavwrite, sound will help you read, write and play audio files in MATLAB:

The output of the algorithm is the prediction coefficients a k a k (usually about P=10 P 10 coefficients is sufficient), which represent the speech segment containing significantly more samples. The LPC coefficients are thus a compressed representation of the original speech segment, and we take advantage of this by saving or transmitting the LPC coefficients instead of the speech samples. Compare the coefficients generated by your function with those generated by the levinson or lpc functions available in the MATLAB toolbox. Next, plot the frequency response of the IIR model represented by the LPC coefficients (see Speech Processing: Theory of LPC Analysis and Synthesis). What is the fundamental frequency of the speech segment? Is there any similarity in the prediction coefficients for different 20 20- 30 30 ms segments of the same vowel sound? How could the prediction coefficients be used for recognition?

Comments, questions, feedback, criticisms?

Send feedback