# 100 Days Of ML Code — Day 086

Jehoshaphat I. Abu
·Oct 11, 2018·

100 Days Of ML Code — Day 086

## Recap From Day 085

Day 085, we looked at Fourier Theorem.

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

Today, we will continue from where we left off in day 085

## Envelope And Spectrogram

Now another way that we can look at Timbre information visually It’s just something called a sonogram or a spectrogram and the image below is a little bit different because what we have on the x-axis now, is time. And our y-axis is frequency, and then our colour would map to decibels.

So the reddest areas in the colour scheme are the ones that are highest in decibels. So any given point, we can think of as a particular moment in time at a particular place in frequency space and the colour is an indication of the decibels so that particular moment in time in that particular frequency space.

The reason sonograms and spectrograms are important is that we obviously have sounds in the real world that aren’t sine waves or sawtooth waves or square waves, that change a lot over the course of the sound and this is a key component to timbre as well.

It’s not just enough to say how frequencies are distributed and where the energy is across the frequency space but you also have to be able to say well how it’s changing over time.

It would not be enough just to list a bunch of frequencies and their amplitudes and phases in order to describe an instrument’s sound because we have to describe how it’s changing at the beginning part, the attack portion of the sound. We have to describe it’s envelope how it’s changing over time.

Below is a live sonogram view of a sawtooth wave.

You can see that it’s just those straight lines. Those frequency components according to the Fourier Theorem that is never changing. See the image below for how a more complex sound looks.

Now that is obviously changing because the pitches are changing, but, equally important is that with each of the notes, you can see from the image above that they’re not just static lines. Those things that are growing, and shrinking, and moving around and they look like real almost drawings or squiggles.

Rather than simple straight lines that are perfect. That is how there’s a difference between the sounds that we work with in real life as opposed to the test sounds, the sawtooth waves and what we need to describe their timbre’s. It’s not enough to just say what the vertical, the frequency component is but you need to describe the horizontal as well, how it’s changing over time.

That’s all for day 086. 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.