0:00

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.

5:19

And I am generating the whole fft of size for 112 samples.

On the right computer, the absolute value and

then here I plot the lock of that, so the [INAUDIBLE] value of that, so

let's show that, let's run test three okay and

this is one [INAUDIBLE] of a sine, [INAUDIBLE] frequency 4,000 hertz.

And if we zoom into that, we will see, yeah, this is the main loop, and

of course, this has been shifted exactly to have a center around 4,000 hertz.

If we go zoom in even more, we will see that the tip of this.

6:04

Peak is basically at 4,000 Hertz.

Okay, now let's talk about how to actually generate the time domain from that.

So we have to do the inverse fourier transform from that and

this is in this other script, I implement that.

So after having done the signs, I called inverse FFT and

then there is some code to undo the windowing of the Black Pahari's window.

We mentioned in the theory class that in order to have a good overlap

ad with not much small hub size.

It's good to undo the Blackman-Harris window and apply a triangular function.

And this is what we do in this part of the code.

We generate a synthesis window, which is SW, which is the result of

having a triangular window, divided by a Blackman-Harris window.

Okay, and this is what we multiply by

the inverse of the DFT of ting.

So let's run this code.

Let's run test 4.

7:37

so this is the complex spectrum of the sinusol or only the magnate is part

of that, so that we see both the negative and the positive side of that sinusoid.

So we in here the x-axis is not heard, so we don't see the exact values.

But these would correspond to the 4,000 frequency both positive and

the negative side of it in linear scale.

Okay, then what we do is we compute the inverse E of T so

we can plot the inverse E of T of that, so let's plot y okay?

And this is the window sinusoidal in the time domain and

we see it centered around 0, so we see the second half

of the window at the beginning and the first half at the end.

There is no 0 phase here, well there is no 0 padding

because we actually had the same window size and size, which was 512.

8:47

Okay? So once we do that, then we undo.

We divide by this window and multiply by a triangular window.

So we can show the result of that, which is yw.

Okay, and this is the signal that we would like to use in the overlap step.

So in which we have divided the black and

we have multiplied by a half length triangular window.

So it's only the original was for 112.

Now it's 256 samples.

So we would be able to overlap by half of that, so

we'll be able to overlap by 128 samples.

9:30

Okay so we have seen the whole syntheses

from some frequency values of a given sinusoid.

Let's put that together into a real analysis syntheses

of a fragment of a sound and this is in test five and in here.

We are reading a fragment of a noble sound and

we're going to do the DFT analysis then we will detect the peaks,

then we will extrapolate the peaks to get a more

accurate value of the location of the sinusoids.

And then we will do the synthesis of that

11:08

Okay so now from this process we have the magnitude frequency and

phase of each of these peaks and we can then compute the inverse of that and so

that we can plot the Y array in which has the inverse of that.

Here we have the zero-centered inverse F or

T of all these sinusoids of the oval sound.

And if we now center it and undo the black one and

obtain the multiplied by the triangular we can

plot the yw which would be this.

12:05

Okay so that's all I wanted to say.

Basically we have looked another component of the sinusoidal model.

We have done the peak sort of synthesis,

and before we talked about how to actually find the peaks.

And now what we are missing is the putting it all together into a complete analysis

synthesis system of time and worrying about the continuation of the sinusoid.

So this is what we going to be doing in the next programming lecture.

So I hope to see you then.

See you, bye-bye.