How does mp3 compression sound?

I wrote a small script in Jupyter notebook that compresses a audio file over and over again to make the effect of MP3 compression (more easily) audible. The compression is done using the LAME encoder, a compiled binary of which can be found here. The compression level is set to v5 which is a variable bitrate level with an average of 130 \(kbit/s\).

I ran the script on a track that I made myself (to avoid any copyright issues). After a few rounds, the effect is already clearly audible. After a few more, the audio starts to sound really bad. After a hundred rounds, the audio sounds terrible with loud hisses of white noise. After a thousand rounds, almost only white noise remains.

You can listen to the audio below (1998 distant keys is the name of the original track). The full track can be found on Soundcloud.

Gotta love those running console screens, even in PowerShell

Interestingly, the size of the compressed files goes up at first and only then starts to go down and keeps going down. The first file is, however, still way smaller than the original file, which is about 5 MB.

The code for compressing the files can be found below. To run it you’ll need Jupyter notebook or if you have Python but not Jupyter, you can simply copy the code from the blocks into a single *.py file and run that. You’ll also need the LAME encoder.