1.4 Data Encoding: Common Positional Numbering Systems
1.4 Data Encoding: Common Positional Numbering Systems
4 DATA ENCODING
All digital data is encoded as a sequence of bits and that information is associated with the
various patterns that these bits may exhibit. Many encoding techniques are available. A
numeral system is a way of representing numbers in written form.
1.4.3 Sound
Digital audio is used almost exclusively today when recording, processing, and distributing
sound. Online music stores contain hundreds of thousands of hours of digital sound; the
soundtracks and audio of DVD movies are encoded digitally; and your voice is digitally
encoded by your cell phone prior to being delivered to the person at the other end of the call
Sound is a physical phenomenon caused by waveforms that propagate through the air. A
microphone is used to transform the waveform into an analog electric signal after which the
analog signal is sampled to produce a digital encoding. Sampling is a process where the
strength of a changing signal is measured at regular time intervals and those measurements
are then recorded. In this way, the sound wave is converted into a sequence of numeric
values. Frequency is the rate at which sound waves change and is measured in terms of the
hertz. The hertz is denoted as Hz and is defined as the number of cycles (or changes) per
second. Sound waves that change at a slow rate are perceived as a low pitch while sound
waves that change at a high rate are perceived as higher in pitch. The average person can hear
sound waves 20 Hz up through about 20,000 Hz or 20 kHz
A sound wave is sampled ten times per second to obtain the sequence plotted on the
right
In this example, the sound wave has a frequency of approximately 4 Hz (although this is not
obvious) and must therefore be sampled at least eight times per second to adequately record
the signal. The actual sampling rate is 10 Hz, or ten times per second. Every tenth of a second
the strength of the sound wave is measured and recorded. It should be apparent that higher
sampling rates will yield more accurate encodings of the analog signal. The Nyquist–
Shannon sampling theorem, named after Harry Nyquist and Claude Shannon, states that the
rate at which samples are taken must be at least twice that of the highest frequency signal that
is to be measured. This theorem implies that a sampling rate of at least 40 kHz is required
when capturing sound waves that span the entire 20 to 20,000 Hz range of human hearing.
This fact explains why compact discs (CDs) are sampled at a rate of 44.1 kHz, digital audio
tapes (DATs) are sampled at 48 kHz, and a 96 kHz sampling rate is used for digital video
discs (DVDs). Consider a song that is five minutes long and is sampled at a rate of 48 kHz for
recoding on a digital audio tape. To determine the number of samples required to encode the
song we must note that there are 48,000 samples taken every second and that the song lasts
for 300 seconds. Thus, the song will be encoded as a sequence of 48000 × 5 × 60 or
14,400,000 samples. For this example, we will assume that a single sample is encoded as an
8-bit string, which means that the song can then be encoded in 14,400,000 bytes or about 14
MB. Of course if the number of bits required to encode a single sample is greater than 8, the
number of bytes required to encode the song also changes. Compact discs, for example, use
16 bits for each sample and DVD mastering usually requires 24 bits per sample.
1.4.4 Pictures
The most common encoding of a digital image is that of a two-dimensional grid of colors.
Each element of the grid is known as a pixel and represents a very small rectangular region of
the image that is comprised of a single color. When the grid of pixels is viewed at an
appropriate distance, the individual pixels recede from view while collectively appearing as a
naturally colored and smooth image. Images are typically encoded as a sequence of pixels
where each pixel corresponds to a single color. Since a color is normally encoded as a 24-bit
string, the total bits required to encode a digital image is on the order of 24 bits times the
number of pixels in the image. A small number of extra bits are also required to store useful
information such as the width and the height of the image. This extra information is referred
to as a header, and because the header can be encoded using an extremely small number of
bits relative to the pixel data, not consider it further. High-definition video uses individual
images that have up to 1920 columns and 1080 rows of pixels for a total of 1920 × 1080 or
2,073,000 pixels. Since each of these pixels is encoded as a bit string of length 24, the image
can be encoded as a bit string of length 1920 × 1080 × 24 or 49,766,400 bits. Alternatively,
using a byte as a measure of data capacity, the image can be encoded using 1920 × 1080 × 3
or 6,220,800 bytes or approximately 6 megabytes. Digital cameras take images that use on
the order of 10 megapixels and images of this resolution can be encoded as a string of 30
megabytes. Sometimes a picture does not contain many colors. Black-and-white images, for
example, use only two colors, whereas grayscale images use at most 256 colors; each color
being a unique achromatic gray.
While a color image generally uses 24 bits per color, other image types may use fewer than
24 bits per color since there are many fewer possible color values. Since grayscale images
may use no more than 256 colors, we can encode a grayscale color using 8 bits and since
there are only two colors in a black and-white image, we can encode the colors using a single
bit. More specifically, the image pixels could be encoded as the bit string
00111100010000101010010 11000000110100101100110010100001000111100.
A black-and-white image could be encoded using the bits shown on the right
DISCUSSION QUESTIONS:
1. Categorize the following as continuous data, discrete data and Information. (a)
Weight of newborn babies (b) Average score of IT third year students (c) Number of
students in IT department (d) Daily wind speed € Deviation in product price for last 3
months.
2. Identity the representation of sound while converting them into binary values.
3. Find the code which helps in converting text to binary.