Professional Documents
Culture Documents
Homework 1
Homework 1
You may either bring a hard-copy of your homework to class on Wednesday, or you can email
me your homework. For the latter option, I recommend collecting all your plots and answers in a
single word processing document such as Microsoft Word.
a. Load the ex1_3.wav file into Matlab. You can either use Matlab’s Import Wizard, by
double-clicking on the filename in Matlab’s current directory window, or use the
wavread command (see help wavread for details).
b. Plot the speech signal against its index (n) by using the interactive tools or by using the
plot command. Label the axes and the plot appropriately.
c. Plot the speech signal as a function of time, and label the axes and the plot appropriately.
Hint: you need to create the a ‘time’ vector t, and then plot the signal with “plot(t,y)”.
You can create the correct time vector by dividing the speech signal’s index vector by the
sampling frequency of the signal, for example:
t = n / fs;
d. What is the duration of the signal in seconds? It may be helpful to use the figure’s zoom,
pan and data cursor tools.
e. Make a rough estimate of the distance in seconds between the peaks in the “zero” speech
signal around t=0.2 and t=0.4 seconds, corresponding to the two vowels. Again, it may be
helpful to use the figure’s zoom, pan and data cursor tools.
f. Convert the measured distances in seconds from part e into an estimate of the
fundamental frequency (in Hz) of the speech signal around t=0.2 and t=0.4 seconds.
–1–
SPHSC 503 – Speech Signal Processing UW – Summer 2006
In Matlab, both types of correlation can be computed using the xcorr function from the Signal
Processing Toolbox. For example,
a. Clear the workspace (clear), load the speech signal from problem 1.1 again, and extract
a voiced section of the speech signal using yvoiced1 = y(1900:2300); . Plot the
voiced section against its index, nvoiced1 = 1900:2300; .
b. Compute and plot the autocorrelation of the voiced section for lmax=250. You can
modify the example code above to do this. Label your x-axis as ‘Lag (in samples)’.
Notice the following in your plot of the autocorrelation: the autocorrelation has the highest peak
for zero lag (l=0). This is a necessary property of all autocorrelations. Then the autocorrelation
has strong positive peaks at equal distances to the left and right of the zero lag point.
c. Determine the value of the lag for the next strongest peak to the left and right. The zoom
tools of the plot window may be helpful for this.
d. Divide the value of the lag you found in part e by the sampling frequency to get the value
of the lag in seconds.
e. The value of the lag in seconds should correspond more or less to the distance between
the peaks you found in problem 1.1e for t=0.2. Is that the case for you? Convert the value
of the lag in seconds to a frequency in Hz. This value should correspond to the
fundamental frequency from problem 1.1f for t=0.2.
f. Repeat a-e for the second voiced section around t=0.4, nvoiced2 = 3800:4200;.
–2–
SPHSC 503 – Speech Signal Processing UW – Summer 2006
a. Download the file pitchestimate.m from the class website. This m-file contains the
Matlab function pitchestimate, which can be used as follows
b. Clear the workspace, load the speech signal again, and estimate and plot its fundamental
frequency using the pitchestimate function.
c. [optional] If you have access to a microphone, it could be interesting to record your own
voice and determine your own fundamental frequency.
–3–