Lab 8: Sinusoidal plus Residual Modeling

The Sinusoidal plus Residual Modeling assumes that the sinusoids model the stable partials or harmonics of a sound, which could also be called the deterministic component of the sound. The residual models the noisy part of the sound, which could also be called the stochastic component of the sound. The residual is obtained by subtraction the sinusoidal components from the original sound, which then can be modeled as an stochastic signal.

In this lab we will be subtracting the sinusoidal components in the frequency domain. In order to do that we will have to analyze the sound with a Blackman-Harris 92dB window in order to be able to subtract the main lobe of that window in the spectrum.

To do this lab you can start from the harmonicmodel.m using the functions given in lab-7, converting it to sinesplusresmodel.m

8.1 Sinusoidal subtraction

1. Subtract the complex spectrum of the sines obtained by the function genspecsines (ex: Xsines = genspecsines(ihloc,ihmag,ihphase,M,N,bh92lobe);) from the original complex spectrum at each frame, (ex: Xres = X - Xsines;).

2. Synthesize the residual sound by performing the inverse-fft of the residual spectrum and applying the same synthesis window used in the harmonic model. ex:

8.2 Residual approximation

1. Approximante the magnitude of the residual spectrum by line segments given a step size that will be the number of bins to approximate by a single value. ex:
Synthesize the residual approximation by generating noise with the frequency characteristics of the spectral envelope of the residual.
  1. Generate a new residual magnitude spectrum, mXres, by interpolating the approximation, resenv, to the N2 size.
  2.  Generate the phase spectrum, pXres, by filling it with random numbers from 0 to 2pi. 
  3. Create the complex spectrum by Xres = mXres.*cos(pXres)+i*mXres.*sin(pXres);

8.3 Tunning the model parameters

Analyze several harmonic sounds with the obtained model. The function should be defined by
  1. Try different parameters, specially window-size, FFT size, hop-size, magnitude threshold, number of harmonics, maximum f0 error, and maximum  harmonic deviation.
  2. Describe the effect of these changes

8.4 Trying another model implementation

You can try a complete implementation of the model by using the sms.m code, which does not perform the residual approximation. Compare the two implementations.