# 100 Days Of ML Code — Day 092

Jehoshaphat I. Abu
·Oct 19, 2018·

100 Days Of ML Code — Day 092

## Recap From Day 091

Day 091, we looked at Nyquist Theorem

You can catch up using the link below. 100 Days Of ML Code — Day 091 Recap From Day 090medium.com

Today, I’m going to talk briefly about what happens if our sampling rate is too low. We get something called foldover.

## Foldover

If our sampling rate is too low, it’s not just that the frequencies above 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 turn into other frequencies in the sampling rates. So, I want to show you what I mean.

In the image above, we’ve got a sine wave on the top and we can look at the number of cycles in it from peak to peak, peak to peak, peak to peak, peak to peak so there’s four plus a little bit more in it. That image is the sampling rate of 44,100 Hertz.

If we take that 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 in the image above. We’re still getting a periodic sound here.

It’s not a sine wave anymore because we’ve lost kind of resolution of that curve and it’s also not the same number of cycles anymore but we are getting cycles. We’re getting one full cycle plus a little bit more in this particular square of time.

We’re going to hear 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 440-hertz sine wave that we had in the top image.

So just to quickly review here. In the last two days, 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.

We also talked about foldover and other effects that can happen when we’re recording at a sampling rate that’s too low. In the next couple of days, 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.

That’s all for day 092. I hope you found this informative. Thank you for taking time out of your schedule and allowing me to be your guide on this journey. And until next time, be legendary.