0:00

So in the last video, we talked about the, the fundamentals of visual sound.

and of each of the samples and the considerations we have in terms of

sampling rate and bit width, number of channels we use to represent sound

visually. in this video, we're going to delve into

the question of sampling rate in much more detail.

and ask a simple question of how do we determine what the appropriate sampling

rate is. so we'll, we'll explain it a little bit

more formally what a sampling rate is. And we'll look at the Nyquist Theorem,

which gives us some guidance on picking a sampling rate.

so finally we'll also talk about foldover which is something that can happen

usually that we usually don't want to happen, if you pick a bad sample

[INAUDIBLE] that is too low for a particular project.

so the sampling rate is, is very simply put, it's the number of samples per

second of digital audio. so if you recall we have this kind of

very zoomed-in sine wave here. Each of these dots is a sample.

It's simply asking, well, how many of these dots are we capturing every second.

and because this is, is in terms of samples per second kind of metric, we

actually use hertz to represent it. The same thing we had used to represent

frequency. so, for instance if 8,000 hertz is our

1:18

sampling rate, it simply means that we're we're capturing 8,000 of these samples

every second. so that's how we talk about sampling

rate. And now, how do we decide what our

sampling rate should be? it's actually fairly simple.

we use something called the Nyquist Theorem, which is also sometimes known as

the sampling theorem. And what the Nyquist Theorem says is that

the sampling rate must be at least twice the highest frequency that you wish to

represent. this makes a lot of intuitive sense when

you think about it. And the reason for that is let's think

about our sine wave again, here. if I have a sine wave going at, you know,

say 440 hertz then, I have 440 peaks and I have 440 troughs happening every

second. so the minimum that I need to capture

digitally in terms of those dots, those, those amplitude readings would be for

each cycle of my sine wave, I need to make sure that I have at least one sample

to represent somewhere on my peak, somewhere above the zero crossing.

and then, something somewhere below the peak to represent you know, below the

zero crossing. Somewhere you know, down by my trough.

so I need 440 peaks and 440 troughs or 440 above zeros and 440 below zeros to be

able to capture these 440 cycles of my sine wave in a second.

2:49

So I simply would multiply 440 by 2 and I'd end up with 880 as a sampling rate

that I would need. so in reality, you know, we're not

looking at every individual sine wave or frequency component that we want to

represent. We want to come up with some general

sampling rate that's going to work really well for a lot of things.

so what should that sampling rate be? we can kind of deduce this logically.

we talked about the range of human hearing is going from roughly 20 hertz up

to 20,000 hertz. So if we take, you know, 20,000 hertz and

we multiply it by 2, it's simply easy math here.

we end up with 40,000 hertz. So, we know that the sampling rate must

be greater than 40,000 hertz. and so the number that we usually end up

seeing is 44,100 hertz. the reason for this has to do with the

history of the early days of digital recording and some decisions at Sony and

other manufacturers made in the late 1970s that aren't really worth getting

into here. But that number has largely stuck.

that's what we use on compact discs, in particular, is 44,100 hertz is their

sampling rate. You'll sometimes see other sampling

rates. you'll see like 48,000 hertz for

instance. you'll sometimes see higher rates like

96,000 hertz or even 192,000 hertz. It's in very high fidelity recordings.

And the reason for that, of course, is that you know, if we had this sign wave

here. Sure it's nice to be able to capture at

least one sample somewhere on the peak, and one somewhere on the trough, but

that's not going to be enough to really capture the entire shape of that sine

wave, that entire curve. if you want to get a really, really nice

representation of it, you're going to want as many samples as possible all

along the way. so the higher a sampling rate is the

better resolution we'll, we'll get and the better will be it'll represent those

curves. so I'm going to talk briefly here about

what happens if our sampling rate is too low.

we get something called foldover. So, so if our sampling rate is too low,

it's not just that the other, you know the frequencies above the, the Nyquist

frequency which is that highest frequency we can represent.

it's not just that those frequencies disappear from our sound, but they

actually they turn into other frequencies in the sampling rates.

So, I want to show you what I mean here. here we've got a sine wave here in, on,

on, on this top image here. And we can look at the number of cycles

here from peak to peak, peak to peak, peak to peak, peak to peak.

so there's four plus a little bit more in this, this image and this is the sampling

rate of 44,100 hertz. And if we take that sine, same sine wave

and we reduce it down to something crazy low, like, 284 hertz, we end up with

something like what you see in the bottom.

So here we're still getting a periodic sounds here.

It's not a sign wave anymore because we, we've lost kind of resolution of that

curve. And it's it's also not the same number of

cycles anymore. But we are getting cycles.

We're getting one full cycle plus, you know, a little bit more in, in this

particular square of time. and so we're going to here that as a

periodic sound. It's going to have a frequency to it.

But it's not going to be the original frequency that we expected of that, that,

that 440 hertz sine wave that we had in the top image.

So now I want to look at the sampling rates in practice inside of Reaper.

And so, what I have in this demo here, is I have just a simple 440 hertz sine wave

loaded on my track here. And and I have a special plug in here

which lets me change the sampling rate of this sound dynamically, so we can hear

what happens with that sign wave at, at different sampling rates.

right now it's set at 44,100 hertz. and then over here we have a spectrum

analyzer, so I can see what frequencies are actually present in the sounds.

So [SOUND] at 44,100 hertz, I have my one sign wave peaks right here at 440 Hz.

That's the way I would expect. As I start lowering that sampling rate at

first it doesn't matter because I'm still you know following the Nyquist Theorem.

But as it gets lower and lower and lower, we start to see the folding over

happening, and we start to hear it as well.

[NOISE]. As those foldover frequencies start

coming in to my sound, I'll go back to 44,100 Hz.

so again hear a similar phenomenon if instead of just listening to a sine wave

we look at a real sound like a drum something like this.

7:41

[MUSIC] So again, that's at 44,100 Hz. so that's a good sampling rate for the

sound but as, I bring this down, we'll start to hear a lot of frequency content

getting lost. At first it, it'll sound like we're just

losing some of the higher frequencies, so it sounds a little bit darker.

And then we'll, as it gets lower and lower, we'll start hearing more of that

foldover, and actually hear other pitches start coming in.

[MUSIC] So you can get a sense both of the frequency constant that's lost as I

lower the sample rate. and also the frequency content that's

folding over as I lower that sample rate. the, the final example I wanted to show

you was, was to go back to that chirp sound.

The one that sweeps gradually from 20 hertz all the way up to 20,000 hertz.

and so this is a really clear demo of, of, of this practice of foldover.

So again, if I'm at, at 44,100 hertz, I'll just hear that original chirp the

same way we, we've heard it before. [SOUND] And we can see this on the

sonogram here, as it's going up and up and up steadily in pitch.

[SOUND] but as I lower that sampling right, we'll start to hear it, hear and

see it folding over at certain points. [SOUND] So you can see the foldover as

it's going down much lower than it was before, and the more I lower this, the

lower that foldover's going to start happening.

[SOUND] So we're not getting the chirp from 20 to 20,000 Hz anymore.

It's getting kind of stuck when it hits that Nyquist frequency and coming back

down going up and down and up and down as it's folding over.

[SOUND] So just to quickly review here. In this module we talked about the

Nyquist Theorem. as a way to figure out an appropriate

sampling rate, that our sampling rate needs to be at least double the highest

frequency we want to represent. and we talked about how we kind of

arrived at 44,100 hertz as a fairly standard sampling rate.

and we talked about foldover and other effects that can happen when we're

recording at a sampling rate that's too low.

In the next video, we're going to get into the question of bit-width and how we

decide what resolution we need to represent the amplitude of each sample.