Welcome back to the course on audio signal processing for music applications. In this demonstration class, I want to talk about periodic signals. Periodic signals are the basis of understanding most signals, and are also the basis of Fourier analysis. So it's good to talk a little bit about them. Let's start by opening Audacity and generating some periodic signals, so here it has tone generator. And the most fundamental periodic signal is the sine wave, that we already have seen. So let's generate a sine wave of 500 hertz, duration of 5 seconds and amplitude, 0.8. Okay, so here is our sine wave. Let's hear it. [SOUND]. Okay. In order to see that it's periodic, we can zoom into it, and here we see the sinusoid oscillation, the periodic oscillation of a sine wave. If we zoom even more, we are going to start seeing the samples that are present in this signal, this discreet signal. So we have generated this signal at 44,100 hertz, so we'll have that many samples per second. Okay, so the first thing we might want to do to understand the concept of periodicity is to measure what is the period length. Now the idea of periodic means that there is a period that is repeating a cycle of the sound. Okay, so this is a cycle of this sinusoid, and in here we can see what is the length of this selection I made. And it says that it's 0.002. So that means 2 milliseconds. If we go to the terminal and have Python in, we can use it as a calculator. So we can convert this period length into frequency. So the inverse of the period, so 1 over 0.002, will be our frequency. And of course it gives us 500 hertzs. 500 hertzs is the frequency of this sinusoid. Okay, another thing we might want to check is okay, this period has a series of sample. So, how many samples does one period of this sinusoid has? Well, in order to compute that, what we should do is start with the sampling rate. The sampling rate is 44,100. And multiply by the duration of this period. So we multiply by 0.002. And it gives me 88.2, which is the number of samples of a period. Of course it should be an integer number. So I guess it's going to be 88 samples in one period, okay? Now let's generate another sinusoid but of a different frequency. So let's maybe open a new file, okay? And let's create another sinusoid. But instead of 500 hertz, let's put, for example, 5000 hertz. Okay, so this is the sinusoid of 5000 hertz. We can hear it too. [SOUND]. Clearly, much higher, and we can also zoom, and to see the periodicity. But here we already see that is not so nice, in fact the samples are not really shaping a smooth sinus little function. This is because there is less samples per period, therefore we don't have a various most version. So how many samples are in one period? Well, not that many. In fact, here we can even count them. And it's one, two, three, four, five, six, seven, eight. So in fact we have like eight, nine samples for one period. Not exactly because they don't coincide, of course, with a period. Of course it makes sense because if we had seen that the frequency of Pythagorean had 88 sample in one period. Now that we have 10 times the frequency, 5,000, the number of samples will be 10 times less, so it's going to be around 8 or 9 samples, that's pretty good. Of course, this relationship between the number of samples and the frequency is a very important one, and related with the sampling rate. The bigger the sampling rate, of course, more samples we'll have. And for higher frequencies, we'll have more samples. At 44,100, as we go up in frequency, and if we go even higher, like 10,000 or even 15,000, the number of samples will be very less. And therefore, the shapes will not look like a sinusoid even though it's a sinusoid. Okay, let's look at another periodic signal. But different from a sinusoid. So we will create a new file and we will generate a tone. But in this case, let's generate, for example, a sawtooth. And instead of 5000, let's go back to the 500 hertz. And maybe the amplitude, we don't have to put it that high because this is a very rich sound and it will be quite loud otherwise. Okay, so this is a sawtooth wave form, again we can now listen to it [NOISE]. Okay. if we zoom in, into this wave form, well we see that it's very periodic. And since the sampling rate is high enough, and the frequency is kind of low, if we zoom in well, we have a lot of samples per period. But in this case, the period which we can measure and it's going to be the same thing, 500. It doesn't mean that there is one frequency at 500 hertz. In fact, this wave form has many frequencies. It has 500 hertz as a fundamental frequency and it has multiples of that. So that it's a harmonic sound. And how can we check that? Well, we check that with a spectrum analysis. And in Audacity, we have specifically to plot the spectrum, okay? And here now it tells me that there is not enough data because I have to choose a bigger part of the sound, so let's choose a bigger fragment of the sound. And now we can plot, now we can visualize the spectrum of this shuttle. And clearly we see that is a quite complex spectrum, in which it has many peaks. In order to understand this, I think it's good to compare it with the sinusoidal we started with. So this was the sine wave we started. And if we do the same thing that we have done now with the status, that is to compute the spectrum, well we see now that it's clearly very different. The spectrum of a sinusoid has only one measure peak. And the frequency in this case, 400. And the spectrum on this has many peaks which correspond to all the frequencies present in this harmonic signal. Okay. Now, let's even do something a little bit more complicated. Let's see that we can generate It's one signal, but instead of being the same frequency all the time, let's have it that it changes in time. So these are normally called chirp functions. So let's have a sine wave. Being a chirp. Let's go from the two frequencies we have mentioned. So from 500, let's go up to 5000 hertz, and let's have the amplitude that's 0.8 all the time. And let's have these 5 seconds. So now we have kind of a glissando, a chirp, and of course we can play it again. [SOUND]. Okay, so it's a frequency that goes up, and again of course, we can zoom. But we will see that the period keeps changing in time. So here at the beginning, we'll have a period that is going to be quite long. It will be the 500 hertz, the 2 milliseconds. And by the end, it will be much smaller. It will be ten times smaller, okay? And of course we can visualize that by analyzing the spectrum of this signal. So if we select a portion at the beginning and analyze the spectrum, we will see that it has around 500 hertz frequency. And if we go to the end, so we go to the end of the signal. Here, and now we compute, replot the spectrum, well it has shifted. It's going towards the 5000 hertz, so it's also one single peak, but much higher. Okay? And that's a good way to visualize and understand periodic signals. Anyway, so this is all what I wanted to say today about periodic signals. So let's go back to the slides. And well, we haven't used much, we basically have used Audacity. And we have talked about electronic periodic signals, synthesized periodic signals. These are signals that are quite good to play around with because we know how we generate them, so therefore when we analyze them we know what to expect. So in next demo class, we'll complicate that, so we will actually analyze more complex signals, sounds, that might have some parts of the periodic, might have some parts that are not periodic. So they reflect more the reality of real sounds, so I hope to see you next class, thank you very much.