Our site uses cookies. Some of the cookies we use are essential for parts of the site to operate and have already been set. You may delete and block all cookies from this site, but parts of the site will not work. To find out more about cookies on this website, see our Cookie Policy
Accept
© eRevision.uk and ZigZag Education 2025
This test is run by .
Note that your final mark will not be saved in the system.

Representing Sound / Data Compression GapFill

Target Level
4-5
Running Total
0
0%
Attempt
1 of 3

You must fill all the gaps before clicking ‘Check Answers!’

Sounds are created by continuous waves, which cannot be directly represented as binary values. To store a sound on a computer, the sound wave must first be converted into  discretefinalinitialcomplete values. This is done by sampling the sound wave at set  secondsintervalschangesmoments, which produces a sequence of discrete values that approximates the wave. These samples are usually measured in hertz, e.g. 1 hertz = 1 sample per second with the sample resolution defined as the number of  bytes in a secondseconds in a bitbits in a secondbits per sample. The size of a sound file can be calculated as  size (bits) = bit depth * sample rate * duration of soundsize (bits) = sample rate * duration of sound ÷ bit depthsize (bits) = bit depth * duration of sound ÷ sample ratesize (bits) = bit depth * sample rate ÷ duration of sound.

In a typical music CD, the music is sampled at 44100 samples per second. The higher the sample rate the  betterlargermore expensivemore organised the file needed to store the data. As music and images are commonly transmitted across the internet it is important to reduce the file size to reduce transmission times whilst retaining as much quality of the original image or sounds as possible. There are two main types of compression used to reduce the file sizes, lossy and  soundlosslessimagecompleted compression. In  dataimagelossysound compression some of the original data  moved around in the fileswapped around in the filesaved in another fileremoved from the file, for example audio beyond the range of human hearing and altering the bit depth in an image. In lossless compression, enough information and data is stored about a file to be able to reproduce it exactly as before.  binary tree codeHuffman codingbinary tree compressionbinary tree storage is a method of compression which uses binary trees to record the details about a file.

Huffman coding tree for text: PROGRAMMING



Read the binary codes:

Character P R O G A M I N
Frequency 1 2 1 2 1 2 1 1
Huffman code 1111 101  1011101101 01 000 100 001 110
Bits 4 3 4 2 3 3 3 3
Total ( bits x frequency) 4 6 4 4 3 6 3 3

The total bits in the compressed text = 33 bits. ASCII would result in 7 x 11 = 77 bits.

Another method of lossless compression is run length encoding (RLE) which looks for  white pixelsblack pixelspixelsconsecutive data which is repeated and records what the data is and how many occurrences there are.



Read the binary codes:

In this simple example of a binary cat image this example shows how the eighth row can be compressed.

1 1 1 1 1 1 0 0 1 1 1 1 1 1

There are 6 black, 2 white, 6 black pixels which can be encoded using 1 for black and 0 for white, followed by the number of pixels.  This would therefore be represented as 10000110  0000 00100010 11001000 11111010 1111 10000110 which demonstrates how the row can now be stored in 3 bytes rather than 4 bytes (14 characters)

This is your 1st attempt! You get 3 marks for each one you get right. Good luck!

Pass Mark
72%