When you listen to a live musical instrument, the sound you hear is an analog sound wave. Such a wave can take an infinity number of values. This signal has to be converted into a sequence of numbers (0s and 1s in native machine language) for storage and playback on a computer. This process of digitisation creates a raw digital music file which uses 10MB or more per minute (at least 30MB for a 3 minute song).
On a PC, a .WAV is an example of a default audio file, while AIFF(Audio Interchange File Format) is the default format on a Mac. On a Unix machine, Sun Microsystems’ AU(AUdio) format is the default for audio. These file formats are an exact replica of the original sound, except for small sampling errors. (They also support limited audio file compression.)
These files have to be compressed to the more usual levels of 3-5MB per song. Compression rearranges the sequence of numbers, sometimes throwing away less significant information, in order to reduce the file size. The way the compression is achieved leads to the many different audio file formats available. Each compression algorithm requires a decoder to make sense of the data during playback. The combination of a compressor and a decoder is called, surprisingly, a codec.
There are two broad compression types:
1. Lossless codecs. This kind of compression reduces the file size while retaining every scrap of information from the original file. This means that the original file can be reconstructed exactly as it was before the compression. Lossless compression does not significantly reduce the size of an audio file. Examples of general lossless compression algorithms include zip or gzip compressions.
2. Lossy codecs. These throw away some of the information from the original music file. Ideally what’s thrown away is what the human ear cannot hear, namely sounds below 20Hz and above 20KHz. Thus, the most successful lossy codecs are based on an understanding of psychoacoustic perception. Lossy compression can reduce the size of the file to less than 10% of its original size. Most of the codecs you will come across are of this type. Examples include MP3 and WMA codecs.
CONSTANT V VARIABLE BIT RATE
Something else you might come across concerning compression is bit rate. This is the number of bits (0s and 1s) per second in an audio stream. This kind of represents how much information is being conveyed per second. The bit rate within a single music file can be constant or variable.
Constant bit rate (CBR). The music/audio file is compressed to the same level throughout the file. For example moments in the audio file having only a drum beating are reduced to the same bit rate as moments having all musical instruments playing at the same time. You would think there is more information to convey when all instruments are playing at the same time than when only the drum is beating. You would rightly choose a high bit rate to accommodate the complex sounds from all the instruments. But a higher bit rate results in a correspondingly larger file.