will tell me the dimensions of the ray.
Basically, the number of frames and
the number of samples in the spectrum that we have.
So in fact this tells me that we have 238 frames and
each frame has 512 samples.
These 512 samples are the samples of the magnitude spectrum of half of
the magnitude spectrum.
So now, we can access individual frames of that, so if we put for example mX,
and we access for example the frame number 50.
And we plot the whole spectrum of that 50th frame,
these are the values of the magnitude.
And of course we can, if we call the function plot with that variable,
we will plot the magnitude spectrum of the particular location.
Okay, so this is the flute sound, we see the harmonics and
we see how the higher values are much softer and it's quite noisy.
Of course we can also plot the phase spectrum of that
same location, this is the phase.
The ungraph phase, so we can see all these a nice looking face shape, okay.
Of course we want to visualize the whole spectrum, so
in order to visualize the whole spectrum the plotting command
that can do that is the what is a the function is called pcolormesh.
Pcolormesh it plots a matrix as a kind of a three
dimensional shape, so if we give it p and
mX it will basically plot all the frames.
But it maybe plotted in a different way that we are accustomed to
because the vertical is the axis is the time.
So in fact, we see time going from bottom to top and
the frequency is on the horizontal axis.
In fact a better way to plot this with colormesh is transpose it first,
so we can call the transpose function.
So this will transpose the mX in a different way,
so that we can see it in a more meaningful way.
And so now we see time going from left to right and frequency going,
or the frame, yeah, frequency going from bottom to top.
Okay, so that's basically how we compute the magnitude and
the phase spectrum using STFT and how we can plot it.
And there is a function file that implements all that and
makes plots in a nice way and that's the STFT_function.
And this is the one that is call from the graphical interface that we also use and
here it has one function called main and it goes through the kinds
of things we did and it does both the analysis and synthesis.
Okay, so the main has its input values all the input parameters and
then it reads the sound file, it gets the window It performs analysis.
This is exactly what we did now but then it does the synthesis and
it output the synthesis file into a location with
a given name and then it writes it, okay?
By the way, here this file I just copied into the work-space but
I had to change the relative path of a number of these names.
So for example, I have to change the path of the software models or
I have to change the output file name because in here it.
It was using particular directory to store the sound files, so
here, I just write the directory on this directory.
Okay, so let's execute this, that's why I have it in this directory.
So, it's STFT function, so I can just run STFT function, okay.
And it plots, well, the input sound, the magnitude,
the derivative of the phase and the output sound.
And this has created a file which is
called what is it called is called piano stft.wav and
of course, from here again,
I can play so, I can say play stft,
I know piano, piano Stft.wav.
[MUSIC]
Okay, and it's basically the same than the original sound.
Of course now, from this file I can really change and
make the things differently if I want.
So feel free to change how the plots are shown but
these are quite nice way to plug the things with the correct access,
with the correct labels, with the correct scaling.
So that we can better visualize the analysis and
synthesis of using this TFT and that's all I wanted to say.