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.

Â