2.9 Binary Codes for Audio

2.9 Binary Codes for Audio

For audio use, the prime purpose of binary numbers is to express the values of the samples representing the original analog sound-pressure waveform. There will be a fixed number of bits in the sample, which determines the number range. In a 16-bit code there are 65 536 different numbers . Each number represents a different analog signal voltage, and care must be taken during conversion to ensure that the signal does not go outside the convertor range, or it will be clipped. In Figure 2.25, it will be seen that in a unipolar system, the number range goes from 0000 hex, which represents the largest negative voltage, through 7FFF hex, which represents the smallest negative voltage, through 8000 hex, which represents the smallest positive voltage, to FFFF hex, which represents the largest positive voltage. Effectively the number range of the convertor has been shifted so that positive and negative voltages in a bipolar signal may be expressed with a positive-only binary number. This approach is called offset binary, and is perfectly acceptable where the signal has been digitized only for recording or transmission from one place to another, after which it will be converted back to analog. Under these conditions it is not necessary for the quantizing steps to be uniform, provided both ADC and DAC are constructed to the same standard. In practice, it is the requirements of signal processing in the digital domain that make both non-uniform quantizing and offset binary unsuitable.

image from book
Figure 2.25: Offset binary coding is simple but causes problems in digital audio processing. It is seldom used.

Figure 2.26 shows an audio signal voltage is referred to midrange. The level of the signal is measured by how far the waveform deviates from midrange, and attenuation, gain and mixing all take place around midrange . It is necessary to add sample values from two or more different sources to perform the mixing function, and adding circuits assumes that all bits represent the same quantizing interval so that the sum of two sample values will represent the sum of the two original analog voltages. In non-uniform quantizing this is not the case, and such signals cannot readily be processed . If two offset binary sample streams are added together in an attempt to perform digital mixing, the result will be an offset that may lead to an overflow. Similarly, if an attempt is made to attenuate by, say, 6 dB by dividing all of the sample values by two, Figure 2.27 shows that a further offset results. The problem is that offset binary is referred to one end of the range. What is needed is a numbering system that operates symmetrically about the centre of the range.

image from book
Figure 2.26: Attenuation of an audio signal takes place with respect to midrange.
image from book
Figure 2.27: If two pure binary data streams are added to simulate mixing, offset or overflow will result.

In the two's complement system, which has this property, the upper half of the pure binary number range has been defined to represent negative quantities . If a pure binary counter is constantly incremented and allowed to overflow, it will produce all the numbers in the range permitted by the number of available bits, and these are shown for a four-bit example drawn around the circle in Figure 2.28. In two's complement, however, the number range this represents does not start at zero, but starts on the opposite side of the circle. Zero is midrange, and all numbers with the most significant bit set are considered negative. This system allows two sample values to be added, where the result is referred to the system midrange; this is analogous to adding analog signals in an operational amplifier . A further asset of two's complement notation is that binary subtraction can be performed using only adding logic. The two's complement is added to perform a subtraction. This permits a significant reduction of hardware complexity, since only carry logic is necessary and no borrow mechanism need be supported.

image from book
Figure 2.28: In this example of a four-bit two's complement code, the number range is from -8 to +7. Note that the MSB determines polarity.

For these reasons, two's complement notation is in virtually universal use in digital audio processing, and is accordingly adopted by all the major digital recording formats, and consequently it is specified for the AES/EBU digital audio interface.

Fortunately the process of conversion to two's complement is simple. The signed binary number to be expressed as a negative number is written down with leading zeros if necessary to occupy the word length of the system. All bits are then inverted, to form the one's complement, and one is added. To return to signed binary, if the most significant bit of the two's complement number is set to zero, no action needs to be taken. If the most significant bit is one, the sign is negative, all bits are inverted, and one is added. Figure 2.29 shows some examples of conversion to and from two's complement, and illustrates how the addition of two's complement samples simulates the mixing process.

image from book
Figure 2.29: (a) Two's complement conversion from binary. (b) Binary conversion from two's complement. (c) Some examples of two's complement arithmetic. (d) Using two's complement arithmetic, single values from two waveforms are added together with respect to midrange to give a correct mixing function.

Reference to Figure 2.28 will show that inverting the MSB results in a jump to the diametrically opposite code that is the equivalent of an offset of half full scale. Thus it is possible to obtain two's complement coded data by adding an offset of half full scale to the analog input of a convertor and then inverting the MSB as shown in Figure 2.30.

image from book
Figure 2.30: A two's complement ADC. At (a) an analog offset voltage equal to one-half the quantizing range is added to the bipolar analog signal in order to make it unipolar as at (b). The ADC produces positive only numbers at (c), but the MSB is then inverted at (d) to give a two's complement output.


Digital Interface Handbook
Digital Interface Handbook, Third Edition
ISBN: 0240519094
EAN: 2147483647
Year: 2004
Pages: 120

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net