How sound and images become numbers

Computer Science · Key Stage 3 · The School

Sampling sound

A microphone turns air pressure into a changing voltage — a smooth wave. A computer cannot store smooth, so it MEASURES the height thousands of times a second. SAMPLE RATE is how many measurements per second (CD audio is 44,100). BIT DEPTH is how precisely each is recorded. Higher of either means closer to the original and a larger file.

Images as pixels

An image is a grid of PIXELS, each storing a colour. In 24-bit colour each pixel carries a number for red, green and blue, one byte each. RESOLUTION is how many pixels; COLOUR DEPTH is how many bits per pixel. File size is roughly width × height × colour depth, which is why a phone photo is several megabytes.

The trade-off, and compression

Higher quality always means more data. COMPRESSION reduces size — LOSSLESS throws nothing away and can be reversed exactly (PNG, FLAC); LOSSY discards detail people are least likely to notice and cannot be undone (JPEG, MP3). Saving a JPEG repeatedly degrades it a little each time, because the loss is permanent.

A 3-minute song, sampled 44,100 times a second, 16 bits per sample, in stereo. 44,100 × 16 × 2 = 1,411,200 bits per second. Times 180 seconds = 254,016,000 bits, which is about 32 MB. An MP3 of the same song is about 3 MB, so compression has thrown away roughly nine tenths of the data — mostly sounds masked by louder ones. That trade is what 'quality settings' actually control.

The School — all subjects · Knowledge map