0:00

Welcome again to the course on audio signal processing for music applications.

In this lecture, I start with our most fundamental topic,

the Discrete Fourier Transform.

If you can follow and

understand this topic, you should have no problem in following the whole course.

I divided the topic into two lectures, so this is the first one.

0:47

our series of samples of a sound.

That is multiplied by a complex exponential.

That's our complex sinusoid.

And we multiply sample by sample.

So we have one sample of our sound, and

we multiplied by one sample of the complex sinusoid.

And then, we sum over capital N,

which is the number of samples we compute.

1:45

Okay? So, N is our discrete time index,

k is our discrete frequency index.

And then if we want to understand these frequencies as radiant frequencies,

we have to multiply k by 2pi and

divide it by N, which is our exponent in the complex exponential.

And then if we want to convert these to frequency in hertz,

if we have the k index divided by capital N and we multiply by the sampling rate,

we obtain the frequency in Hz.

Okay. So, let's see an example.

2:28

Our X of N is this top plot,

which is, in this case, a series of samples of a noble sound.

And then, when we compute the DFT, we obtain this complex function,

capital X, that can be expressed in polar coordinates,

can be expressed with a magnitude and a phase.

But let's first hear the sound.

[SOUND] Okay.

So this is the oboe sound.

And the spectrum, we can see the magnitude and the phase.

And in the magnitude we can identify the harmonics of this sound.

So these peaks that we see, basically reflect

the harmonics of this oboe sound, which is clearly a very harmonic sound.

And in the phase spectrum, we can see basically the phase,

how these sinusoids are placed within the sort of

the cycle length and with respect, in radiance,

with respect to the duration of these series of samples.

3:41

As we said, in the DFT equation, the input signal

X is multiplied by a series of complex exponentials, complex sine waves.

These sine waves are the basis functions of the DFT,

the components that we will identify and measure in the input signal.

3:59

One of these complex sine waves is s of k, in which we're using a reverse identity.

We can express it as a complex exponential,

e to the minus j 2 pi k n divided by capital N.

And this is equal to the cosine of the same value

minus j sine of this same frequency, so the real and

imaginary part of this complex exponential.

4:29

If we have a DFT of size n = 4,

we will have n samples in the input signal.

And therefore in the sine waves.

And we'll have four frequencies.

That's going to be also the output of the DFT.

Therefore, we will have four sine waves of length 4.

One will be at frequency 0, s sub 0,

which will be basically the frequency equal to 0 and it will be all equal 1.

Then s sub 1 will be the frequency 1.

And that will be one cycle of a complex sine wave.

S2 will be frequency K equal 2.

And S sub three will be K equal 3.

So our signal of size N equal 4 will be projected

into these four sine waves, which each one being of size 4.

5:39

So here we have the eight complex sine waves,

starting with s sub 0 with this component of being a constant.

S sub 1, which will have this one period of a sine and of a cosine.

And we will keep increasing the number of periods.

But as you can see, there is kind of some symmetry, and

the frequency doesn't go up to eight periods.

But it really goes back to the one period.

We'll talk about that.

These are basically the eight complex sine waves that

are used when we take a DFT of size 8.

6:28

Okay, so the DFT equation can also be expressed by this

equation which emphasizes the idea of scalar product

in which we are doing the scalar product of x of n,

our input signal by the n complex exponentials.

6:49

And if we put an example of, we take again size N equal 4, and

we take a signal of being of these four samples, 1 minus 1, 1 minus 1.

And we do the scalar product of this signal by every one

of the four sine waves that we had computed in the previous slides,

we will compute the DFT result.

So, when we do the scalar product of x by s sub 0, the result will be zero.

That will mean that this particular signal

has no frequency, zero is not present.

7:36

And then, if we change to s sub 1 and we do the scalar product,

we get the same result, zero.

Which, again, means that this frequency is not present in this x signal.

But when we change to s sub 2, and we do the scalar product, the result is 4.

Which means that basically this x signal is this sinusoid.

It's completely present in this sinusoid, and

we get the result of 4 which is the sum of all the samples.

And then, by S sub 3, again is equal to zero.

So that means that we have computed the DFT of X sub N,

and we have obtained that is equal to 4 for

K equal to 2, and is equal to zero for the rest.

Meaning that we have the presence of the frequency, K equal to 2.

Let's do that with bigger signal.

So, this is an example of the scalar operation

of a simple signal that has all 1's.

It has 8 samples,

the first four are 1s and the last four are minus 1s.

So this would be like a rectangular kind of signal.

If we compute the DFT, or the scalar product between this x signal and

the eight complex sine waves that we had seen in the previous slides,

the result will be this one.

We'll get the magnitude and the phase, so it's going to be a complex

spectrum, and we can display it as polar coordinates.

And here we can see that in this signal there is some frequencies present.

The frequency k equals 0 is not present.

Frequency k equals 1 is very much present, but

it also present k equals 3, and it's also present k equal 5.

And again, is also present k equals 7.

And the phases mean how this sine waves are located in,

sort of in the time location.

10:04

So this is the DFT operation, and

basically this is going to to be the core of all the things we will be doing.

You can find more information on the DFT in

Wikipedia and, of course, in the website of Julius Smith.

And from now on, on all our lectures we'll use some sounds.

So all will come from Freesound, and they can be obtained from this link.

And again, the standard Creative Commons and

10:45

So we have shown and explained the DFT equation.

I hope you realize that is not such a complex thing.

But even if you feel it is complex, its use in audio signal processing is huge.

So it is worth spending some time with it.

We will continue with the DFT in the second part of the lecture.

So thank you for your attention, and I see you next class.