Question

The necessary MATLAB software for computer simulations and the speech/audio files (Ch4Sp8.wav, Ch4Au8.wav, and Ch4Au16.wav) can be obtained from the Book website. Linear predictive coding (LPC) a. Write a MATLAB program to load, display, and play back speech files. Use Ch4Sp8.wav for this computer exercise. b. Include a framing module in your program and set the frame size to 256 samples. Every frame should be read in a $256 \times 1$ real vector called Stime. Compute the fast Fourier transform (FFT) of this vector, i.e., $S f r e q=$ fft(Stime). Next, compute the magnitude of the complex vector Sfreq and plot its magnitude in $\mathrm{dB}$ up to the fold-over frequency. This computation should be part of your frame-by-frame speech processing program. Deliverable 1: Present at least one plot of time and one corresponding plot of frequencydomain data for a voiced, unvoiced, and a mixed speech segment. (A total of six plots - use the subplot command.) c. Pitch period and voicing estimation: The period of a strongly voiced speech signal is associated in a reciprocal manner to the fundamental frequency of the corresponding harmonic spectrum. That is, if the pitch period is $T$, the fundamental frequency is $1 / T$. Note that $T$ can be measured in terms of the number of samples within a pitch period for voiced speech. If $T$ is measured in $\mathrm{ms}$, then multiply the number of samples by $1 / F_s$, where $F_s$ is the sampling frequency of the input speech. Deliverable 2: Create and fill Table 4.2 for the first 30 speech frames by visual inspection as follows: when the segment is voiced enter 1 in the 2 nd column. If speech pause (i.e., no speech present) enter 0 , if unvoiced enter 0.25 , and if mixed enter 0.5 . Measure the pitch period visually from the timedomain plot in terms of the number of samples in a pitch period. If the segment is unvoiced or pause, enter infinity for the pitch period and hence zero for the fundamental frequency. If the segment is mixed, do your best to obtain an estimate of the pitch if it is not possible set pitch to infinity. Deliverable 3: From Table 4.2, plot the fundamental frequency as a function of the frame number for all thirty frames. This is called the pitch frequency contour. $$ \begin{aligned} &\text { Table 4.2. Pitch period, voicing, and frame energy measurements. }\\ &\begin{array}{lcccc} \hline \begin{array}{c} \text { Speech frame } \\ \text { number } \end{array} & \begin{array}{c} \text { Voiced/unvoiced/ } \\ \text { mixed/pause } \end{array} & \begin{array}{c} \text { Pitch } \\ \text { (number of } \\ \text { samples) } \end{array} & \begin{array}{c} \text { Frame } \\ \text { energy } \end{array} & \begin{array}{c} \text { Fundamental } \\ \text { frequency } \\ (\mathrm{Hz}) \end{array} \\ \hline 1 & & & \\ 2 & & & \\ \vdots & & & \\ \hline \end{array} \end{aligned} $$ Deliverable 4: From Table 4.2, plot also $i$ ) the voicing, and ii) frame energy (in $\mathrm{dB}$ ) as a function of the frame number for all thirty frames. d. The FFT and LP spectra: Write a MATLAB program to implement the Levinson-Durbin recursion. Assume a tenth-order LP analysis and estimate the LP coefficients ( $l p \_$coeff) for each speech frame. Deliverable 5: Compute the LP spectra as follows: $H_{-}$allpole $=$freqz $\left(1, l p \_c o e f f\right)$. Superimpose the LP spectra (H_allpole) with the FFT speech spectra (Sfreq) for a voiced segment and an unvoiced segment. Plot the spectral magnitudes in $\mathrm{dB}$ up to the foldover frequency. Note that the LPC spectra look like a smoothed version of the FFT spectra. Divide Sfreq by H_allpole. Plot the magnitude of the result in $\mathrm{dB}$ up to the fold-over frequency. What does the resulting spectrum represent? Deliverable 6: From the LP spectra, measure (visually) the frequencies of the first three formants, $\mathrm{F}_1, \mathrm{~F}_2$, and $\mathrm{F}_3$. Give these frequencies in $\mathrm{Hz}$ (Table 4.3). Plot the three formants across the frame number. These will be the formant contours. Use different line types or colors to discriminate the three contours. e. LP analysis-synthesis: Using the prediction coefficients (lp_coeff) from part (d), perform LP analysis. Use the mathematical formulation given in Sections 4.2 and 4.3. Quantize both the LP coefficients and the prediction $$ \begin{aligned} &\text { Table 4.3. Formants } F_1, F_2 \text {, and } F_3 \text {. }\\ &\begin{array}{llll} \hline \text { Speech frame number } & \mathrm{F}_1(\mathrm{~Hz}) & \mathrm{F}_2(\mathrm{~Hz}) & \mathrm{F}_3(\mathrm{~Hz}) \\ \hline 1 & & \\ 2 & & \\ \vdots & & \\ \hline \end{array} \end{aligned} $$ residual using a 3-bit (i.e., 8 levels) scalar quantizer. Next, perform LP synthesis and reconstruct the speech signal. Deliverable 7: Plot the quantized residual and its corresponding $\mathrm{dB}$ spectrum for a voiced and an unvoiced frame. Provide plots of the original and reconstructed speech. Compute the SNR in $\mathrm{dB}$ for the entire reconstructed signal relative to the original record. Listen to the reconstructed signal and provide a subjective score on a scale of 1 to 5 . Repeat this step when a 8-bit scalar quantizer is employed. In your simulation, when the LP coefficients were quantized using a 3-bit scalar quantizer, the LP synthesis filter will become unstable for certain frames. What are the consequences of this?

   The necessary MATLAB software for computer simulations and the speech/audio files (Ch4Sp8.wav, Ch4Au8.wav, and Ch4Au16.wav) can be obtained from the Book website.
Linear predictive coding (LPC)
a. Write a MATLAB program to load, display, and play back speech files. Use Ch4Sp8.wav for this computer exercise.
b. Include a framing module in your program and set the frame size to 256 samples. Every frame should be read in a $256 \times 1$ real vector called Stime. Compute the fast Fourier transform (FFT) of this vector, i.e., $S f r e q=$ fft(Stime). Next, compute the magnitude of the complex vector Sfreq and plot its magnitude in $\mathrm{dB}$ up to the fold-over frequency. This computation should be part of your frame-by-frame speech processing program.
Deliverable 1:
Present at least one plot of time and one corresponding plot of frequencydomain data for a voiced, unvoiced, and a mixed speech segment. (A total of six plots - use the subplot command.)
c. Pitch period and voicing estimation: The period of a strongly voiced speech signal is associated in a reciprocal manner to the fundamental frequency of the corresponding harmonic spectrum. That is, if the pitch period is $T$, the fundamental frequency is $1 / T$. Note that $T$ can be measured in terms of the number of samples within a pitch period for voiced speech. If $T$ is measured in $\mathrm{ms}$, then multiply the number of samples by $1 / F_s$, where $F_s$ is the sampling frequency of the input speech.
Deliverable 2:
Create and fill Table 4.2 for the first 30 speech frames by visual inspection as follows: when the segment is voiced enter 1 in the 2 nd column. If speech pause (i.e., no speech present) enter 0 , if unvoiced enter 0.25 , and if mixed enter 0.5 . Measure the pitch period visually from the timedomain plot in terms of the number of samples in a pitch period. If the segment is unvoiced or pause, enter infinity for the pitch period and hence zero for the fundamental frequency. If the segment is mixed, do your best to obtain an estimate of the pitch if it is not possible set pitch to infinity.
Deliverable 3:
From Table 4.2, plot the fundamental frequency as a function of the frame number for all thirty frames. This is called the pitch frequency contour.
$$
\begin{aligned}
&\text { Table 4.2. Pitch period, voicing, and frame energy measurements. }\\
&\begin{array}{lcccc}
\hline \begin{array}{c}
\text { Speech frame } \\
\text { number }
\end{array} & \begin{array}{c}
\text { Voiced/unvoiced/ } \\
\text { mixed/pause }
\end{array} & \begin{array}{c}
\text { Pitch } \\
\text { (number of } \\
\text { samples) }
\end{array} & \begin{array}{c}
\text { Frame } \\
\text { energy }
\end{array} & \begin{array}{c}
\text { Fundamental } \\
\text { frequency } \\
(\mathrm{Hz})
\end{array} \\
\hline 1 & & & \\
2 & & & \\
\vdots & & & \\
\hline
\end{array}
\end{aligned}
$$
Deliverable 4:
From Table 4.2, plot also $i$ ) the voicing, and ii) frame energy (in $\mathrm{dB}$ ) as a function of the frame number for all thirty frames.
d. The FFT and LP spectra: Write a MATLAB program to implement the Levinson-Durbin recursion. Assume a tenth-order LP analysis and estimate the LP coefficients ( $l p \_$coeff) for each speech frame.

Deliverable 5:
Compute the LP spectra as follows: $H_{-}$allpole $=$freqz $\left(1, l p \_c o e f f\right)$. Superimpose the LP spectra (H_allpole) with the FFT speech spectra (Sfreq) for a voiced segment and an unvoiced segment. Plot the spectral magnitudes in $\mathrm{dB}$ up to the foldover frequency. Note that the LPC spectra look like a smoothed version of the FFT spectra. Divide Sfreq by H_allpole. Plot the magnitude of the result in $\mathrm{dB}$ up to the fold-over frequency. What does the resulting spectrum represent?
Deliverable 6:
From the LP spectra, measure (visually) the frequencies of the first three formants, $\mathrm{F}_1, \mathrm{~F}_2$, and $\mathrm{F}_3$. Give these frequencies in $\mathrm{Hz}$ (Table 4.3). Plot the three formants across the frame number. These will be the formant contours. Use different line types or colors to discriminate the three contours.
e. LP analysis-synthesis: Using the prediction coefficients (lp_coeff) from part (d), perform LP analysis. Use the mathematical formulation given in Sections 4.2 and 4.3. Quantize both the LP coefficients and the prediction
$$
\begin{aligned}
&\text { Table 4.3. Formants } F_1, F_2 \text {, and } F_3 \text {. }\\
&\begin{array}{llll}
\hline \text { Speech frame number } & \mathrm{F}_1(\mathrm{~Hz}) & \mathrm{F}_2(\mathrm{~Hz}) & \mathrm{F}_3(\mathrm{~Hz}) \\
\hline 1 & & \\
2 & & \\
\vdots & & \\
\hline
\end{array}
\end{aligned}
$$
residual using a 3-bit (i.e., 8 levels) scalar quantizer. Next, perform LP synthesis and reconstruct the speech signal.

Deliverable 7:
Plot the quantized residual and its corresponding $\mathrm{dB}$ spectrum for a voiced and an unvoiced frame. Provide plots of the original and reconstructed speech. Compute the SNR in $\mathrm{dB}$ for the entire reconstructed signal relative to the original record. Listen to the reconstructed signal and provide a subjective score on a scale of 1 to 5 . Repeat this step when a 8-bit scalar quantizer is employed. In your simulation, when the LP coefficients were quantized using a 3-bit scalar quantizer, the LP synthesis filter will become unstable for certain frames. What are the consequences of this?
Show more…
Audio Signal Processing and Coding
Audio Signal Processing and Coding
Andreas Spanias, Ted… 1st Edition
Chapter 4, Problem 5 ↓

Instant Answer

verified

Step 1

wav, Ch4Au8.wav, and Ch4Au16.wav) from the Book website.  Show more…

Show all steps

lock
AceChat toggle button
Close icon
Ace pointing down

Please give Ace some feedback

Your feedback will help us improve your experience

Thumb up icon Thumb down icon
Thanks for your feedback!
Profile picture
The necessary MATLAB software for computer simulations and the speech/audio files (Ch4Sp8.wav, Ch4Au8.wav, and Ch4Au16.wav) can be obtained from the Book website. Linear predictive coding (LPC) a. Write a MATLAB program to load, display, and play back speech files. Use Ch4Sp8.wav for this computer exercise. b. Include a framing module in your program and set the frame size to 256 samples. Every frame should be read in a $256 \times 1$ real vector called Stime. Compute the fast Fourier transform (FFT) of this vector, i.e., $S f r e q=$ fft(Stime). Next, compute the magnitude of the complex vector Sfreq and plot its magnitude in $\mathrm{dB}$ up to the fold-over frequency. This computation should be part of your frame-by-frame speech processing program. Deliverable 1: Present at least one plot of time and one corresponding plot of frequencydomain data for a voiced, unvoiced, and a mixed speech segment. (A total of six plots - use the subplot command.) c. Pitch period and voicing estimation: The period of a strongly voiced speech signal is associated in a reciprocal manner to the fundamental frequency of the corresponding harmonic spectrum. That is, if the pitch period is $T$, the fundamental frequency is $1 / T$. Note that $T$ can be measured in terms of the number of samples within a pitch period for voiced speech. If $T$ is measured in $\mathrm{ms}$, then multiply the number of samples by $1 / F_s$, where $F_s$ is the sampling frequency of the input speech. Deliverable 2: Create and fill Table 4.2 for the first 30 speech frames by visual inspection as follows: when the segment is voiced enter 1 in the 2 nd column. If speech pause (i.e., no speech present) enter 0 , if unvoiced enter 0.25 , and if mixed enter 0.5 . Measure the pitch period visually from the timedomain plot in terms of the number of samples in a pitch period. If the segment is unvoiced or pause, enter infinity for the pitch period and hence zero for the fundamental frequency. If the segment is mixed, do your best to obtain an estimate of the pitch if it is not possible set pitch to infinity. Deliverable 3: From Table 4.2, plot the fundamental frequency as a function of the frame number for all thirty frames. This is called the pitch frequency contour. $$ \begin{aligned} &\text { Table 4.2. Pitch period, voicing, and frame energy measurements. }\\ &\begin{array}{lcccc} \hline \begin{array}{c} \text { Speech frame } \\ \text { number } \end{array} & \begin{array}{c} \text { Voiced/unvoiced/ } \\ \text { mixed/pause } \end{array} & \begin{array}{c} \text { Pitch } \\ \text { (number of } \\ \text { samples) } \end{array} & \begin{array}{c} \text { Frame } \\ \text { energy } \end{array} & \begin{array}{c} \text { Fundamental } \\ \text { frequency } \\ (\mathrm{Hz}) \end{array} \\ \hline 1 & & & \\ 2 & & & \\ \vdots & & & \\ \hline \end{array} \end{aligned} $$ Deliverable 4: From Table 4.2, plot also $i$ ) the voicing, and ii) frame energy (in $\mathrm{dB}$ ) as a function of the frame number for all thirty frames. d. The FFT and LP spectra: Write a MATLAB program to implement the Levinson-Durbin recursion. Assume a tenth-order LP analysis and estimate the LP coefficients ( $l p \_$coeff) for each speech frame. Deliverable 5: Compute the LP spectra as follows: $H_{-}$allpole $=$freqz $\left(1, l p \_c o e f f\right)$. Superimpose the LP spectra (H_allpole) with the FFT speech spectra (Sfreq) for a voiced segment and an unvoiced segment. Plot the spectral magnitudes in $\mathrm{dB}$ up to the foldover frequency. Note that the LPC spectra look like a smoothed version of the FFT spectra. Divide Sfreq by H_allpole. Plot the magnitude of the result in $\mathrm{dB}$ up to the fold-over frequency. What does the resulting spectrum represent? Deliverable 6: From the LP spectra, measure (visually) the frequencies of the first three formants, $\mathrm{F}_1, \mathrm{~F}_2$, and $\mathrm{F}_3$. Give these frequencies in $\mathrm{Hz}$ (Table 4.3). Plot the three formants across the frame number. These will be the formant contours. Use different line types or colors to discriminate the three contours. e. LP analysis-synthesis: Using the prediction coefficients (lp_coeff) from part (d), perform LP analysis. Use the mathematical formulation given in Sections 4.2 and 4.3. Quantize both the LP coefficients and the prediction $$ \begin{aligned} &\text { Table 4.3. Formants } F_1, F_2 \text {, and } F_3 \text {. }\\ &\begin{array}{llll} \hline \text { Speech frame number } & \mathrm{F}_1(\mathrm{~Hz}) & \mathrm{F}_2(\mathrm{~Hz}) & \mathrm{F}_3(\mathrm{~Hz}) \\ \hline 1 & & \\ 2 & & \\ \vdots & & \\ \hline \end{array} \end{aligned} $$ residual using a 3-bit (i.e., 8 levels) scalar quantizer. Next, perform LP synthesis and reconstruct the speech signal. Deliverable 7: Plot the quantized residual and its corresponding $\mathrm{dB}$ spectrum for a voiced and an unvoiced frame. Provide plots of the original and reconstructed speech. Compute the SNR in $\mathrm{dB}$ for the entire reconstructed signal relative to the original record. Listen to the reconstructed signal and provide a subjective score on a scale of 1 to 5 . Repeat this step when a 8-bit scalar quantizer is employed. In your simulation, when the LP coefficients were quantized using a 3-bit scalar quantizer, the LP synthesis filter will become unstable for certain frames. What are the consequences of this?
Close icon
Play audio
Feedback
Powered by NumerAI
Need help? Use Ace
Ace is your personal tutor. It breaks down any question with clear steps so you can learn.
Start Using Ace
Ace is your personal tutor for learning
Step-by-step explanations
Instant summaries
Summarize YouTube videos
Understand textbook images or PDFs
Study tools like quizzes and flashcards
Listen to your notes as a podcast
Continue solving this problem
Create a free account to:
  • View full step-by-step solution
  • Ask follow-up questions with Ace AI
  • Save progress and study later
Continue Free
Numerade

Get step-by-step video solution
from top educators

Continue with Clever
or



By creating an account, you agree to the Terms of Service and Privacy Policy
Already have an account? Log In

A free answer
just for you

Watch the video solution with this free unlock.

Numerade

Log in to watch this video
...and 100,000,000 more!


EMAIL

PASSWORD

OR
Continue with Clever