0:01

Hello, welcome back to the course in Audio Signal Processing for Music Applications.

In the previous demo classes of this week, we have analyzed some sounds.

We analyzed some electronic periodic signals and we analyzed some real sounds.

And we used Audacity and Sonic Visualizer specially to look

at the spectrum of these sounds.

And now in this lecture, I want to continue that and try to use

the tools that we have developed for this particular paths, so the SMS tools.

And do the DFT analysis to see if we can understand some sound.

0:45

So let's first open, with Audacity, a file so

we can see the overall view of the sound, okay.

So let's take the violin sound, okay, so

this is a note of a violin it's quite stable.

So we can see that it's the length of two seconds but

instead of using Audacity let's analyze it with the interface of SMS tools.

1:29

and this will open up the interface, okay.

This is the interface of the sms tools

where it has all these different models that we're going to be talking about.

And now let's go to open up the violin sound and

using the DFT module, so we can hear the violin.

[SOUND] Okay, so we hear this note of the violin and

in the parameters, well let's choose a size,

a portion of a sound to analyze and for example, let's use 512.

We have to use a power of two for

the FFT size because the FFT algorithm requires that.

And we don't have to use the window size of the same length, but for

now let's do that.

And now we have to choose where we take these 512 samples,

let's say we choose the middle of the sound so

let's take in second one and we compute it, okay.

So this is the analysis results, so

these are the 512 samples starting with the second one.

And then we have computed the DFT of that using the FFT algorithm.

And we are displaying half of the spectrum,

we are displaying the positive side because it's symmetric.

So therefore the negative side is not

required because it has the same information.

So we're just plotting the positive side both for

the magnitude and the phase spectrum.

3:16

In the x axis we are plotting frequency in hertz and

so we are plotting from zero to half the sampling rate, okay?

So the sampling rate was 44,100, so here we are plotting up to 22,050, okay.

And the amplitude in the magnitude spectrum is in decibels as we explain,

so we are showing it in DD and the maximum amplitude is minus 20.

So here we don't have a complete the signal only reach point 4 so

that corresponds to minus 20 decibels and it goes down to minus 120.

And the phase we're plotting it using the unwrapping function.

So instead of limiting the phase from zero to two pi,

we let it unwrap so that we see a match smoother shape and

that's going to be quite good, quite useful.

And then finally out of this we compute the inverse and

we compute another time domain signal.

It's not the same than the input signal because we

have applied a window in the input signal and this is what we are seeing here.

This is the windowed version that is the one

that is basically captured in the spectrum.

4:41

Okay, now let's try to see if we can understand something on the sound, and

typically the magnitude spectrum is the most useful one.

Here, well, we see things but maybe we don't see what we would like

to see which kind of visualize the harmonics of that.

So this might be because this is not enough samples, we don't

have enough information to visualize and separate all these frequencies.

We need a bigger frequency analysis, so

instead of 512 let's take the next power of tool,

so the next FFT size, 1,024 and let's compute it.

5:33

the previous one that, of course, we have taken more samples.

And the magnitude spectrum gives us some more information, for

example, here, we see clearly these peaks and this corresponds

to the harmonics of the sound, so that's a quite useful information.

Okay, now maybe in order to see what can

we understand about the sound let's look at another portion of the sound.

Of course as we saw the sound is quite stable but

if we go into the beginning, if we zoom into the very beginning

of the sound there is a region of the attack that's a little bit different.

So let's see we can capture that difference, so let's go back to our

interface and let's do the same analysis but instead of doing

the analysis at time one, let's do it at time zero so we compute from time zero.

6:46

And what we're also seeing is that this spectrum is a little bit different, okay.

We see, during the attack that maybe the harmonics are not so

clear, because at the beginning of the sound,

there is more the attack of the bow of the noise.

So the harmonics are not so well identified, whether in

the middle of the sound, clearly the harmonics are stronger Instead,

at the beginning there is more noise.

So these irregularities that we see in the time domain wave form are capturing

the spectrum by seeing all these more kind of random and

irregular shapes we see in this spectrum.

7:41

Now let's go back to the window of the control parameters,

let's go back to the middle of the sound.

And let's talk about the difference between how many samples we take and

the 50 size we compute.

We do not have to take the same number of samples of the F50,

for example, we can take 801 samples and

then zero part to the F50 size and compute the result.

So, if we do that, okay, this

is similar to the previous analysis we did,

8:26

before in which we took more samples.

We took 1,024, and now there is less samples and

the spectrum, well they look okay both.

Of course in the one that we took more samples of the input signals,

we see the harmonics a little bit better than the one

that we have computed now with 800 samples.

But is as smooth as the previous one, so both are equally smooth,

this is because the F50 size in both cases is 1,024.

Okay, now let's maybe get rid of the one we just computed and

let's compute again the 1,024

samples which maybe the most useful one.

9:31

by zooming into the beginning where it seems that

the most activity and the most interesting information is.

So with these figure interface of Python we can choose a rectangle,

so for example in the magnitude spectrum we can just choose the first

5,000 Hertz, okay.

And we can see these harmonics,

the peaks of the first 5,000 Hertz quite more clearly and

we can do the same thing with the phase spectrum.

10:11

Okay, so we'll take the first 5,000 Hertz, and

this is the phase of what corresponds to these frequencies, the same frequencies.

Okay, now we can start seeing other things of the sound, for

example, we can see that these peaks are equally spaced.

And we can look at the frequency of them here in the lower

right corner it tells us what is the location of the x

of the cursor at the x-axis and

we see that it is around 240 hertz, okay.

Because the dimension is in hertz and

if we look at the next one it's around 480 hertz,

so in fact these are the harmonics of the sound.

The first is the fundamental so the fundamental is around 240 hertz and

this is twice the fundamental and these will be all the multiples,

the harmonic multiples of the fundamental.

Okay, so that's good, so that's a way to identify the fundamental frequency

11:25

of the sum and in the phase spectrum, it's pretty nice.

Basically what we are seeing In the corresponding frequency of the harmonics,

we are seeing the phase of these harmonics,

the phase at time zero, where we have a centered analysis.

So if we look here, for example, the corresponding location of the first

harmonic, it says that it is around minus two point eight radians.

Because the vertical axis is in radians and this is in fact

the phase at time zero oft this particular harmonic.

And we can go to the next harmonic and measure the phase or to the next harmonic.

So visually we can identify the magnitude and phase of the components

of this sound, so that's going to be very important and very useful.

And clearly with these interface with the SMS tools we can zoom into the sound

in ways that the Sonic Mutualizer or the Audacity was not so easy to do.

12:39

So anyway, so that's all I wanted to say.

So basically we have gone through

the SMS tools, these interface of the DFT in particular.

And we have analyze a violin sound which is available in free sound and

we have played around a little bit with different parameters of the DFT.

13:04

Okay and that's all for today, with these three demonstration classes

we have tried to see the different tools that we can use for

analyzing the sound, visualizing the time domain, visualizing the spectrum.

But of course there is much more to do, so next week,

we will continue and we will go into a little bit more complicated things.

So I hope to see you then, byebye.