What’s in an mp3 file?


Free Download Mp4Gain
picture

What’s in an mp3 file?

All of us have ever downloaded music files in MP3 format and have passed them to our player or mobile phone, or we have listened to them in streaming from a web page. But do we really know what one of these files contains?

To explain it clearly, we must mention a good number of characters and discoveries, because technology is almost always based on more than one invention. The first of these is the French mathematician Jean-Baptiste Joseph Fourier (1768-1830), who demonstrated that every periodic function can be expressed as the sum of sinusoidal functions of different frequencies and amplitudes, as shown in the figure. The approximation is exact if infinite frequencies are available, although in practical applications we are satisfied with a finite number of them. The Fourier transform, named after him, is a mathematical transformation that converts a periodic function into another function in the frequency domain, expressing for each frequency the proportion by which the corresponding sinusoidal contributes to the original function.

In order to store an audio signal on a computer, it must first be converted into numbers. This is done by sampling: the amplitudes of the signal are taken at regularly spaced time intervals and the resulting voltages are converted to base two numbers.

Sounds can be represented as continuous functions in the time domain. A microphone transforms the sound into an electrical signal that varies over time (see figure), called an audio signal. In order to store an audio signal on a computer, it must first be converted into numbers. This is done by sampling: the signal amplitudes are taken at regularly spaced time intervals and the resulting voltages are converted to base two numbers. Each sample is stored in 16 bits, giving an accuracy from zero to just over 65,000 to express each voltage.

The frequencies that the human ear can perceive vary in a range of 20 to 20,000 hertz (one hertz is one vibration per second). In order not to lose the high frequencies, the sampling must be done at a frequency at least twice the highest that we want to record. For example, a CD recorder / player normally uses 44.1 KHz (kilohertz). A simple calculation tells us that a single second of stereo music generates 44,100 samples, over two channels, over 16 bits, giving a total of 1.4 megabits per second. Or, one minute of music takes 10.6 megabytes on a CD, and one hour more than 600 megabytes. These volumes are too “heavy” to transmit over the network. The success of the MP3 format is due to the fact that it is capable of dividing by 11 the volume occupied by the sound signals, with little loss of quality when reproduced by a speaker.

 What is in an MP3 file?

The next invention is the computer algorithm called the fast Fourier transform, or FFT, due to the North American mathematicians James Cooley and John Tukey in 1965. It is the discrete and efficient version of the Fourier transform: given a set of n samples of amplitude of a signal, gives us the samples of its n most representative frequencies. The transformation is reversible: given the frequencies, the initial samples can be recovered without losing precision. To generate an MP3 file from an audio signal sampled for example at 44.1 KHz, the signal is first converted to the frequency domain using the FFT.

The following contribution is due to the doctoral thesis of the German engineer and mathematician Karlheinz Brandenburg in 1989, who proposed a model of human auditory perception that allowed to dispense with many frequencies because they were masked by others nearby, depending on their respective volumes. Their work was the basis of the MP3 format proposed by the MPEG group (Moving Picture Experts Group) of the international organization for standardization ISO in 1993. After the conversion of the audio signal to the frequency domain, a small number of them are selected (less than 600) to be stored in the file, without losing appreciable quality for it. In addition, it is done in a way adapted to the shape of the signal: in the sections where the signal is simpler, less information is stored and in the more complex sections (for example during percussion sounds), more is stored. This selection is responsible for a part of the compression of the file. Another part of compression has to do with reducing the number of bits in the samples when they are of a similar amplitude. In that case, a common base is stored for a set of samples, and then the differences are coded in a few bits (usually 4). This phase is called quantization.


Free Download Mp4Gain
picture


Mp4Gain Main Window
picture


Mp4Gain Features
picture


Free Download Mp4Gain
picture

Author: R. Arias

R. Arias is the author of this article and has extensive experience for more than 30 years as a recording engineer and audio specialist, as well as more than 20 years of experience creating algorithms related to audio and video. Linkedin