Stefan Kiessling – organist
deutsch | english
 
 

Audio Encoding


Sound is the frequent change of air pressure. A microphone translates this into frequent changes of electric current, described in Volts. Audio encoding describes the task of marking down the voltage at a specific time.

Vinyl encoded the voltage in the shape of the material; audio tape uses variable magnetization. In digital audio computer bytes are used. All encodings have to find a reasonable compromise, as it is not possible to mark down the voltage with infinite precision. Less precision has the result of encoding noise and/or distortion.

In digital audio a compromise has to be made between data size and precision. A very common encoding is PCM: pulse code modulation. Computers provide mainly two formats of representing a number: fixed point (integer) and floating point. Most commonly used are integer with 16, 24 or 32 bits and floating point with 32 or 64 bits. As sound waves go from positive to negative, 1 bit is always reserved for indicating a positive or negative value. The main difference between the two:

Integer:
1 Bit is reserved for the sign, the remaining n bits encode a value from 0 to 2n.

The noise floor is constant and depends on the number of the bits. The signal-to-noise ratio (SNR) decreases when the encoded level gets lower. Best SNR can be achieved with high levels.

Floating point:
1 Bit is reserved for the sign. n bits are for the mantissa, which encodes values from 0 to 2n. m bits are for the exponent, encoding exponent values 2m–bias. The bias is not encoded in the bytes. It is defined by convention. For instance 32 bit floating point has a bias of 127. Therefore the exponent can have values from
20–127 = 1–127 = –126
to
28–127 = 256–127 = 129

The final value is calculated mantissa + 2exponent

The overall noise floor is lower when the number of bits for the mantissa increase. However, it is variable and follows the level. As a result the SNR stays almost constant.

You can try out some standard encondings as well as trying out your own. Choose 0 bits for the exponent to define an integer encoding.

Standards:

Bits for Sign cannot be changed Bits for Mantissa defines level of noise floor
Bits for Exponentdefines the width of range with ~constant SNR BiasDefines where the range with ~constant SNR lies. For Int it should be set equal to bits of the mantissa
Your encoding needs bits in total and can hold values that reach
at most.

Noise characteristics of your encoding


Noise Floor
Signal-to-Noise Ratio
Input level of a fictive signal, where 1.0 Volts equals 0 dB
Where are you bound mary