Sound in binary code

The sound we hear is a longitudinal wave in the air. To introduce a sound in binary code, readable by a computer, you need to do some conversions. First, the sound signal is converted into an electrical analog of the sound with the help of a microphone. The electrical analog is obtained in a continuous form and is not suitable for processing on a computer. To get the signal in binary code, you have to pass it through the analog-to-digital converter (ADC). When playing a sound in a binary code, the digital-to-analog conversion (via a DAC) takes place. The ADC and DAC are in the sound card of the computer.

The sound we hear is a longitudinal wave in the air. To introduce a sound in binary code, readable by a computer, you need to do some conversions

To represent sound in binary code, a continuous signal is sampled in time and in level. When time-sampling, the entire time period T is divided into small intervals ?t, by the points: t1, t2 ... tn. It is assumed that during the interval ?T, the signal level changes insignificantly and with a certain assumption is constant. The value V = 1/?T is called the sampling rate, which is measured in Hz (Hz) - the number of measurements per second.

Discretization by the level of a continuous signal is called quantization and is performed as follows: the range of the signal from the smallest value Xmin to the largest value Xmax is divided into N equal quanta,

Δ = (max min)/N,

points 1, 2, ... n. i = min + Δ*(i-1).

Each quantum is associated with its sequence number, i.e. an integer that can be easily converted to a binary number system. If the signal after the time sampling falls within the interval X-1 ≤ X ≤ X, then the code i is assigned to it.

But in practice, when converting sound to binary code, there are two questions: how often in time and with what accuracy you need to measure the signal to get a sound of satisfactory quality when playing.

The first question is answered by the Nyquist theorem, which states that if the signal is digitized with a frequency V, then the higher "audible" frequency will be no more than V/2. The second question is solved by selecting the number of levels so that the sound does not have a high noise level. In this case, the number of levels is taken as 2n, where n = 8 or n = 16, i.e. each measurement takes one or two bytes.

For an audio CD, high quality audio reproduction in binary code is obtained with the following sampling parameters: sampling frequency 44.1 kHz, quantization 16 bits, i.e. Δ = (max min)/216. Thus, 1 s of stereo sound will take 2 bytes * 44100 bytes/s * 2 chan * 1 s = 176 400 bytes of disk memory. The sound quality in binary code is very high.

Tools