Skip to content

1.5 — Sound, Screens and Signals

Everything on this page works by turning something continuous — a pressure wave in air, a picture, a hand near a piece of glass — into numbers, and then back again. The interesting part is always what gets thrown away in the middle, because nothing has enough room to keep all of it.

Sound

What is actually inside an MP3 file?

Not the sound. A description of the sound, with everything your ears cannot hear deleted on purpose.

Start from what came before. A CD stores audio by measuring the air pressure 44,100 times a second and writing each measurement as a 16-bit number, for two channels. That is about 1.4 million bits per second, or roughly 10 megabytes per minute — honest, complete, and far too large for a 1990s hard disk or a dial-up connection.

MP3 attacks it in four stages.

First it splits the sound into frequency bands. A short slice of audio, about 26 milliseconds, is transformed from a list of pressure measurements into a list of how much energy is present at each frequency. This is the same mathematics as a prism splitting light, and it is the Fourier idea covered in Volume II.

Then it decides what you would not notice. This is the part that makes MP3 what it is, and it comes from experiments on human hearing rather than from engineering. Two effects dominate. A loud sound hides a quiet sound at a nearby frequency completely — play a strong tone at 1,000 Hz and a much quieter tone at 1,100 Hz becomes literally inaudible, not merely hard to hear. That is frequency masking. And a loud sound hides quiet sounds for a few milliseconds after it, and even a millisecond or two before it, because of how the ear and brain process onsets. That is temporal masking. The encoder builds a model of what is masked in this particular slice of this particular song.

Then it spends its bits unevenly. Frequencies that are fully masked are stored with almost no precision, or dropped. Frequencies that are exposed get many bits. The errors introduced by this coarse rounding are deliberately pushed under the masking threshold, where they are inaudible rather than merely quiet.

Finally it compresses what is left losslessly, with Huffman coding, which gives shorter codes to more common values — the same trick as Morse code giving E a single dot.

The result at 128 kilobits per second is about a tenth the size of the CD data. The discarded information is gone permanently — this is lossy compression, and re-encoding an MP3 repeatedly degrades it each time, because each pass models masking on top of the previous pass's damage.

The format came out of the Fraunhofer Institute in Germany, with Karlheinz Brandenburg as the central figure, standardised in 1992-93 as the audio layer of MPEG-1. Brandenburg used Suzanne Vega's Tom's Diner as his test track for years, because a solo voice with no accompaniment exposes every artefact the algorithm produces.

What does a DAC do, and why does a USB-C adapter need one?

A DAC is a digital-to-analogue converter, and it is the thing that turns numbers back into a voltage that can move a speaker cone.

Sound in air is continuous. A stored file is a list of numbers, tens of thousands per second. The DAC reads each number and produces a matching voltage, then smooths the staircase of voltages into a continuous wave with a filter. An amplifier then gives that wave enough current to actually push a driver.

A 3.5 mm headphone socket is an analogue connection: the DAC and amplifier live inside the phone, and the wire carries a finished waveform. USB-C is a digital connection: it carries numbers. So a USB-C-to-3.5 mm adapter is not a passive adapter at all. There is a complete DAC and a small headphone amplifier inside that plug, drawing power from the port, which is why the good ones cost real money and the cheap ones sound thin — a weak amplifier cannot drive high-impedance headphones to a decent level, and a poor analogue stage adds hiss.

The same explains a common annoyance: adapters made for one phone sometimes produce nothing on another. Some manufacturers put the DAC in the phone and use the port in an analogue passthrough mode instead, so their passive adapter is just wire — and wire cannot help a phone that only ever sends digits.

How do noise-cancelling headphones cancel noise?

By producing the opposite sound and adding it in.

A microphone on the outside of each earcup listens to the noise arriving. A processor inverts that waveform — where the incoming pressure wave goes up, the inverted one goes down by the same amount — and plays the inversion through the same driver that plays your music. Two sound waves that are exact opposites sum to silence, because pressure is a number and adding a number to its negative gives zero. This is destructive interference, and it is the same physics that makes the dark bands in a soap bubble.

It works far better on low frequencies than high ones, for a reason that is pure geometry. To cancel a wave you must produce your inversion at the right place at the right instant. A 100 Hz wave is 3.4 metres long, so being a couple of centimetres out of position barely matters. A 5,000 Hz wave is 7 centimetres long, so a centimetre of error turns cancellation into reinforcement. That is why these headphones kill the drone of an aircraft or an air conditioner and barely touch a nearby conversation — and why the high-frequency reduction you do get comes mostly from the physical seal of the earcup rather than from the electronics.

Why do the volume buttons sometimes control the phone and sometimes the headphones?

Because there are two volume controls in the chain and Bluetooth has two ways of joining them.

The phone applies a digital gain to the audio before sending it, and the headphones apply their own analogue gain before the driver. In the older arrangement these are independent: your buttons move the phone's, the buttons on the earcup move the headphones', and the two multiply — which is how you end up with distorted, quiet audio when the phone is at maximum and the headset is at a quarter.

Bluetooth's Absolute Volume feature was added to fix this. When both devices support it, the phone stops applying its own gain and simply tells the headphones what level to use, so there is one control with one scale and both sets of buttons move the same slider. It fails in the familiar ways: an older headset that does not implement it, or a device that reports support and implements it badly, giving you the whole usable range in the bottom two steps. Every phone platform has a hidden setting to disable absolute volume for exactly that reason.

Paying and identifying

How does tapping a card on a terminal pay for something?

There is no battery in the card. The terminal powers the card.

The terminal continuously emits a magnetic field oscillating at 13.56 MHz through a coil in its face. The card contains a coil of its own — the loops you can see if you hold a card up to a strong light — connected to a tiny chip. Bring the card within a few centimetres and the terminal's field induces a current in the card's coil, exactly as in a transformer, and that current wakes the chip. This is why the range is centimetres rather than metres: the field falls off very steeply, and it must carry enough energy to run a processor, not merely to be detected.

Then a conversation happens, and this is the part worth understanding. The card does not send your card number and a password. The terminal sends a challenge, including the amount, the date and a random number it just generated. The chip signs that specific challenge using a secret key that has never left the chip and cannot be read out of it, and returns a cryptogram — a short code valid for this one transaction and useless for any other.

That single design decision is why cloning a contactless card is hard where cloning a magnetic stripe was trivial. The stripe was a fixed number that replayed forever; the chip answers a different question every time. The physical layer is NFC, itself a short-range subset of the older RFID family, and the payment logic on top is the EMV standard, named after Europay, Mastercard and Visa.

How does wireless charging move power through a gap?

The same way, with much more energy and a bigger problem.

A coil in the charging pad carries alternating current, which produces a changing magnetic field. A coil in the phone sits in that field and has a current induced in it. This is a transformer whose two halves have been separated, and separating the halves is the whole difficulty: in a real transformer both coils share an iron core that channels essentially all the field from one to the other, and here the field spreads into the room instead.

Two things claw efficiency back. The coils are wound flat and wide so that they overlap as much as possible, and magnets or guide rings pull the phone into alignment. And the system is driven at a resonant frequency where the coil and a matched capacitor swap energy back and forth naturally, which lets a modest drive produce a much larger circulating current. Even so, wireless charging loses somewhere between a quarter and a half of the energy, mostly as heat in both devices — which is why a wirelessly charging phone runs warm, and why heat, not the electronics, is what limits the speed.

The Qi standard adds a control channel: the phone modulates its own load in a pattern the pad can detect, so it can ask for more or less power and say stop. Without that the pad could not tell a phone from a coin, and a coin left on a pad would simply heat until it glowed.

How does a QR code survive being crumpled, dirty or partly covered?

A QR code with its regions labelled: three large finder squares at the corners, alignment pattern, timing lines, format information and the data area
The anatomy of a QR code. The three corner squares find and orient it, the dotted lines set the grid spacing, and the data occupies everything left over — of which a large fraction is redundancy rather than message. Image: Wikimedia Commons.

By building in redundancy and by being designed to be found from any angle.

The three large squares at the corners are finder patterns. Their ratio of black to white along any line through them is 1:1:3:1:1, a sequence that essentially never occurs by accident in a photograph, so a scanner can locate the code in a cluttered image cheaply. Three corners rather than four is deliberate: three points define which way up it is, and the missing fourth corner tells you the rotation. The dotted timing patterns between them let the scanner work out the grid spacing even if the paper is curved.

The survival comes from Reed-Solomon error correction. The data is not stored plainly; it is stored with extra symbols computed from it, arranged so that any sufficiently small set of corrupted or missing symbols can be reconstructed exactly. QR codes are made at four levels, recovering roughly 7, 15, 25 or 30 per cent of the code. That is why a logo can be printed over the middle of a QR code and it still scans — the designer chose the highest correction level and then spent the redundancy on the logo.

The format was invented in 1994 by Masahiro Hara at Denso Wave, a Toyota subsidiary, to track car parts, because the one-dimensional barcodes then in use held too little and had to be nearly square to the scanner. Denso Wave holds the patent and chose never to enforce it, which is the reason it is everywhere.

Screens

What is the difference between LCD and OLED?

Where the light comes from.

An LCD has a single backlight shining through the whole panel all the time. Each pixel is a shutter: liquid crystal molecules twist under an applied voltage and rotate the polarisation of light passing through, so that a fixed polarising filter behind them blocks more or less of it. Colour comes from red, green and blue filters. A shutter can never be perfectly closed, so black on an LCD is dark grey with the backlight leaking through — which you see most clearly as a pale glow in a dark room.

An OLED has no backlight. Each subpixel is itself a small organic light-emitting diode that produces its own light. Off means zero photons, so black is genuinely black and the contrast ratio is effectively infinite. It also means the panel can be thin and flexible, and that a mostly-dark image uses less power, which is why dark mode saves battery on an OLED phone and saves nothing on an LCD one.

The costs are real. Blue OLED emitters age faster than red and green, so a static bright element — a navigation bar, a channel logo — can leave a permanent ghost, which is burn-in. And peak full-screen brightness has historically been lower.

What does a 120 Hz refresh rate actually change?

How often the screen is allowed to show you something new — 120 times a second instead of 60.

Two things improve, and they are different. Motion looks smoother, because a moving object is drawn at twice as many positions along its path, so your eye tracks a finer sequence of steps rather than a coarser one. And the screen responds sooner: at 60 Hz, an image finished just after a refresh waits up to 16.7 milliseconds to be shown, and at 120 Hz that worst case halves to 8.3. The second effect is what people describe as feeling "instant" when scrolling, and it is a latency improvement rather than a smoothness one.

The catch is that the source has to keep up. A film shot at 24 frames per second gains nothing at all — though it does divide evenly into 120, which removes the uneven stutter you get when 24 is forced into 60.

How does a touchscreen know your finger is there?

Your body is a moderately good electrical conductor with a large surface area, and the screen is looking for that.

Under the glass is a grid of fine transparent conductors, usually indium tin oxide, laid as rows and columns. At every crossing there is a tiny capacitance — an ability to store charge in the electric field between the two conductors. The controller drives each row in turn and measures each column. A finger approaching the glass gives some of that field somewhere else to go, through you and to ground, which changes the measured capacitance at that crossing by a small but reliable amount. Scanning the whole grid many times a second gives a map, and a peak in the map is a fingertip. Several peaks are several fingertips, which is where multi-touch comes from for free.

Everything odd about touchscreens follows. A glove does not work because it separates you from the field. A wet screen misbehaves because water is conductive and looks like a large soft finger. And a stylus must be either conductive with a broad soft tip, or an active device with its own electronics that talks to the screen.

Signals through the air

Why does an FM station sound better than AM but disappear behind a hill?

Because they encode the sound differently and, more importantly, sit in different parts of the spectrum.

In AM, amplitude modulation, the strength of the carrier wave is varied to follow the audio. Almost every source of electrical noise in the world — lightning, motors, power lines, a passing scooter — also varies amplitude, so noise lands directly on the signal.

In FM, frequency modulation, the carrier's strength is constant and its frequency is nudged up and down to follow the audio. A receiver can then simply ignore amplitude entirely, which throws away most natural interference before it is ever demodulated. FM also allocates far more bandwidth per station, so it can carry the full audio range and stereo.

The coverage difference is not about AM versus FM at all, but about wavelength. AM broadcasts on medium wave, hundreds of metres long, and such waves diffract around hills and buildings and can bounce off the ionosphere at night — which is why a distant AM station appears after dark. FM sits near 100 MHz, a wavelength of about three metres, which behaves much more like light: broadly line-of-sight, blocked by terrain, and stopping at the horizon.

Why does a phone call sound worse than a voice note recorded on the same phone?

Because the call is bandwidth-limited by a decision made for the telephone network in the 1930s and only partly undone since.

Traditional telephony carries roughly 300 Hz to 3,400 Hz, sampled at 8,000 times a second. That range was chosen because it is the minimum that keeps speech intelligible, and cramming as many conversations as possible into a cable was the entire economics of a telephone company. It is why "S" and "F" are confusable on a call and why people spell things with S for sugar.

A voice note is recorded and encoded by the phone itself with none of those constraints, typically covering the full audible range with a modern codec. Mobile networks have been catching up — VoLTE and the wideband codecs carry up to about 7 kHz, and the newest go further — which is why some calls now sound startlingly present. When they do, both ends are on the newer codec; a single leg of old equipment drops the whole call back to the 1930s.

What comes next

The next page is about the names on all these objects — why the company is called Adobe, why the software is called Acrobat, why the little icon file must be called favicon.ico, and why the www quietly disappeared from the front of web addresses without anybody announcing it.