Representing text, sound and images
Everything a computer stores is binary, including letters, music and photos. This topic is about how each of those is turned into binary, and how the choices made along the way change both quality and file size.
Text: character sets
A character set gives every character a unique binary code, so that computers agree on what each code means. ASCII uses 7 bits per character (8 in extended ASCII), which is enough for English letters, digits and punctuation but not much else.
Unicode uses more bits per character, so it can represent far more characters: the letters of every written language, plus symbols and emoji. The trade-off is that Unicode text takes up more storage than the same text in ASCII.
Sound: sampling
A sound wave is continuous, so it is recorded by measuring its amplitude (height) at regular intervals. Each measurement is a sample, stored as a binary number.
- Sample rate: how many samples are taken each second. A higher rate follows the wave more closely.
- Sample resolution: how many bits are used for each sample. More bits means each amplitude is recorded more precisely.
- Raising either one makes the recording more accurate to the original sound, but makes the file bigger.
Images: pixels
A bitmap image is a grid of pixels, and each pixel’s colour is stored as a binary number. The resolution is the number of pixels, given as width × height. The colour depth is the number of bits per pixel: with n bits, 2ⁿ different colours are possible, so 8 bits gives 256 colours and 24 bits gives over 16 million.
A higher resolution gives more detail, and a greater colour depth gives more colours and smoother shading. Both make the file bigger.
Where marks go
- Saying Unicode is “better” without saying why: it can represent more characters because it uses more bits per character.
- Mixing up sample rate (samples per second) with sample resolution (bits per sample).
- Saying a higher sample rate makes sound “louder”; it makes the recording more accurate.
- Describing resolution as the size of the image on screen instead of the number of pixels.
- Giving the effect on quality but not on file size, when the question asks for both.