Computer ScienceExam code: 0984

Data Storage and Compression

Data Representation

These formulas were introduced in topic 2; they appear constantly in storage and compression questions too.

Sound file size

(bits) = sample rate (Hz) × sample resolution (bits) × duration (seconds)

A continuous sound waveform S(t) sampled at regular intervals T, with each blue dot a sample value Sᵢ
Source: Sampling a sound wave by Save My Exams

Worked example

Calculating a sound file size in kibibytes

A 24 second audio clip is recorded with a sample rate of 32 000 Hz and a sample resolution of 16 bits. Calculate the file size of the clip in kibibytes (KiB), showing your working.

Solution:

  • File size in bits = sample rate × sample resolution × duration = 32 000 × 16 × 24 = 12 288 000 bits
  • Convert to bytes: 12 288 000 ÷ 8 = 1 536 000 bytes
  • Convert to KiB: 1 536 000 ÷ 1024 = 1500 KiB

In the one paper that set this calculation it was worth 3 marks: two for the working (multiplying the three values, dividing by 8 for bytes, dividing by 1024 for kibibytes) and one for the final answer in the unit asked for. Write every step down and finish in that unit.

Image file size

(bits) = image width (pixels) × image height (pixels) × colour depth (bits per pixel)

Build on this topic