Welcome back to the course analyzing or processing from music applications.

In the previous program in class we talked about the spectral peaks and

how to program them.

How to detect the values of the spectral peaks.

And that was the beginning of implementing

the analysis synthesis using a sinusoidal model.

So we identify the values of spectral beats which hopefully

correspond to sinusoids.

So in this second class,

I want to introduce an idea of how to synthesise a sinusoid from those beats.

So how to do, basically, additive synthesis.

So we will be doing it in the frequency domain, like we talked in the theory

lecture, in which we are basically synthesizing the main

loops of a Blackman window and then inverse DFT of that.

So this equation shows the idea that we synthesize the sound

Y by taking the inverse IDFT of a sum of main lobes.

And in here we see the plot of that.

We see the main lobes already been generated.

The faces have already been generated,

and then we take the numbers of that to generate the synthesized sound.

So let's show that.

And we first have to actually learn how to synthesize a lobe of blackman window.

In this little code I show that.

So we call this function called genBhLobe and

we give it the samples, the bins that we want to generate.

So since we only want to generate the main lobe,

we just give the eight centered beans of that.

But first, let's look at these functions, in the h load,

which comes from the UTIL functions file.

And in here we have this Gen BH load which implements the generation of.

We don't directly in the spectrum.

In the spectrum domain of window is the sum of four sync functions.

And this is what this main loop does.

It generates four sync functions and it's something together, its sinc function

has a coefficient that comes from the equation of the Blackman-Harris window.

And then in this of this sync function we call a function called sync.

Which also is here, which is what generates one particular sin function.

Again, it only generates one lope, not the entire sine function.

Okay so, with these two functions, we are able to generate

the main lope of the window, let's run this code.

Okay, we run this too and if we show the output X, capital X,

these are the eight samples of window in a linear scale.

So the center is this fifth sample which is value 1.

If we take the absolute, well the lock of that, so

20 times lock ten of this x,

we will see in lock scale, okay.