Hello everyone! Today we'll look at how audio files are encoded. So, normal human can hear from about 100Hz to 20KHz. That means we have 20 000 values we need to take care off. So, how do we store this? Well, audio files have 2 main properties. sample_rate - How many hz values will there be per second sample_count - How many hz values is there in the entire track And from these values, we can also determine the the size and the lenght of the file. lenght = sample_rate * sample_count size = (size_of_sample * lenght) Lets say we have 10second track with average audio quality. Now, how do we determine the size? Well, we know then lenght, and there are 3 most common sample rates, which are the low 32kHz, the high is 48kHz and the standard is 44.1 kHz. Now, what is the size of 1 sample? Well, we can determine that preety quickly. We are storing it on a comuter so it will be 2^(2^Something). We have few options, 8bit, 16bit, 24bit or 32bit unsigned(because negative frequency doesn't exist) integer, from which we have 255, ~65k, 24mil. and ~2.1bil. options. From which its preety simple, we can simple choose the 65k because thats over double the range of human hearing. Now, we will turn it into 32bit integer. Why tho? Well, we need to turn it into stereo audio. So, our 10s audio clip(with stereo audio will be): (10 * 44100) * 4(4bytes = 32bits). And that equals to 1,764,000bytes, aka almost 1.8megabytes. Thats, a very large number tho.. right? And you are absolutely correct, thats why we need to apply compression to the file. Remember how I told you that we can use uin16 for the job, and we have extra frequencies avilable? Well, lets cut that bit off, making the sample size only 3.5bytes. If we now make the calculation agin(441000 * 3.5) we got a number 1,543,500, which is almost 300kB smaller. Now using repeating paterns, we can get it to fraction of this, however I won't cover it in this blog, because it would be longer than the clip would be now. This will get us to about 5kb, and we are done! Everything is just maths! See you hopefully soon!