Jehoshaphat I. Abu



100 Days Of ML Code — Day 098

100 Days Of ML Code — Day 098

Jehoshaphat I. Abu's photo
Jehoshaphat I. Abu
·Oct 25, 2018·

4 min read

100 Days Of ML Code — Day 098

Recap from day 097

In day 097 we looked at how we actually take data and store it. How much space it takes up on our disk and different file formats that are available to us to manage that.

You can catch up using the link below. 100 Days Of ML Code — Day 097 Recap from day

Today we will continue from where we left off in day 097

Digital Audio Storage Continued

There are other lossless compression formats that you’ll encounter from time to time. ALAC is Apple’s. It’s called Apple Lossless Audio Codec but it’s not very well supported by many other programs that aren’t made by Apple or don’t use Apple’s APIs for Audio.


They’re tools for importing and exporting audio files but this is something that’s available If you need to get that two to one saving in size because you’re trying to email a file to someone or share it somewhere or whatever might be but you want to keep all those amplitude values perfectly intact, this can be a good technique.

What people usually want to do, wind up doing when they want to save space is they use a lossy file format. lossy file format will compress the file size in a way that you can never get the original back but it does it using a perceptual encoding strategy. In other words, it actually considers how we hear sound, psychoacoustic.

It’s just like we were talking about earlier in this module and it thinks about what are the things we’re not going to miss so much in the sound. What are some frequencies that we can’t hear that well or particularly ones that might get kind of hidden or covered up by other audio content that’s in the sound.

They try to use that to make intelligent decisions about what to leave out and what to keep in and you’ve all heard I’m sure of some popular file formats in the lossy category. Mp3 is the most popular, AAC is fairly popular as well, Ogg Vorbis is another one that’s used quite a bit.

Many others as well, the ones listed above are three of the most popular ones and they usually get you about a 90% savings over the original. So, instead of 10 MB per minutes of CD-quality sound, 44,100 Hz, 16-bit stereo, you usually get about 1 MB per minute, depending on the exact savings.

So, that’s a substantial saving particularly useful in a lot of scenarios in terms of how we consume music today. If you are on your cell phone and you’re trying to stream music tracks from a music provider, you can’t stream a WAVE file on your crappy 3G connection or whatever connection you have available or you might not want to use your data plan up for all that streaming.

So, you can use a lossy file format and here’s something that’s pretty good over your cell phone but takes up only you know, saves you 90% of your data. So it can be useful in a lot of situations like that.

I do want to issue a very important warning here, it’s a lossy format for a reason, you can never get the original back. And so if you’re making your own music it would be a horrible idea to only save that in a lossy format like an MP3 or an AAC or Ogg Vorbis or something like that.

Let’s say you then later want them go back and edit it or make some changes, or re-encode in another format, well, you’d be doing all that for a version that has lost some of the amplitude data of the original, those amplitude values are not going to be the same as when you created them, recorded them and so is never going to sound quite as good as the original version that you created in a lossless format.

And if you then go and try to re-encode it in a lossy format again, this is a very common thing to see. Take an MP3, decompress it into a WAVE form, do some editing on it and save it as an MP3 again. Well, we’ve basically done two different MP3 compressions, the first one, when I save that the first time and the second after I’ve decoded it and edited it and I’m saving it again.

That’s going to compound the effects of the losses when I do that. So its always a good idea when you’re editing files, when you’re working with them, when you’re saving them, your own music for archival purposes, save it in the lossless format like a WAVE or an AIFF file or even like a FLAC, Free Lossless Audio Codec. Something that’s going to help you get back the full quality of the original if you ever want to edit it or re-encode it again in the future.

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

Share this