Lab 07 - Digital building blocks

Much of what we experience in the physical world is not binary. For example, throughout the day the intensity of light changes in very small amounts over a continuous range of values. That is another way of saying that we can see the difference between noon and midnight very clearly, but the difference between noon and one minute past noon is almost impossible to see. But what does that mean when we talk about the digital world, or the world of computing?

Think of an old thermometer, the kind that has a column of mercury inside a glass tube. It uses a scale of degrees (or tenths of degrees or hundredths) to measure differences in temperature. Imagine you are interested in the temperature outside your house. It may be that plus or minus five degrees is a good scale - you would go out of the house in shorts if it was 75¨H, plus or minus five degrees. But you might want more precision, such as when you need to make ice cubes. Since ice freezes at 32¨H, five degrees colder might be fine, but five degrees warmer would not. To get better precision, we can divide up the temperature scale, or the marks on the column of mercury, into smaller and smaller pieces to represent smaller and smaller differences. Those differences are represented by discrete units, or digits. We can now see the difference between a temperature of 98.6¨H and 98.7¨H, even if we can't feel any difference.

This dividing up into very small pieces to more closely represent the change in something is the same technique used to represent audio and video digitally. The event of sound or sound and visual is happening continuously, and to accurately represent changes, we need to take very small samples and represent them with collections of the binary digits (or bits) that computers can operate on. These presences and absences, or ones and zeros, are the building blocks of our digital world.

To consider:

A closer look at the digital

In this seventh lab, we'll look at different levels and types of encoding, as well as tools to help us convert analog representations to digital ones. As you explore, review your answers from the To consider: section above. Have you changed your mind about any of them?

Learning more

As you can imagine, there are plenty of examples of digital encoding all around us. Some are an attempt to replicate the physical world as closely as possible, while others take a less serious approach.

  1. Saving high-pixel density images as smaller file sizes results in a loss of image quality. Image-editing programs use smart algorithms to keep "important" information about the picture. The overall dimensions of the image remain the same, but progressively larger samples are taken of the image information, resulting in what can be a pixelated image. Take a look at the video below, first as it is embedded in this page, then in full-screen mode:

    • What do you notice about how long it takes you to see a significant change?
    • Was watching the video in the embedded frame different from the full-screen? How so?
    • Why do you think the changes got more noticeable as you got closer to the end of the video?

  2. There are many digital image encoding standards - you may recognize them by their file extensions. .tiff, .jpg or .jpeg, and .png are just a few examples. But images can also be encoded using ASCII characters as substitutions for the image information, in much the same way pixels are used. Here's one example, from Sau Fan Lee's ASCII Art Generator project on The Code Project site.

    ASCII art - woman's face

    The image also links back to Sau Fan Lee's project page, where you can see the original image that has been re-encoded into ASCII. Why do you think he took the time to write this program?

    Andreas Friese, an ASCII artist also known as a:f, has a gallery of his art that is not recreating images at all, but creating them. Why do you think someone like Andreas would spend so much time using his text editor to create these images, instead of using some other art medium? Give ASCII art a try by using the online ASCII art and ASCII text generators at mastervb.net, or take a look at Joan G. Stark's old school site. Did you take a look at that page's source code? What did you find?

  3. Encodings often work to facilitate information transfer, such as communicating messages. Older technology solutions like and Morse code for telegraph operators allowed for complex messages to be sent even with very simple tools, as long as both sides understood the encoding.

    You can also encode messages for secure transmission. Cryptographic techniques like PGP encryption and steganography go beyond simple encoding to protective measures that obscure the transmitted message. When is cryptographic encoding useful? Could it be misused?

  4. Try IT: Looking at encoding tools
    There are plenty of sites that can help you with what can sometimes be the tedious chore of encoding. Need to convert a number from hex to binary? Want to get the correct hex value for a color you are using on your website? These tools can help.

    • Not that you'll ever need this one to do your homework, unless you are studying to become a radio and telegraph operator, but here's a cool way to see and hear what yout type as input that's output as Morse code. Try using the Morse Code Translator with both the translate and play buttons.
    • Here's a tool that can either give you the hex value for the color you see, or display the color with a 6-digit hexadecimal number as input. Try W3School's HTML Color Picker. You can find lots of other options online. Find a good color and use a tool like Firebug to test it out on a site you visit.
    • You can use a site like Wolfram Alpha to convert binary to hex to whatever you want, but sometimes a quick web converter is all you need. Try mathisfun.com's Binary to Decimal to Hexadecimal Converter to see the values change as you type them in.

    There are so many types of encodings out there, digital and otherwise. Some were made to help transmit information, and some to help hide it.

    • Where do you encounter encodings in your world?
    • Do you know how many or most of them work?
    • Are there any you could improve?

Moving on

Much of our digital world is basedon the idea of representing continuous change with discrete samples. Want to know more about the origin of that idea? Take a look at Wikipedia's Calculus page, especially the work of Bonaventura Cavalieri, Gottfried Leibniz, and Sir Issac Newton. If you haven't had a calculus class, you might find it a bit challenging, but it might help to look at this image of a Riemann sum, or integral, which illustrates the progressively smaller samples method of approximating continuous changes (From Wikipedia user Ksmrq):
Riemann Sum - showing progressively smaller samples