Chapter 1 Information-Representation
Chapter 1 Information-Representation
Sound
What is binary?
Binary is a base 2 number system, meaning that all numbers and other data can only
represented using ones and zeros. All modern computer systems store data and programs in
binary
This stream of ones and zeros could represent any form of data – text, graphics, video, sound
This system is more accurate. Internal memories (such as RAM) should be measured using
the IEC system. A 64 GiB RAM could, therefore, store 64 × 230 bytes of data (68 719 476 736
bytes).
09-Sep-22 Mr. Noureddine Tadjerout 13
1.1 Data Representation
Number systems:
Designers of computer systems adopted the binary (base 2) number system since this allows
only two values, 0 and 1.
Let’s suppose we are trying to find the binary for the decimal number 75
Hex codes are used in many areas of computing to simplify binary codes. It is important to note
that computers do not use hexadecimal - it is used by humans to shorten binary to a more
easily understandable form. Hexadecimal is translated into binary for computer use.
colour references
assembly language programs
error messages
As one hex digit represents 4 bits, two hex digits together make 8 bits (1 byte). The values for each colour
run between 00 and FF. In binary, 00 is 0000 0000 and FF is 1111 1111. That provides 256 possible values
for each of the three colours.
That gives a total spectrum of 256 reds x 256 greens x 256 blues - which is over 16 million colours in total.
#FF0000 will be the purest red - red only, no green or blue.
Black is #000000 - no red, no green and no blue.
White is #FFFFFF.
spectrum mean is a band of colours
25
1.1 Data Representation
a.)Converting from Hexadecimal to Decimal or (Denary)
26
1.1 Data Representation
a).Converting from Hexadecimal to Decimal or (Denary)
27
1.1 Data Representation
a).Converting from Hexadecimal to Decimal or (Denary)
28
1.1 Data Representation
a).Converting from Hexadecimal to Decimal or (Denary)
Click the link below to watch the video to How to convert Hexadecimal to Decimal or (Denary)
https://www.youtube.com/watch?v=pg-HEGBpCQk
29
1.1 Data Representation
b).Converting from Decimal to Hexadecimal
30
1.1 Data Representation
b).Converting from Decimal to Hexadecimal
31
1.1 Data Representation
b).Converting from Decimal to Hexadecimal
32
1.1 Data Representation
b).Converting from Decimal to Hexadecimal
Click the link below to watch the video to How to convert Decimal to Hexadecimal
https://www.youtube.com/watch?v=QJW6qnfhC70
34
1.1 Data Representation
C). Converting from Binary to Hexadecimal
Click the link below to watch the video to How to convert Binary to Hexadecimal
https://www.youtube.com/watch?v=tSLKOKGQq0Y
37
1.1 Data Representation
Number systems: Binary addition and subtraction
Click the link below to watch the video to How To Add and Subtract Binary Numbers:
https://www.youtube.com/watch?v=C5EkxfNEMjE
Question:
Answer:
a) 0 0 1 1 0 1 0 1 - 0 1 0 0 1 0 0 0
b) 0 1 0 0 1 1 0 1 - 0 1 1 0 1 1 1 0
c) 0 1 0 1 1 1 1 1 - 0 0 0 1 1 1 1 0
d) 0 1 0 0 0 1 1 1 - 0 1 1 0 1 1 1 1
e) 1 0 0 0 0 0 0 1 - 0 1 1 1 0 1 1 1
f) 1 0 1 0 1 0 1 0 - 1 0 1 0 1 0 1 0
It is not possible to add minus or plus symbol in front of a binary number because a binary
number can have only two symbol either 0 or 1 for each position or bit. That’s why we use
this extra bit called sign bit or sign flag. The value of sign bit is 1 for negative binary numbers
and 0 for positive numbers.
When an integer binary number is positive, the sign is represented by 0 and the magnitude
by a positive binary number. When the number is negative, the sign is represented by 1 but
the rest of the number may be represented in one of three possible ways: Sign-Magnitude
method, 1’s Complement method, and 2’s complement method. These are explained as
following below.
09-Sep-22 Mr. Noureddine Tadjerout 54
1.1 Data Representation
Number systems: One’s and Two’s Compliment
a). Signed Magnitude method
In this method, number is divided into two parts: Sign bit and Magnitude. If the number is
positive then sign bit will be 0 and if number is negative then sign bit will be 1. Magnitude is
represented with the binary form of the number to be represented.
Example 1: Let we are using 5 bits register. The representation of -5 to +5 will be as follows:
Example 1: Let we are using 4 binary bits register. The representation of -7 to +7 will be as
follows:
57
1.1 Data Representation
Number systems: One’s and Two’s Compliment
c). Two’s Complement Method:
Positive numbers are represented in the same way as they are represented in sign magnitude
method. If the number is negative then it is represented using 2’s complement. First represent
the number with positive sign and then take 2’s complement of that number.
58
1.1 Data Representation
Number systems: One’s and Two’s Compliment
c). Two’s Complement Method:
Example 2: Let we are using 5 bits registers. The representation of -5 and +5 will be as follows:
+104 128 64 32 16 8 4 2 1
Binary 0 1 1 0 1 0 0 0
1 comp 1 0 0 1 0 1 1 1
Opposite
Add 1 0 0 0 0 0 0 0 1
- 104 1 0 0 1 0 0 0 0
60
Recap Two's Complement
(- 49) = ?
(- 109) = ?
(- 107) = ?
(- 77) = ?
(- 17) = ?
( - 122) = ?
( - 38 ) = ?
( - 200 ) = ?
( -26 ) = ?
(-2) = ?
( -11) = ?
( - 52) = ?
Extended ASCII
Extended ASCII code is an 8-bit character set that represents 256 different characters,
making it possible to use characters such as é or ©. Extended ASCII is useful for
European languages
Global companies, like Facebook and Google, would not use the ASCII character set
because their users communicate in many different languages.
Sound
• A bitmap file has a header containing meta data, which defines the colour
depth and the resolution
https://www.bbc.co.uk/bitesize/guides/zqyrq6f/revision/1
Bit-map images are made up of pixels (picture elements); the image is stored in a two
dimensional matrix of pixels.
It is possible to estimate the file size needed to store a bit-map image. The file size will need to
take into account the image resolution and bit depth.
Example: a full screen with a resolution of 1920 × 1080 pixels and a bit depth of 24 requires
1920 × 1080 × 24 bits = 49 766 400 bits for the full screen image
Dividing by 8 gives us 6 220 800 bytes (equivalent to 6.222 MB using the SI units or 5.933 MiB
using IEE units). An image which does not occupy the full screen will obviously result in a
smaller file size.
Note: when saving a bit-map image, it is important to include a file header; this will contain
items such as file type (.bmp or .jpeg), file size, image resolution, bit depth (usually 1, 8, 16, 24
or 32), any type of data compression employed and so on.
https://www.bbc.co.uk/bitesize/guides/z7vc7ty/revision/2
09-Sep-22
© Cambridge University Press 2019 Mr. Noureddine Tadjerout 113
1.2 Multimedia:
B)-Sound :
Sound is an analogue value; this needs to be digitized in order to store sound in a computer. This
is done using an analogue to digital converter (ADC). If the sound is to be used as a music file, it
is often filtered first to remove higher frequencies and lower frequencies which are outside the
range of human hearing. To convert the analogue data to digital, the sound waves are sampled
at a given time rate. The amplitude of the sound cannot be measured precisely, so approximate
values are stored.
09-Sep-22 114
1.2 Multimedia:
B)-Sound :
What is bandwidth of frequency?
Bandwidth is a range of frequencies within a continuous set of frequencies. It is measured
in Hertz (Hz). The purpose of a communication system is to transfer information from the
transmitter which is located in one place to a receiver which is usually far away from the
transmitter.
09-Sep-22 115
1.2 Multimedia:
B)-Sound :
Figure above shows a sound wave. The x-axis shows the time intervals when the sound was sampled (0 to
20), and the y-axis shows the amplitude of the sampled sound (the amplitudes above 10 and below 0 are
filtered out in this example).
At time interval 1, the approximate amplitude is 9; at time interval 2, the approximate amplitude is 4, and so
on for all 20 time intervals. Because the amplitude range in Figure above is 0 to 10, then 4 binary bits can be
used to represent each amplitude value (for example, 9 would be represented by the binary value 1001).
Increasing the number of possible values used to represent sound amplitude also increases the accuracy of
the sampled sound (for example, using a range of 0 to 127 gives a much more accurate representation of
the sound sample than using a range of, for example, 0 to 10). This is known as the sampling resolution
(also known as the bit depth).
09-Sep-22 Mr. Noureddine Tadjerout 116
1.2 Multimedia:
B)-Sound :
Example: The sequence of data is stored as a single value and count. For example, for a minute
of a scene filmed at a beach there would be similar colours on screen for the duration of the
shot, such as the blues of the sky and the sea, and the yellows of the sand.