Daylila
How computers actually work

Lesson 3 of 13

From numbers to everything: text, pictures, sound

Explain how the same bits become letters, pixels, and sound once everyone agrees on a code — a number per letter, three numbers per dot of colour, thousands of numbers a second for sound.

01 · Learn · the idea

Here is the number 72. Is it a temperature? A house number? The letter H? A medium-grey pixel? A quiet musical note? It is all of them and none of them. A number, by itself, means nothing. It means something only once two parties agree what it stands for. That agreement — not the bits — is where text, pictures, and sound actually come from.

We’ve spent two lessons turning the world into numbers. Now the reverse: how one stream of plain numbers becomes a letter you read, a face you see, a song you hear. The secret is almost disappointingly simple. There’s a codebook, and everyone uses the same one.

Meaning comes from an agreed code

A computer stores 01001000 — that’s 72 in a byte. To turn it back into something useful, the machine needs to know what kind of thing it is. Text? Then look 72 up in the text codebook. A colour? Then read it as a shade. A moment of sound? Then read it as a pressure level. The bits don’t carry their own meaning. The program reading them supplies it, by knowing which codebook applies.

This is why the same file opened the wrong way turns to garbage — a photo opened as text shows nonsense symbols. The bits are fine. The codebook is wrong. Get the agreement right and numbers become anything.

Text: a number for every character

The oldest codebook is the simplest. Someone sat down and assigned a number to each character: capital A is 65, B is 66, on up to Z at 90. Lower-case a is 97. The space is 32. A full stop is 46. This scheme is called ASCII, and a richer modern version, Unicode, extends the same idea to every alphabet and emoji on Earth.

So the word Hi is two numbers: H is 72, i is 105. Store the bytes 01001000 01101001 and any program that knows “this is text” reads back Hi. Type a key and you’re choosing a number from the codebook; the screen draws the matching shape. There is no letter inside the machine — only its agreed number, and a font that knows how to paint it.

Pictures: three numbers for every dot

A screen is a grid of tiny dots called pixels — a phone has millions. Each pixel glows with a mix of three coloured lights: red, green, and blue. Give each light a brightness from 0 (off) to 255 (full) — one byte each — and you can mix nearly any colour.

  • Red 255, green 0, blue 0 → pure red.
  • 255, 255, 255 → all lights full → white.
  • 0, 0, 0 → all off → black.
  • 72, 72, 72 → equal and middling → a medium grey.

So one pixel is three numbers. A photo is just a long list of these triples, one per dot, plus a note saying how wide the grid is. A picture two thousand pixels across and a thousand tall is two million pixels — six million numbers. Nothing in there is a “picture.” It’s a spreadsheet of brightness levels that, drawn out on the grid, your eye reads as a face.

Sound: thousands of numbers a second

Sound is a wave — air pressure rising and falling. To store it, the machine measures the wave’s height many times a second and writes down each measurement as a number. Music on a CD is measured 44,100 times every second. Each measurement is a sample: a number saying how high the wave was at that instant.

Play it back by pushing the speaker cone out and in to match those numbers, 44,100 times a second, and the air moves the way it did when the sound was recorded. A three-minute song is about eight million numbers. Again: no “sound” sits in the file — only a dense column of measurements and an agreement about how fast to replay them.

Worked example: the byte 72, wearing three hats

Take our byte, 72, and read it under each codebook:

  • As text: look up 72 → the letter H.
  • As a grey pixel: brightness 72 out of 255 → a fairly dark grey, a bit more than a quarter lit.
  • As a sound sample: 72 on a scale up to 255 → the speaker cone sits a little below the midpoint for that instant.

Same eight bits. Three completely different things, decided entirely by which codebook the reading program reaches for. You’ll switch a single number between these three readings in the lab and watch it change costume.

One stream of numbers, all the way down

Step back and the whole machine simplifies. Under every document, image, and song is the same thing: numbers, made of bits, made of switches. The dazzling variety on your screen isn’t variety down at the bottom — it’s one kind of stuff, read through different agreements. A jpeg, an mp3, and a text file are cousins, not strangers.

That’s a quietly humbling thing to hold. The photo of someone you love and a spreadsheet of numbers are, to the machine, the same spreadsheet of numbers — the tenderness is entirely in you, supplied when you look. The computer never sees the picture. It shuffles bytes and trusts the codebook. Everything that feels like meaning lives on our side of the glass. Next we leave storage behind and ask the harder question: how does a thing made of switches actually do anything with these numbers — add them, compare them, decide? That’s where switches start to think.

02 · Try · the lab

03 · Check · quick quiz

1. The same byte can be a letter, a shade of grey, or a moment of sound. What decides which one it is?

  • The size of the number — small numbers are letters, big ones are colours
  • The codebook the reading program uses — text, colour, or sound
  • Nothing; the computer guesses based on the time of day
  • The brand of the computer
Answer

The codebook the reading program uses — text, colour, or sound — The bits carry no meaning of their own. A program turns a number into something by knowing which codebook applies. Open a photo as text and you get nonsense — same bits, wrong codebook.

2. In the text codebook, capital A is 65 and B is 66. Without looking it up, what is most likely the number for capital C?

  • 67
  • 33
  • 99
  • 650
Answer

67 — The codebook assigns consecutive numbers to consecutive letters, so C follows B at 67. The codebook is just an agreed list — once you know the pattern, you can read it.

3. A single pixel on your screen is stored as three numbers. What do those three numbers represent?

  • Its width, height, and depth
  • The brightness of its red, green, and blue light
  • Its price, weight, and age
  • Three backup copies of the same colour
Answer

The brightness of its red, green, and blue light — Each pixel mixes red, green, and blue light, each from 0 to 255. 255,0,0 is pure red; 255,255,255 is white. A whole photo is just a long list of these triples.

4. CD-quality sound stores 44,100 numbers for every second of audio. What is each of those numbers?

  • A word of the song's lyrics
  • A measurement of how high the sound wave was at that instant
  • The volume setting you chose
  • A frame of video that goes with the sound
Answer

A measurement of how high the sound wave was at that instant — Sound is a wave of air pressure. The machine measures its height thousands of times a second and stores each measurement as a number, then moves the speaker to match. No 'sound' is in the file — only the measurements.