Digital Sound & Music: Concepts, Applications, & Science, Chapter 5, last updated 6/25/2013
The value of an n-bit binary number is equal to
Notice that doing the summation from causes the terms in the sum to be in the
reverse order from that shown in Figure 5.6. The summation for our example is
101100112 = 1*1 + 1*2 + 0*4 + 0*8 + 1*16 + 1*32 + 0*64 + 1*128 = 17910
Thus, 10110011 in base 2 is equal to 179 in base 10. (Base 10 is also called decimal.) We leave
off the subscript 2 in binary numbers and the subscript 10 in decimal numbers when the base is
clear from the context.
From the definition of binary numbers, it can be seen that the largest decimal number that
can be represented with an n-bit binary number is , and the number of different values that
can be represented is . For example, the decimal values that can be represented with an 8-bit
binary number range from 0 to 255, so there are 256 different values.
These observations have significance with regard to the bit depth of a digital audio
recording. A bit depth of 8 allows 256 different discrete levels at which samples can be
recorded. A bit depth of 16 allows
= 65,536 discrete levels, which in turn provides much
higher precision than a bit depth of 8.
The process of quantization is illustrated Figure 5.7. Again, we model a single-frequency
sound wave as a sine function, centering the sine wave on the horizontal axis. We use a bit depth
of 3 to simplify the example, although this is far lower than any bit depth that would be used in
practice. With a bit depth of 3,
= 8 quantization levels are possible. By convention, half of
the quantization levels are below the horizontal axis (that is, of the quantization levels).
One level is the horizontal axis itself (level 0), and levels are above the horizontal axis.
These levels are labeled in the figure, ranging from 4 to 3. When a sound is sampled, each
sample must be scaled to one of discrete levels. However, the samples in reality might not
fall neatly onto these levels. They have to be rounded up or down by some consistent
convention. We round to the nearest integer, with the exception that values at 3.5 and above are
rounded down to 3. The original sample values are represented by red dots on the graphs. The
quantized values are represented as black dots. The difference between the original samples and
the quantized samples constitutes rounding error. The lower the bit depth, the more values
potentially must be rounded, resulting in greater quantization error. Figure 5.8 shows a simple
view of the original wave vs. the quantized wave.