Wednesday, August 29, 2007
Recording the Kalimba:
File Compression

Stereo WAV files at 16 bit and 44.1 kHz sampling take up about 11 MBytes per minute. Many people have 5 or 10 MByte limits to their emails, so if you want to mail someone a song, WAV probably won't work. So, we need to put the song into a compressed file format like MP3.

First of all, what is this 16 bit and 44.1 kHz stuff? Digital recording is a numerical record of the strength of a sound wave. Let's imagine we have a diaphragm microphone, i.e., a thin disk, which vibrates back and forth when exposed to sound. The higher the frequency of the sound wave, the faster it vibrates back and forth. The louder the sound, the farther it comes and goes in its vibrations. The microphone's job is to translate the amplitude and frequency of these vibrations into electrical signals.

The A to D (analog to digital) converter changes the electrical signals into a numerical representation. In other words, every so often (44,100 times per second if the sampling rate is 44.1 kHz) the A to D converter will make a note of just how strong the electrical signal is, i.e., how far the diaphragm of the microphone is away from its resting position.

With what precision does the A to D converter do this? It depends upon the bit depth. With 16 bits (a bit is either 0 or 1), we can represent 2 raised to the 16 different numbers, or 65536. OR, if we have equal ranges positive and negative, we can represent 32768 different numbers in 16 bit precision. If we normalize to the loudest sound, then the precision of our recording, or the error we make from one step to another, will be 1/32768 - seemingly small.

So, there are essentially three ways to reduce the amount of numbers we record, or to reduce the size of a file in digital recording: (1) we can skimp on the precision, i.e., use a lower bit depth than 16 bits, (2) we can skimp on the frequency at which we record the sound's amplitude, i.e., use a lower sampling rate than 44.1 kHz, or (3) we could be clever.

File compression methods, such as MP3, end up reducing the size of a music file in a major way, while reducing the quality, i.e., bit depth or sampling rate, in a minor way. Standard stereo MP3 is about 1 MByte per minute, so a 5 minute song will fit in your mailbox or will download before you are done listening to the song.