MP3 format is perhaps the most widely used today, allows the sound quality of a CD but it occupies a space much smaller, think that in a CD coming barely 16-17 songs, and a cd with compressed mp3 file 150 or more. Not to mention the wma format that compresses twice a mp3, but in this case, the quality is much lower.
To achieve the quality of a CD, on it you need to store 44,100 samples per second at 44.1 kmz ie, each sample is a number that can range from -32768 to 32767, and therefore occupies 16 bits.
MPEG-I Audio (ISO/1EC 11172, Part 3) defines three levels (layers) of compression. Moving from layer I to III increases the compression and quality, especially at 128 Kbps (Kbits per second) with stereo sound. This format was chosen to read the mp3 files.
In the figure above we can see the steps in the mp3 encoding. In the upper branch the signal is decomposed into a number of sub-bands, as if sliced and then each of these parts is transformed by MDCT (Modified Discrete Cosine Transform), in practice the same image (as I explained in compression images), then we in this phase lossy, ie, loss of information. Is followed by the Huffman coding is the part that no loss of data and missing in layer I and II. While the signal is carried from the top of the sequence, at the same level are involved with changes in the lower portion, such as FFT (Fast Fourier Transform) and perhaps the most complicated and most important the psychoacoustic model, I’m going to explain. This model sets a threshold such that a noise nuisance which has intensity less than the threshold is not heard by the human ear, and then is removed, then so is the same method that adds the noise threshold, then the data is passed to the upper sequence. All you have completed the final product and that the data stream in mp3 format.