Representing Images Sound Other Data

4.5.6 (48 questions). Public Notes: AQA's A Level Computer Science

Audio

Describe analogue data.

Continuous - can take any value on a scale.

Describe digital data.

Discrete - can only take particular values.

Describe analogue signals.

  1. Analogue signals can take any values on a scale.
  2. Analogue signals can change as frequently as required.

Describe digital signals.

  1. Digital signals can only take one of a specified range of values.
  2. Digital signals can only change at specified intervals.

Describe how an Analogue to Digital Converter (ADC) works with sound waves

  1. The device measures the amplitude of the analogue wave at regular time intervals to produce samples.
  2. Each sample is stored in binary and a sequence a samples represents sound.

Describe how a Digital to Analogue Converter (DAC) works with sound waves

  1. The device reads the sequence of binary samples and outputs an alternating, analogue, electrical current.
  2. A speaker dome will move in/ out depending on the amplitude of this signal.

Define Sampling Rate.

The number of samples measured per second in Hz.

Define Sample Resolution.

The number of bits used to record each sample.

A 60 second stereo audio file was sampled at 44kHz and has a sample resolution of 24 bits. Calculate the file size in MB

  1. Stereo * length in seconds * sample rate in Hz * sample resolution in bits = file size in bits.
  2. 2 channels ∗ 60 seconds ∗ 44,000 Hz ∗ 24 bits = 126,720,000bits

  3. Convert to MB
  4. bits → bytes → kb → mb

    1. 126,720,000 bits / 8 = 15,840,000 bytes
    2. 15,840,000 / 1,000,000 = 15.84 MB

Answer: 15.84 MB

Explain how increases the sampling resolution will affect the properties of an audio file.

File size will increase, but the quality of audio will be higher, that is to say more accurate.

Explain Nyquist's theorem.

Sampling rate must be at least twice the highest frequency of the sound, in order for an accurate binary representation.

Explain how MIDI stores sound?

MIDI stores sound as a series of event messagesEach event message holds data as a series of instructions to reproduce that sound.

Give some pieces of information which event messages store.

  1. Duration of a note.
  2. How loud a note is.
  3. The pitch of a note.
  4. The octave within which the note is to be played.

State 3 advantages of MIDI over sound sampling

  1. Easy manipulation: event messages can be played by many instruments.
    1. event messages can be transposed to different instruments.
    2. The duration and timing of notes can be altered.

  2. MIDI files are often smaller than sampled audio files.
  3. MIDI files are a lossless format, so no information is lost.

State 2 disadvantages of MIDI over sound sampling.

  1. MIDI music can sound less realistic and "faked" which listeners might not appreciate.
  2. MIDI music cannot accurately represent human speech.

Images

Explain how raster images are stored in a bitmap file.

Images are series of ordered picture elements, known as pixels.

Define pixel.

picture element, the smallest identifiable area of an raster image, containing a binary value representing a single colour.

State the two properties of an image that image resolution could refer to.

The size of the image in pixels or The Pixels Per Inch (PPI).

How would you calculate image resolution in pixels.

Image resolution = height in pixels * width in pixels.

Define colour depth of a raster image.

  1. The number of bits per pixel used to store colour information.
  2. A measure of the range of colours which are present in the image.

An image can store 256 colours, calculate its colour depth.

Bit depth = log(256) / log(2) = 8 bits.

An image with 32 bits of metadata, a height of 100 pixels, a width of 250 pixels and has a range of 8 colours. Calculate the size of the image in KB.

  1. Use formula: log(colourRange) / log(2) = colour or bit depth.
  2. log(8) / log(2) = 3 bits

  3. Use formula: height * width * colour depth + metadata = size in bits.
  4. 100 *250 * 3 + 32 = 75,032 bits

  5. Convert to KB
    1. 75,032 bits / 8 = 9379 bytes
    2. 9379 bytes / 1000 = 9.379 KB

Answer: 9.379KB

State some pieces of information that may be stored within the metadata of image file.

  1. Resolution
  2. Colour depth
  3. Date created
  4. Geolocation co-ordinates
  5. Author

Explain how vectors images store data.

A list of geometric objects and shapes and their corresponding properties.

Give four typical properties of geometric object in a vector image.

  1. Stroke width
  2. Stroke colour
  3. Fill colour
  4. Start position, end position

State 2 advantages of vector images over bitmapped images.

  1. Can be scaled up or down (larger, or smaller) without becoming blurry or pixelated, because objects are simply redrawn.
  2. Often uses less storage space than bitmapped graphics.

State 2 disadvantages of vector images over bitmapped images

  1. Fine details such as strands of hair are more accurately represented with pixels than geometric shapes.
  2. Modification of raster images is more precise than geometric shapes, so unsuitable for applications such as photography.

Compression

Explain 2 advantages of compression of images, sound, text and other binary data

  1. Reduces file size.
  2. Meaning more data can be stored per unit of storage space.

  3. More economical
  4. Therefore...

    1. Speeds of transmission across a network are faster.
    2. More data can be transferred per unit of time.

Describe lossy compression.

Some information is lost: such as reducing sample resolution or the size of a image in order to decrease file size.

Describe lossless compression.

No information is lost, patterns in data are identified and made concise.

State the advantage of lossy compression over lossless compression.

  1. Lossy compression is faster to execute, so only lossy is suitable for network transmissions which require a small latency (such as phone call).
  2. Can in some cases result in smaller file size than lossless.

State the disadvantage of lossy compression over lossless compression.

  1. As some information is lost, the accuracy of the digital representation is reduced.
  2. This means ugly artifacts in images and a perceptible loss of quality.

State the advantage of lossless compression over lossy compression.

No information is lost, no reduction in quality of image or sound.

State the disadvantages of lossless compression over lossy compression.

  1. Lossless compression algorithms are often slower.
  2. Lossless compression algorithms may not in all cases produce a great reduction in file size.
  3. There is a limit to how much a file can be compressed.

State two methods of lossless compression.

Run Length Encoding (RLE), Dictionary

Explain how run length encoding works.

  1. A series of contiguous repeated pixels are replaced with one pixel value and a the length of repetitions.
  2. Data is stored as a series of these elementary units.

Explain how one can use a dictionary to perform lossless compression.

  1. A dictionary is used to store large patterns of repeating data.
  2. The file references the dictionary so such patterns are only stored once.
  3. The included dictionary may increase file size.

Describe the best case and worst case for lossless compression.

  1. Best: Many sets of repeating sequential data.
  2. Worst: No repeating sets of sequential data at all.

Encryption

Define encryption.

The transformation of data into another form to prevent unauthorised parties from understanding the message.

Define cipher.

The algorithm used to encrypt data/ transform data into another form.

Define plaintext.

The original data or message to be sent and understood by authorised users.

Define ciphertext.

The encrypted data to be transmitted.

Describe how the Caesar cipher works.

This is a substitution cipher, where each character of the alphabet is shifted to the left or right by a set value.

Describe how the Vernam cipher works.

  1. Align the characters of the plaintext and the key.
  2. Convert each character to binary.
  3. Apply a logical xor operation on each of the two bit-patterns.
  4. Convert the result back into a (ASCII or UTF8) characters

Give another name for the key used in the Vernam cipher.

One-time pad.

Explain what must be required of the one-time pad for perfect computational security to be achieved.

  1. OTP must be at least as long as the plaintext message.
  2. OTP must only be used once.
  3. OTP must be chosen uniformly at random.
  4. OTP must be transmitted using other communication channels.

Explain the concept of computational security

  1. Given enough time all cipher algorithms can be broken by cryptanalytic attack.
  2. Cryptanalytic attack relies on the frequency analysis.
  3. Since computers cannot produce random numbers any key will eventually be found.
  4. A cipher is more secure the longer it takes for cryptanalysis.
  5. Some ciphers may take longer than age of the universe but can theoretically be cracked.

Explain why the Vernam cipher is considered perfectly secure.

  1. Since the key is chosen uniformly at random, the ciphertext data is also uniformly randomly distributed.
  2. This means frequency analysis and cryptanalytic attacks will always fail mathematically.