• Home
  • Textbooks
  • Audio Signal Processing and Coding
  • SINUSOIDAL CODERS

Audio Signal Processing and Coding

Andreas Spanias, Ted Painter, Venkatraman Atti

Chapter 9

SINUSOIDAL CODERS - all with Video Answers

Educators


Chapter Questions

Problem 1

Modify the DFT such that the frequency components are computed from $n=-\frac{N}{2}, \ldots, 0, \ldots, \frac{N}{2}-1$. Why is this approach useful in sinusoidal analysis-synthesis?

Check back soon!
00:52

Problem 2

In sinusoidal analysis-synthesis, we require the analysis window to be normalized, i.e., $\sum_{n=-N / 2}^{N / 2} w(n)=1$. Explain with mathematical arguments the reason for the use of this normalization.

Fuzail Shakir
Fuzail Shakir
Numerade Educator
04:39

Problem 3

Explain with diagrams, text, and equations how the sinusoidal birth-death frequency tracker works.

Sherry Tsui
Sherry Tsui
Numerade Educator

Problem 4

Let $s(n)$ be the input audio frame of size $N$ samples. Let $S(k)$ be the $N$-point DFT.
$$
S(k)=\frac{1}{N} \sum_{n=0}^{N-1} s(n) e^{-j 2 \pi k n / N}, \quad k=0,1,2, \ldots, N-1
$$

Obtain a $p$-th order frequency-domain AR model using least squares algorithm that fits the DFT spectral components. Assume that $p<N-1$.

Check back soon!

Problem 5

Write an algorithm that selects the $K$ peaks from an $N$-point DFT magnitude spectrum $(K<N)$. Assume that the $K$ spectral peaks are associated with pure tones in the input signal, $s(n)$. Design a sinusoidal analysissynthesis model that minimizes the MSE, $\varepsilon$,
$$
\varepsilon=\sum_n e^2(n)=\sum_n\left[s(n)-\sum_{k=1}^K A_k \cos \left(\omega_k n+\phi_k\right)\right]^2,
$$
where $s(n)$ is the input speech, $A_k$ represents the amplitude, $\omega_k$ represents the frequency, and $\phi_k$ denotes the phase of the $k$-th sinusoid. Hint: Refer to [McAu86].

Check back soon!
10:35

Problem 6

In this problem, we will design a sinusoidal analysis-by-synthesis (A-byS) algorithm. Use the sinusoidal model, $s(n) \approx \hat{s}(n)=\sum_{k=1}^K A_k \cos \left(\omega_k n\right.$ $\left.+\phi_k\right)$, where $A_k$ is the amplitude, $\omega_k$ represents the frequency, and $\phi_k$ denotes the phase of the $k$-th sinusoid. Attempting to minimize $E=$ $\sum_n e^2(n)=\sum_n\left[s(n)-\sum_{k=1}^K A_k \cos \left(\omega_k n+\phi_k\right)\right]^2$ with respect to $A_k, \omega_k$, and $\phi_k$ simultaneously would lead to a nonlinear optimization problem. Hence, design a suboptimal A-by-S algorithm to solve for the parameters separately. Hint: Start your design by assuming that the $(K-1)$ sinusoidal parameters are already determined and the frequencies, $\omega_k$, are known. The MSE will then become,
$$
\varepsilon=\sum_n[\underbrace{s(n)-\sum_{k=1}^{K-1} A_k \cos \left(\omega_k n+\phi_k\right)}_{e_{K-1}(n)}-A_K \cos \left(\omega_K n+\phi_K\right)]^2,
$$
where $e_{K-1}(n)$ is the error after $K-1$ sinusoidal components were determined. See [Geor87] and [Geor90] to obtain additional information.

Sajin Shajee
Sajin Shajee
Numerade Educator

Problem 7

Assuming that a cubic phase interpolation polynomial is used in a sinusoidal analysis-synthesis model, derive Eq. (9.7) using results from [McAu86].

Check back soon!

Problem 8

Write a MATLAB program to implement the sinusoidal analysis-bysynthesis algorithm that you derived in Problem 9.6. Use the audio file ch9aud1.wav. Consider a frame size of $N=512$ samples, no overlap between frames, and $K=20$ sinusoids. In your deliverables, provide the MATLAB program; give the plots of the input audio, $s(n)$, the synthesized signal, $\hat{s}(n)$, and the error, $e(n)=s(n)-\hat{s}(n)$ for the entire audio record.

Check back soon!
View

Problem 9

Use the MATLAB program from the previous problem and estimate the sample mean square error, $E_i=\mathrm{E}\left[e_i^2(n)\right]$ for each frame, $i$, where $\mathrm{E}[$. $]$ is the expectation operator.
a. Calculate the average MSE, $E_{\text {Avg }}=\frac{1}{N_f} \sum_{i=1}^{N_f} E_i$, where $N_f$ is the number of frames.
b. Repeat step (a) for a different number of sinusoids, e.g., $K=5,15,30$, 50 , and 60 . Plot $E_{\mathrm{Avg}}$ in $\mathrm{dB}$ across the number of sinusoids, $K$.
c. How does the MSE behave with respect to the number of sinusoids selected?

Victor Salazar
Victor Salazar
Numerade Educator

Problem 10

In this problem, we will study the significance of phase information in the sinusoidal coding of audio. Use the audio file $\operatorname{ch} 9 a u d 1 . w a v$. Consider a frame size of $N=512$ samples. Let $S_i(k)$ be the 512 -point FFT of the $i$-th audio frame, and $S_i(k)=\left|S_i(k)\right| e^{j \Phi_i(k)}$ where $\left|S_i(k)\right|$ is the magnitude spectrum and $\Phi_i(k)$ is the phase at the $k$-th FFT bin. Write a MATLAB program to pick 30 spectral peaks from the 512-point FFT magnitude spectrum. Set the rest of the spectral component magnitudes to a very small value, e.g., 0.000001 . Call the resulting spectral magnitude as $\left|\hat{S}_i(k)\right|$.
a. Set the phase $\Phi_i(k)=0$ and reconstruct the audio signal, $\hat{s}_i(n)=$ $\mathrm{IFFT}_{512}\left[\hat{S}_i(k)\right]$ for all the frames, $i=1,2, \ldots, N_f$.
b. Calculate the sample MSE, $E_i=\mathrm{E}\left[e_i^2(n)\right]$ for each frame, $i$. Compute the average MSE, $E_{\mathrm{Avg}}=\frac{1}{N_f} \sum_{i=1}^{N_f} E_i$, where $N_f$ is the number of frames.
c. Set the phase $\left.\boldsymbol{\Phi}_i=\pi(2 \operatorname{rand}(1,512)-1)\right)$, where $\boldsymbol{\Phi}_i$ is the $[1 \times 512]$ uniform random phase vector that varies between $-\pi$ and $\pi$. Reconstruct the audio signal, $\hat{s}_i(n)=\operatorname{IFFT}_{512}\left[\hat{S}_i(k) e^{j \Phi_i}\right]$ for all the frames. Note that you must avoid using the same set of random phase components in all the frames. Repeat step (b).
d. Set the phase $\Phi_i(k)=\arg \left[S_i(k)\right]$, i.e., we are using the input signal phase. Reconstruct the audio, $\hat{s}_i(n)=\operatorname{IFFT}_{512}\left[\hat{S}_i(k) e^{j \Phi_i(k)}\right]$ for all the frames. Repeat step (b).
e. Perform an experiment where the low-frequency sinusoids $(<1.5 \mathrm{kHz})$ use the input signal phase and the high-frequency components use random phase as in part (c). Compute $E_i$ and $E_{\text {Avg }}$ using step (b).
f. Give a dB plot of $E_i$ obtained from steps (a) and (b) across the number of frames, $i=1,2, \ldots, N_f$. Now superimpose the $E_i$ 's obtained in steps (c), (d), and (e). Which case performed better in terms of the MSE measure?
g. Evaluate to the synthesized audio obtained from steps (a), (c), (d), and (e). Which case results in better perceptual quality?

Check back soon!

Problem 11

In this problem, we will become familiar with the sinusoidal trajectories. Use the audio file ch9aud2.wav. Consider a frame size of $N=512$ samples, no overlap between frames, and $K=10$ sinusoids. Write a MATLAB program to implement the sinusoidal A-by-S algorithm [Geor90]. For each frame, $i$, compute the amplitudes $A_i^k$, the frequencies $\omega_i^k$, and the phases, $\phi_i^k$ of the $k$-th sinusoid.
a. Give a contour plot of the frequencies, $\omega_i^k$ versus the frame number, $i=1,2, \ldots, N_f$, associated with each of the 10 sinusoids.
b. Now assume a $50 \%$ overlap and repeat the above step. Comment on the smoothness and continuity of the frequency trajectories when frames are overlapped $50 \%$.

Check back soon!

Problem 12

Extend the Computer Exercise 9.8 when a $50 \%$ overlap is allowed between the frames. Use a Bartlett window or a Hanning window for overlap. See [Geor97] for hints on overlap-add A-by-S implementation. Do you observe any improvements in terms of audio quality when overlapping is employed?

Check back soon!

Problem 13

In this problem, we will design a hybrid subband/sinusoidal algorithm. Use the audio file ch9aud3_24k.wav. Consider a frame size of $N=512$ samples, no overlap between frames, and $K=20$ sinusoids. Note that the sampling frequency of the given audio file is $24 \mathrm{kHz}$.
a. Write a MATLAB program to design a sinusoidal A-by-S algorithm to pick 20 sinusoids in each frame. Compute the MSE, $\hat{E}=\frac{1}{N_f} \sum_{i=1}^{N_f} E_i$, where $N_f$ is the number of frames and $E_i=\mathrm{E}\left[e_i^2(n)\right]$ is the MSE at the $i$-the frame.
b. Modify the program in (a) to design a sinusoidal A-by-S algorithm to pick 15 sinusoids between $20 \mathrm{~Hz}$ and $6 \mathrm{kHz}$; and 5 sinusoids between $6 \mathrm{kHz}$ and $12 \mathrm{kHz}$ in each of the frames. Did you observe any performance improvements in terms of computational efficiency and/or perceptual quality?

Check back soon!