How MP3 Files Work.

by Marshall Brain

The MP3 movement is one of the most amazing phenomena that the music industry has ever seen. Unlike other movements -- for example, the introduction of the cassette tape or the CD -- the MP3 movement started not with the industry itself but with a huge audience of music lovers on the Internet. The MP3 format for digital music has had, and will continue to have, a huge impact on how people collect, listen to and distribute music.

If you have ever wondered how MP3 files work, or if you have heard about MP3 files and wondered how to use them yourself, then this edition of How Stuff Works will be fascinating. In this article you will learn about the MP3 file format and also learn how you can start downloading, listening to and saving MP3 files onto CDs!

The MP3 Format If you have read the HSW article entitled How Compact Disks (CDs) Works, then you know something about how CDs store music digitally. A CD stores songs as digital information. The data on a CD uses an uncompressed, high-resolution format. Specifically here's what happens to create a CD:

  • Music is sampled 44,100 times per second
  • The samples are 2 bytes (16 bits) long
  • Separate samples are taken for both the left and right speakers in a stereo system

Therefore a CD stores a huge number of bits for each second of music:

  • 44,100 samples/second * 16 bits/sample * 2 channels = 1,411,200 bits per second

1.4 million bits per second is 176,000 bytes per second. If an average song is 3 minutes long, then the average song on a CD consumes about 32 million bytes of space. 32 Mbytes is a lot of space for one song, and it is especially large when you consider the bandwidth most people have available for their Internet connections. Over a 56 kbit modem it would take something close to 2 hours to download one song.

The MP3 format is a compression system for music. The MP3 format helps reduce the number of bytes in a song without hurting the quality of the song's sound. The goal of the MP3 format is to compress a CD-quality song by a factor of 10 to 14 without losing the CD quality of the sound. With MP3, a 32 megabyte song on a CD compresses down to 3 megabytes or so. This lets you download a song in minutes rather than hours, and it lets you store hundreds of songs on your computer's hard disk without taking up that much space.

Is it possible to compress a song without hurting its quality? We use compression algorithms for images all the time. For example, a GIF file is a compressed image. So is a JPG file. We create ZIP files to compress text. So we are familiar with compression algorithms for images and words and we know they work. To make a good compression algorithm for sound a technique called perceptual noise shaping is used. The "perceptual" part in the name means that the MP3 format uses characteristics of the human ear to design the compression algorithm. For example:

  • There are certain sounds that the human ear cannot hear
  • There are certain sounds that the human ear hears much better than others
  • If there are two sounds playing simultaneously we hear the louder one but cannot hear the softer one.

Using facts like these about the human ear, certain parts of a song can be eliminated without significantly hurting the quality of the song for the listener. Compressing the rest of the song with well-known compression techniques shrinks the song considerably -- a factor of 10 at least. [If you would like to learn more about the specific compression algorithms, see the links at the bottom of this article.] When you are done creating an MP3 file, what you have is "near CD" quality. The MP3 version of the song will not sound exactly the same as the original CD because some of the song has been removed, but it will be close.

From this description you can see that MP3 is nothing magical. It is simply a file format that compresses a song into a smaller size so it is easier to move around on the Internet and store.

If you have any questions or queries, then write to Platinum Goat.