A phone, a room, and no light at all

How a phone sees In the Dark

Not with a camera. With a sound you cannot hear, and the echo that comes back out of the black.

Descend

IThe oldest trick in the dark

A bat does not see the room. It hears the shape of it.

Shout, and wait. The sound leaves you, touches something, and comes back. How long it took is how far away that something is — because sound travels at a known, boring, dependable speed.

About 343 metres a second in a warm room. So an echo that takes a fiftieth of a second to return has been on a seven-metre round trip, and whatever bounced it is three and a half metres away. That is the whole idea. Everything after this is engineering, and the engineering is where it gets difficult.

OUT AND BACK ÷ 2
Out, and back. The only quantity ever measured is time.
IIYou are already carrying one

A phone has both halves of a bat.

There is a speaker at the bottom edge and a microphone beside it. A mouth and an ear, a centimetre or two apart. Nothing else is required — no attachment, no driver, no hardware that does not already sit in a billion pockets.

The pitch is chosen so that you never hear it: a sweep from 17,500 to 20,500 cycles per second, sitting just above where adult hearing gives out. It is the acoustic equivalent of ultraviolet — right at the edge of the window, on the far side of it.

Just above adult hearing. Children hear higher than you do; dogs and cats hear higher still. That is not a footnote to bury at the bottom of a page. It is the first constraint the entire design answers to, and chapter VIII is what was built because of it.

Chapter III · The problem with being polite

A bat can shout. A phone cannot.

A hunting bat emits something close to a jet engine at one metre. It simply overwhelms the problem with volume. A phone speaker, held to a level that will not distress every animal in the building, is roughly a thousand times quieter in energy.

What actually comes back

The echo arrives underneath the noise.

This is the honest picture: a faint smear, spread thin across five thousandths of a second, sitting at or below the hiss of the microphone itself. Nothing in that trace looks like an object in a room.

Hum, then squeeze

So don't shout once. Hum, and fold it up.

The sound sent out is a sweep — a tone sliding upward in pitch. Because the pitch differs at every instant, every slice of the returning echo is stamped with the moment it left.

11.8 dB, from arithmetic

All of it piles into one instant.

Line the echo up against a copy of what was sent, and the spread-out energy collapses into a single spike about fifteen times taller than the smear it came from. Loudness the speaker was never able to produce, recovered afterwards by arithmetic.

IVA stopwatch with no starting gun

Nobody will tell it when the sound left.

Timing an echo means knowing exactly when you started. A phone browser will not say. It hands audio to the operating system, which hands it to the hardware, and somewhere in that chain sits a delay it can only estimate. Ten thousandths of a second of uncertainty is 1.7 metres of error — enough to put a wall in the middle of the room.

The way out is almost funny. Some of the outgoing sound leaks straight across the phone's case from speaker to microphone, a few centimetres, arriving long before any real echo. That leak is normally a nuisance: it is deafeningly loud and it smothers anything close by.

So stop treating it as noise, and start the stopwatch on it. Whatever the delay was, it happened to the leak too — and cancels out exactly.

Tested by deliberately injecting delays from zero up to a fifth of a second. The reported distances moved by less than a centimetre. The loudest problem in the system turned out to be its most useful signal.

Chapter V · The trap in the starting gun

There is never just one shout in the recording.

A live microphone records continuously. The slice handed over for analysis holds about four previous outgoing pulses — identical sounds, evenly spaced, each with its own faint echo trailing behind it.

Picking at random with a straight face

The software chose the loudest one.

Which sounds reasonable until you notice they are all the same sound. Whichever happens to be loudest is decided by noise, by how the phone was tilted, by nothing meaningful. It picked a different pulse each time and never reported a doubt.

The distances stayed right

What broke was the direction.

An echo measured from a pulse three ticks old, filed under where the phone is pointing now. And that is the one error a map cannot wash out: more scanning makes a wrong wall more convincing, not less.

The fix, and why it is better than the bug

Count backwards in whole ticks.

The pulses go out on a metronome. So anchor on the strongest arrival, then step backwards in exact metronome intervals until you reach the most recent one. No amplitude is ever compared, which means noise gets no vote at all.

Chapter VI · One ping

An echo is not a point.

The phone hears something 2.4 metres away. It has no idea where. With one microphone there is no direction in the measurement at all — only the fact that the phone happened to be pointed roughly this way.

Sharp one way, blurred the other

So draw it as an arc.

Distance is known to a few centimetres. Direction is blurred by more than a metre at that range — about a hundred times worse. A dot would be a lie about which of the two the sensor actually measured.

Sweep the room

Arcs from different angles cross.

Turn on the spot, fifteen pings a second. Where arcs from different directions overlap, the same surface has been seen twice and the blur collapses. Where they do not, nothing is confirmed. The map sharpens itself.

The other kind of evidence

Silence is not nothing.

“No echo before 2.4 metres” is a confident, specific claim about a specific direction: that space is empty. Every silent ping carves emptiness into the map — and erases the wrong parts of other pings' arcs.

A doorway is proved by silence

The room appears.

Walls where echoes agreed. Open space where they never came. A ping that returns nothing is not a failed ping — it is precisely how a scan proves a doorway is a doorway.

VIITwo colours, two claims

Something is here

An echo came back. Never trusted from one ping alone — a surface has to be confirmed from a second direction before the map will commit to it.

Nothing is here

Silence, in a known direction, out to a known distance. It is the stronger of the two claims, and it is the one most people building these systems throw away.

Almost every sonar display ever built draws only the first colour. A room drawn in one colour cannot distinguish “I looked and it was empty” from “I never looked.”

VIIIThe obvious objection

A film got here first, and made it a nightmare.

There is a well-known film in which a city is mapped by quietly turning every phone in it into a sonar, without anyone's knowledge, and the character who builds the machine treats it as so dangerous that it has to be destroyed at the end.

That reaction is not paranoia. It is the correct read of what this technology becomes if you strip the consent out of it.

Which means anyone building the real version owes an answer — and the answer cannot be a privacy policy, because a privacy policy is a promise about what someone intends to do. It has to be in the machine, where intent stops mattering.

Guard at the transmitter

It cannot be quiet about being loud

A guard sits between the software and the speaker and refuses to transmit anything dropping into the range a child or a dog would hear, anything loud enough to distort, or anything running more than a third of the time. It is the first statement the transmit path executes — before it even checks whether audio is switched on — so there is no order of operations that slips past it.

Coarse by construction

What leaves the room is not what the microphone heard

The full detailed measurement is treated as sensitive and stays on the device. What may cross a network is a coarsened version — enough to describe a room's shape, not enough to reconstruct the recording. That is enforced by what is in the file rather than by a label asking politely, because a coarse measurement cannot be un-coarsened and a check can always be reordered by someone in a hurry.

The refusal that cost a demo

It will not say it found a person

This was the tempting one. The sensing standard it plugs into has a ready-made “someone is present” signal, and filling that field in would have made a far more impressive demonstration. An echo at 2.4 metres is a surface. One speaker and one microphone cannot tell a person from a coat over the back of a chair, and software that claims otherwise is guessing with a straight face.

The consequence of that last refusal is that the system currently produces no conclusions about people at all — zero. That is written into the test suite as a deliberate, asserted result, with both independent reasons pinned, rather than quietly worked around later.

IXWhat a hostile read turned up

Four things that were wrong while every test was green.

All four had passed everything. In each case the test was passing for a reason other than the code being right — which is the failure mode testing is worst at catching, because the green tick looks identical.

01 · The alarm wired to nothing

The safety guard was guarding a simulation

The check that stops the phone emitting something painful was thoroughly tested, and called in exactly one place: a scoring routine that never touches a speaker. The real audio path took whatever it was handed and played it. The guard was real, correct, and connected to nothing.

02 · The echo filed under the wrong direction

Noise was choosing where the phone had been pointing

Chapter V, in full. It passed its tests because the recordings the tests used were single-shot — they structurally could not contain a second pulse, so they could not contain the bug.

03 · Coverage of exactly one machine

The browser test had only ever run where it was written

It hard-coded the file path of the specific computer that authored it. Twenty passing checks, on one laptop, for as long as nobody looked anywhere else.

04 · The room itself

The simulated world was 27 decibels too kind

The largest of the four, and the subject of the next chapter. It is the only one that was not a coding mistake at all.

Chapter X · The measurement, and the ruler

Every number so far came from a room that does not exist.

There is no phone in this story yet. There is a physics model of a room — walls, air, echoes — and every test, benchmark and score is measured against it. Which makes a modelling error not a bug in a simulator, but a measurement error in everything the project publishes.

The gap that was not there

The loud thing was not paying for its short trip.

Every echo in the model paid the price of distance: sound spreads out and gets quieter. The leak across the phone's case — ten centimetres, the shortest trip in the system — was written in as a flat constant, so it never earned the enormous loudness that a very short trip implies.

11.4 dB, where the docs said tens

The model's own documentation disagreed with it.

The comment at the top of the file said the leak arrives “tens of decibels above any echo.” The code delivered 11.4 against a wall at 2.4 metres. The paragraph was right. It had simply never been implemented.

26.9 dB, returned

The hardest part of the sensor was being simulated on easy mode.

Corrected, the gap is 38.3 dB. That difference is exactly the quantity the leak-cancelling machinery exists to fight — so the single hardest problem in the design had been handed a version of itself roughly five hundred times gentler than the real one.

It had already cost a wrong answer

A correct fix had been rejected by a broken ruler.

The first attempt at chapter V's fix ranked pulses by loudness — sound on a real phone, where the leak towers over everything. It failed its test, because in the compressed range a wall at 1.5 metres came back louder than half the leak. A design correct for the real device was rejected by a test measuring an artefact.

XIWhat the correction cost

The sensor got honestly worse, and one thing got better.

Fixing the model did not improve anything. It removed twenty-seven decibels of help the code had been quietly receiving, and every published figure moved to where it actually belonged.

Measured on the same scanBeforeAfter
Working range, hard flat surface4–5 m3.8 m
Detections over 45 pings7063
Voxels the map commits to13,9019,463
Signal processing per ping0.99 ms0.75 ms
How distinctly rooms tell apart0.1380.221

The processing got faster because there are fewer phantom detections to grind through. And rooms became easier to tell apart, not harder: with distant returns correctly suppressed, a room is described by its distinctive near geometry rather than by a haze of things it was never really seeing.

Then the automated design search, which had never once been able to improve the outgoing sound, started improving it — and walked to the exact settings the physics argument had chosen by hand, two years of reasoning away and knowing nothing about it.

Same sweep, 17.5 to 20.5 thousand cycles, five milliseconds, the same shaping at the edges. An automated search starting from a deliberately bad guess and a hand argument from first principles arrived at the same answer independently. That agreement is worth more than either result on its own — and it was invisible for as long as the physics was wrong.

XIIWhere this actually stands

A corrected model is still a model that agrees with itself.

That is the part no amount of care fixes. The physics is better now, and the physics is still the only witness. Chapter V's bug proves what that costs: it lived precisely in the gap between the model and a real microphone, and no quantity of testing against the model could ever have found it, because the model does not contain the thing that goes wrong.

The next real advance here is not an algorithm.
It is a phone, a tape measure, and an afternoon in an actual room.

9.6 cmdistance resolution
0.6–3.8 mhonest working range
1.32 mswork per ping, of 66.7 available
15/spings while sweeping
0real rooms measured

That last figure is the honest one, and it sits deliberately in the same row as the others rather than in a disclaimer underneath them. Every number to its left is a prediction until it is not.