| > To Continue with Chapter 2
Binary Numbers All right. Now we know more than we ever wanted to know about how fast to store numbers in order to digitally represent a signal. But surely, speed isn't the only thing that matters? What about size? In this section, we'll 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 0s and 1s. This is also called a base 2 representation. In order to explain things in base 2 (and base whatever, except for maybe third base), let's think for a minute about those ordinary numbers that we use. You'll remember that we use a decimal representation. This means that we write numbers as finite sequences whose symbols are taken from a collection of 10 symbols: our digits 0,1,2,3,4,5,6,7,8 and 9. You learned all this in grade school, but we know you were fast asleep so we're going to tell you again. 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 8 distinct symbols, and multiply those by powers of 8 (instead of powers of 10). For example (in base 8), the number 2051 means:
There is even hexadecimal notation in which we work in base 16, so we need 16 symbols. These are our usual 0,....,9, augmented by A,B,C,D,E, and F (counting for 10 through 15). So, we might write (in base 16):
But back to binary (sorry, not a "dual" as you might think, or a "two-al," or a "bi-al"). 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 two 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 (base 8), decimal (base 10), and hexadecimal (base 16) counterparts:
Some mathematicians and philosophers argue that the reason we use base 10 is that we have 10 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! What's important to keep in mind is that it doesn't much matter which system we use, they're 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 sake: binary systems are useful for switches and logical systems, and computers are essentially composed of lots of switches!
Numbering Those Bits Consider the binary number 0101 above. It has four bits, numbered 0 to 3 (computers generally count from zero instead of one). 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, which, when set, adds 4 and 8 to our number respectively. So another way of thinking of the binary number 0101 would be to say that we have 0 eights, 1 four, 0 twos and 1 one.
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 (remember to start counting at 0!) What would be the value of bit 4 in a 5-bit number? If you get confused about this concept, just remember that's this is just what you learned in first grade with base 10 (the 1s column, the 10s column, the 100s column, and so on).
The crucial question is, though: how many different numbers can we represent with four bits? Or more importantly, how many different numbers can we represent with n bits? That will determine the resolution of our data (and for sound, how accurately we can record minute amplitude changes). Look back at Table 1: using all possible combinations of the four bits, we were able to represent sixteen numbers (but notice that, starting at zero, they only go to 15.) What if we only used two bits? How about sixteen? Again, thinking of the analogy with base 10, how many numbers can we represent in three "places" (0 through 999 is the answer, or 1000 different numbers). A more general question is the following: for a given base, how many values can be represented with n places (can't call them bits unless it's binary)? And the answer is: the base to the nth power. The largest number we can represent (since we need zero) is the base to the nth power minus 1. For example, the largest number we can represent in binary with n bits is 2n - 1.
Modern computers use 64 bit numbers! If 232 is over 4 billion, try to image what 264 is (232 x 232). It's a number almost unimaginably large. As an example, if you counted very fast, say 5 times a second, from 0 to this number, it would take you over 18 quintillion years to get there (you'll need the lives of several solar systems to accomplish this). Better get started... OK, we've 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 numbers are we talking about? 3? .00000000017? Sixteen billion, one hundred twenty-six? The answer depends on how accurately we capture the sound, and how much space we have to store our data.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||