GCSE COMPUTER SCIENCE Data 2.3 Analogue Data, Compression and Encryption
Storage Units bit (b) byte (B) x 8 kilobyte (KB) x 1024 megabyte (MB) In order to be able to calculate the file sizes of different types of file, you need to be able to convert between the different storage units. bit (b) byte (B) x 8 kilobyte (KB) x 1024 megabyte (MB) x 1024 gigabyte (GB) x 1024 terabyte (TB) x 1024
Use a calculator to calculate the number of bytes. Activity 1 Use a calculator to calculate the number of bytes. Number of bytes 1 kilobyte (KB) = 1024 bytes 1024 1 megabyte (MB) = 1024 kilobytes 1024 x 1024 = 1,048,576 1 gigabyte (GB) = 1024 megabytes 1024 x 1024 x 1024 = 1,073,741,824 1 terabyte(TB) = 1024 gigabytes 1024 x 1024 x 1024 x 1024= 1.09 * 1012 (appox 1 trillion)
You need to remember these, especially the order. Speed & Storage Units Speed Units hertz (Hz) Storage Units byte (B) Hertz kilohertz (KHz) Bytes kilobyte (KB) megahertz (MHz) megabyte (MB) gigahertz(GHz) gigabyte (GB) terabyte (TB) You need to remember these, especially the order.
Activity 2 We need a phrase to remember this sequence. Bytes B BIG Kilobytes K KANGAROOS Megabytes M MAKE Gigabytes G GOOD Terabytes T TEA Your task is to create a poster to remember this phrase!
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.
Sound The process of digitising sound is known as sampling. Sampling an analogue sound wave involves taking samples at evenly spaced time intervals and representing the samples as numerical values. The quality of the sound depends on the sampling rate, which is the number of samples taken per second (measured in Hz) and the bit depth (the number of bits used to store each sample).
Calculating File Size 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) ACTIVITY Write this formula in your book.
Calculating Bit Depth File Size (in bits) You can calculate the bit depth of sound using the following formula: File Size (in bits) sampling rate (in Hz) x channels x time (in seconds) ACTIVITY Write this formula 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.1 KHz How many bits per sample 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 Calculate the file size of a CD quality, stereo sound track that is 2.5 minutes long. Give your answer in megabytes to 1 decimal place. 44,100 * 16 * 2 * 150 = 211,680,000 bits To get it into bytes / 8 = 26,460,000 Kilbobytes / 1024 = 25,839 Megabytes / 1024 = 25.2342224 To one decimal place = 25.2MB Calculate the bit depth of a 5 MB, 2 minute, stereo sound track, with a sampling rate of 30 kHz. File size in KB 5 * 1024 = 5,120 File size in B 5,120 * 1024 = 2,242,880 File Size in Bits * 8 = 41,943,040 30 * 1024 * 2 * 120 = 7,373,800 Bit depth = 5.68 An analogue-to-digital converter samples the temperature of a furnace every two hours. Each sample is stored as a 32-bit number. How many bytes of data are stored in a week? Every two hours 4 bytes of data is stored because 32-bit is the same as four bytes (32/8 = 4). Each day 48 bytes of data are stored (4 * 12). In one week 336 bytes of data is stored (7 * 48).
Compression Compression is the process of reducing the size of a file. It allows us to reduce the amount of storage space we use and to up the transfer of files over networks. There are three types of compression. Lossless Reduces the size of a file while retaining all of the original information. Lossy Reduces the size of a file by permanently removing some of the data. Superchannel A form of compression where special data is selected for a special reason. These pieces of data are separated from the rest, and the rest are thrown out. ACTIVITY Write these three definitions in your book.
Linked under this lesson on www.mrlyoncomputing.com Pros and Cons Play this game to hep you understand the advantages and disadvantages of each type of compression. Linked under this lesson on www.mrlyoncomputing.com
Activity 6 Explain the advantages and disadvantages of lossy and lossless compression. Advantages Disadvantages Lossless Keeps all of the original data so the original can be reproduced exactly when the file is uncompressed. Reduces the file size but not by as much as lossy compression. Lossy Does not keep all of the original data so the file can be compressed much more than in lossless compression. Some data is permanently lost from the file, therefore the original can never truly be recreated when the file is uncompressed.
Start / Computer / ICT (I:) / GCSE Computer Science / Compression Task Activity 7 You are going to compress three different text files to see what happens Start / Computer / ICT (I:) / GCSE Computer Science / Compression Task Right click on the Compression Task folder and copy it into your C1 folder Right click on each of the files in the folder, click on Send to / Compressed (zipped) folder
Activity 8 Copy and complete this table to see what the compression does to each file. File A File B File C How many characters does the file contain? What type of content does the file contain? What is its file size before compression? What is its file size after compression? What is its compression ratio (decompressed size/compressed file size)? Which file compresses the most? Explain why.
Run Length Encoding Watch this video to learn more about Run Length Encoding. Link: https://www.youtube.com/watch?v=ypdNscvym_E
Write this definition in your book. Run Length Encoding Run length encoding (RLE) is a simple form of lossless data compression in which runs of data (sequences in which the same data value occurs consecutively) are stored as a single data value and count, rather than as the original run. ACTIVITY Write this definition in your book.
Activity 9 Text string Answer AAAABBBBBBBBBCADDDDEEFFFFFFFF 4A9BCA4D2E8F ABCABCABCABCABCABCABCABCABCS BBGGYYAACCFFEEBBGGYYAACCFFEE 2B2G2Y2A2C2F2E2B2G2Y2A2C2F2E Which one compresses the most? The first string. Why is this? Lots of repeated letters in the string that are in sequence. Describe in English the process the RLE calculator follows to encode a piece of text. Look for sequences of letters in the string. Count how many letters are in each sequence. Shorten the sequence to the amount and the letter only.
The wheels on the bus go round and round all day long. Activity 10 Copy this text out. The wheels on the bus go round and round, round and round, round and round. The wheels on the bus go round and round all day long. How many characters, including spaces and punctuation marks, are there in this song? 130 (including the space between the first and second line) Assuming one byte is used to represent each character, what is its file size? 130 bytes
Make a list of all of the words used more than once in the song. Activity 11 Word Number of times used Number of bytes in word The 2 3 wheels 6 on the bus go round 8 5 and 4 all 1 day long Make a list of all of the words used more than once in the song. Lookup table The 1 wheels 2 on 3 the 4 bus 5 go 6 round 7 and
Activity 12 Now use the lookup table you have completed to encode the song, replacing repeated words with the number representing their position in the table. Lookup table The 1 wheels 2 on 3 the 4 bus 5 go 6 round 7 and New String Becomes 0 1 2 3 4 5 6 7 6 6 7 6 6 7 6 0 1 2 3 4 5 6 7 6 all day long
Write this both parts of this definition of encryption in your book. Encryption allows data to be kept secret and secure so no one else can make use of it. A key is used to encrypt plain text into meaningless cipher text, the same key is used to decrypt the data back into its original form. Only someone who knows the key can decrypt the cipher. If you don’t have the key you need to crack the code. ACTIVITY Write this both parts of this definition of encryption in your book.
QKH WUHDVXUH LV KLGGHQ XQGHU WKH SDOP WUHH Activity 12 Decrypt this message Message Decrypted Message QKH WUHDVXUH LV KLGGHQ XQGHU WKH SDOP WUHH Hint H = E and W = T The treasure is hidden under the palm tree HINT Write out the alphabet on one line of your book, it will help!
Caesar Cipher Watch this video to learn more about the Caesar Cipher. Link: https://www.youtube.com/v/sMOZf4GN3oc
Activity 12 Answer the following question Question Answer Explain how the Caesar Cipher works. The Caesar Cipher is a simple method of encryption and would not be used today because it is so easy to crack. The letters of the alphabet are shifted a set number of places. A positive shift moves the letters to the right, a negative shift moves them to the left. For example, a shift of +2 would change the letter A to a C and so on.
Activity 13 You are going to create your own Caesar Cipher wheel Follow the instructions on the hand out. Equipment needed 2 x different colour pens, scissors and a paper fastener.
Use your Caesar Cipher wheel to decode and encode these messages. Activity 14 Use your Caesar Cipher wheel to decode and encode these messages. Plain text Shift Encrypted text THE CAESAR CIPHER IS AN EXAMPLE OF ROMAN INGENUITY 5 YMJ HFJXFW HNUMJW NX FS JCFRUQJ TK WTRFS NSLJSZNYD THE KEY IS HIDDEN UNDER THE FLOWERPOT 3 QEB HBV FP EFAABK RKABO QEB CILTBO MLQ You can use the online Caesar Cipher linked on www.mrlyoncomputing.com to check your answers.