Note that your final mark will not be saved in the system.
Representing Sound / Data Compression GapFill
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 values. This is done by sampling the sound wave at set , 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 . The size of a sound file can be calculated as .
In a typical music CD, the music is sampled at 44100 samples per second. The higher the sample rate the 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 compression. In compression some of the original data , 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. 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 | 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 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 10000110 which demonstrates how the row can now be stored in 3 bytes rather than 4 bytes (14 characters)