<-- Back to Previous Page | TOC | Next Section --> |
Chapter 2: The Digital Representation of Sound,
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Now we know more than we ever wanted to know about how often to store numbers in order to digitally represent a signal. But surely speed isnt the only thing that matters. What about size? In this section, well tell you something about how big those numbers are and what they "look" like. All digital information is stored as binary numbers. A binary number is simply a way of representing our regular old numbers as a list, or sequence, of zeros and ones. This is also called a base-2 representation. In order to explain things in base 2, lets think for a minute about those ordinary numbers that we use. You know that we use a decimal representation of numbers. This means that we write numbers as finite sequences whose symbols are taken from a collection of ten symbols: our digits 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. A number is really a shorthand for an arithmetic expression. For example:
Now we bet you can see a pattern here. For every place in the number, we just multiply by a higher power of ten. Representing a number in base-8, say (which is called an octal representation), would mean that we would only use eight distinct symbols, and multiply those by powers of 8 (instead of powers of 10). For example (in base 8), the number 2,051 means:
There is even hexadecimal notation in which we work in base 16, so we need 16 symbols. These are our usual 0 through 9, augmented by A, B, C, D, E, and F (counting for 10 through 15). So, in base 16 we might write:
But back to binary: this is what we use for digital (that is, computer) representations. With only two symbols, 0 and 1, numbers look like this:
Each of the places is called a bit for (Binary digIT). The leftmost bit is called the most significant bit (MSB), and the rightmost is the least significant bit (because the digit in the leftmost position, the highest power of 2, makes the most significant contribution to the total value represented by the number, while the rightmost makes the least significant contribution). If the digit at a given bit is equal to 1, we say it is set. We also label the bits by what power of 2 they represent. How many different numbers can we represent with 4 bits? There are sixteen such combinations, and here they are, along with their octal, decimal, and hexadecimal counterparts:
Some mathematicians and philosophers argue that the reason we use base 10 is that we have ten fingers (digits)those extraterrestrials we met in Chapter 1 who hear light might also have an extra finger or toe (or sqlurmphragk or something), and to them the millennial year might be the year 1559 (in base 11)! Boy, that will just shock them right out of their fxrmmp!qts! Whats important to keep in mind is that it doesnt much matter which system we use; theyre all pretty much equivalent (1010 base 2 = 10 base 10 = 12 base 8 = A base 16, and so on). We pick numeric bases for convenience: binary systems are useful for switches and logical systems, and computers are essentially composed of lots of switches. Numbering Those BitsConsider the binary number 0101 from Figure 2.12. It has 4 bits, numbered 0 to 3 (computers generally count from 0 instead of 1). The rightmost bit (bit zero, the LSB) is the "ones" bit. If it is set (equal to 1), we add 1 to our number. The next bit is the "twos" bit, and if set adds 2 to our number. Next comes the "fours" bit, and finally the "eights" bit, which, when set, add 4 and 8 to our number, respectively. So another way of thinking of the binary number 0101 would be to say that we have zero eights, one four, zero twos, and one 1.
Dont worry about remembering the value of each bit. Theres
a simple trick: to find the value of a bit, just raise it to its bit number
(and remember to start counting at 0!). What would be the value of bit
4 in a five-bit number? If you get confused about this concept, just remember
that this is simply what you learned in grade school with base 10 (the
1s column, the 10s column, the 100s column, and so on). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Again, thinking of the analogy with base 10, how many numbers can we represent in three "places" (0 through 999 is the answer, or 1,000 different numbers). A more general question is this: for a given base, how many values can be represented with n places (cant call them bits unless its binary)? The answer is the base to the nth power. The largest number we can represent (since we need 0) is the base to the nth power minus 1. For example, the largest number we can represent in binary with n bits is
OK, weve got that figured out, right? Now back to sound. Remember that a sample is essentially a "snapshot" of the instantaneous amplitude of a sound, and that snapshot is stored as a number. What sort of number are we talking about? 3? 0.00000000017? 16,000,000,126? The answer depends on how accurately we capture the sound and how much space we have to store our data. |
<-- Back to Previous Page | Next Section --> |
©Burk/Polansky/Repetto/Roberts/Rockmore. All rights reserved.