GCSE COMPUTER SCIENCE Topic 3 - Data 3.2 Data Representation
This presentation covers the following content from the specification Students should: 3.2.1 understand how computers encode characters using ASCII 3.2.2 understand how bitmap images are represented in binary (pixels, resolution, colour depth) 3.2.3 understand how sound, an analogue signal, is represented in binary 3.2.4 understand the limitations of binary representation of data (sampling frequency, resolution) when constrained by the number of available bits
Character Sets Computers have to be able to represent letters and symbols as well as numbers. Simply, the idea is to give each character a number, as a code and store the codes and their meanings in a table. Character Set The defined list of characters recognised by a computers hardware and software.
ASCII A common code is ASCII - the American Standard Code for Information Interchange. This uses 7 bits to store characters. Seven bits is enough to code 128 different characters. Symbol Binary A 100 0001 B 100 0010 C 100 0011 D 100 0100 E 100 0101 F 100 0110 ACTIVITY Using this information write a definition of ASCII in your exercise books. You do need to know what it stands for and how many bits it uses. Extended ASCII is an alternative character set, this uses 8-bits so can store more than 128 characters. Unicode is another alternative character set. It uses 16 bits to encode each character and can represent far more characters than ASCII (over 65,000). ALTERNATIVES
Unicode Unicode is an alternative character set and encoding system. It uses 16 bits to encode each character and is therefore able to represent far more characters than ASCII (over 65,000).
Use the table of ASCII binary codes to decode these letters Activity 1 Use the table of ASCII binary codes to decode these letters ASCII Binary Code Decimal Value Character 110 1000 104 h 110 0101 110 1100 110 1100 110 1111
Use the table of ASCII binary codes to decode this: Activity 2 Use the table of ASCII binary codes to decode this: Character Decimal Value ASCII Binary Code H o l a n d Character Decimal Value ASCII Binary Code P a r k
Activity 3 What is the ASCII code for a blank space? Copy and complete the questions below. Question Answer What is the ASCII code for a blank space? 32 - 0100000 Why is it important to have a code for a blank space? Otherwise the computer would not recognise where one word finishes and the next begins. Write your name in ASCII. Write a word of your choice in binary in your book. Swap with the person next to you and see if you can decode each others word.
Bitmap Images Images can be represented using a grid of squares called pixels. Each pixel can be uniquely identified by its position in the grid (x/y coordinates) and each pixel is a single colour. Pixel The dots that make up an image on screen ACTIVITY Write these definitions of a Bitmap Image and a pixel in your book. Interactive Activity http://learncomputing.org/bitmap.php
Resolution The resolution is the number of pixels that make up an image. 5 pixels wide The image size of this image is: 5 * 6. Therefore the resolution of this image is 30. 6 pixels high
Write this definition of Colour Depth in your exercise book. A binary code is used to represent the colour of a pixel. The number of bits used to store each pixel’s colour is known as the colour depth. The greater the colour depth, the more colours can be represented. ACTIVITY Write this definition of Colour Depth in your exercise book. The number of colours that can be represented can be calculated using 2depth. For example a colour depth of 1 bit can represent 2 colours. 2no. of bits Therefore 3 bits = 2 3
Complete the colour depth table below. Activity 4 Complete the colour depth table below. Colour depth Number of colours Range 1 bit (21) 2 0 - 1 2 bit (22) 3 bits (23) 0-7 4 bits (24) 16 8 bits (28) 16 bits (216) 65536 24 bits (224) 16777216 32 bits (232) 4294967296 0 - 4294967295
1-Bit Images 1, 0, 0, 0, 1 1, 1, 1, 1, 0 Leave space here This image has only two colours, black and white and therefore has a colour depth of 1 bit. 1, 0, 0, 0, 1 Leave space here 1 = white 0 = black 1, 1, 1, 1, 0 1, 0, 0, 0, 0 0, 1, 1, 1, 0 0, 1, 1, 1, 0 1, 0, 0, 0, 0
Activity 5 Copy and complete the grid below to reveal what character this code produces. Binary code 00000 01111 11110 1 = white 0 = black Use a ruler.
Activity 6 Produce the binary code to produce the letter ‘G’ in the grid below. Binary code 1 = white 0 = black Use a ruler. Hint: Do the sketch first
The first number always represents white. How could his be stored more efficiently? This image has only two colours, black and white. 1, 3, 1 The first number always represents white. 4, 1 1, 4 0, 1, 3, 1 0, 1, 3, 1 1, 4 ACTIVITY Complete the Image Representation worksheet using this method.
Image data has limitations when it is represented using binary values Image Limitations Image data has limitations when it is represented using binary values Resolution If the resolution of an image is low, the quality of the image will be reduced. Example 1 Example 2 The above image pairs have the same image size, but a different resolution, the main factor is the size of the pixels.
Data Analogue Data Is continuous, allowing for an infinite number of possible values. Digital Data Is discrete, it has a limited set of values. To be handled by a computer, analogue data has to be converted to digital (or digitised). ACTIVITY Write these two definitions in your book.
The number of samples taken per second, measured in Hertz. Sound Sampling The process of digitising sound. Sampling an analogue wave involves taking samples at evenly spaced time intervals and representing the samples as numerical values. Sampling Rate The number of samples taken per second, measured in Hertz. Bit Depth The number of bits used to store each sample (sometimes called sample resolution).
File Size of Sound You need to understand how to calculate the file size of a sound. You need four pieces of information: Sample Rate Hertz Bit Depth Bits Channels Mono = 1 Stereo = 2 Duration Seconds You only need to show how it would be calculated, you don’t need to perform the actual calculation.
File Size of Sound sampling rate (in Hz) x bit depth (in bits) You can calculate the file size of sound using the following formula: sampling rate (in Hz) x bit depth (in bits) channels duration (in seconds) You get marks for showing the working out, not the result
Write this example in your book File Size of Sound Worked Example Formula Calculation Addition Information sampling rate (in Hz) x bit depth (in bits) channels duration (in seconds) 44,100 x 16 2 150 sample rate of a CD bit rate of a CD stereo 2.5 minutes in seconds ACTIVITY Write this example in your book
Activity 3 Question Answer Describe the process of converting analogue sound waves into digital data. Sampling an analogue sound wave involves taking samples at evenly spaced time intervals and representing the samples as numerical values. What is the difference between analogue and digital data? Analogue data is continuous, digital data is discrete, that means it has a limited set of values. What is meant by the term ‘sampling rate’? The number of samples taken per second, measured in Hertz. What is meant by the term ‘bit depth’? The bit depth is the number of bits used to store each sample.
Activity 4 Use the Internet to help you answer these questions. Question Answer What is the sampling rate for CD audio? Give your answer in KHz. 44,100Hz (44.1 KHz) How many bits per sample (bit depth) are used for CD audio? 16 What about bit-depth for DVD audio? 24 Why do most sound recordings have two channels? So they can use stereo sound. This means different sounds can be produced. For example on a left and right speaker.
Activity 5 Question Answer Show the working to calculate the file size of a CD quality, stereo sound track that is 2.5 minutes long. 44,100 * 16 * 2 * 150 Show the working to calculate the file size of a CD quality, mono sound track that is 4 minutes long. 44,100 * 16 * 1 * 240 Show the working to calculate the file size of a DVD quality (24 bit) , stereo sound track that is 5 minutes long. 44,100 * 24 * 2 * 300
Sound Limitations Audio data has limitations when it is represented using binary values Sampling Rate If fewer samples are taken, the recording wont match the original as close and it may appear distorted or muffled. However, it will result in a smaller file size. Think about all the times you have watched a YouTube video that has poor sound, this could be the reason!