How the microphone hears your breath
If audio isn't recorded, how does the app measure your breath? The noise floor, a threshold that moves with the room, and how the start and end of an exhale are found.
6 min read
The app doesn't record audio. The stream from the microphone is never written to disk; every twenty milliseconds the sound level at that instant is worked out, and only that number is kept. So what the app holds isn't an audio file but a series of numbers: a line that rises and falls.
Every measurement is made from that line.
Silence is measured first
There is a three-second listen at the start of a session. In that time the room's noise floor is measured: the hum of the fridge, traffic outside, the device's own electronic noise.
It isn't an average — it looks at the quietest moments of those three seconds. The reason: putting the phone down on a table during calibration, or someone coughing, pulls the average up and leaves the threshold wrong for the whole session. In one real recording this caused a fourteen-decibel error.
The floor is updated during the session too. If the room goes quieter the threshold comes down; if noise rises it goes up — but only within limits, otherwise the app would deafen itself in a noisy room.
The threshold isn't absolute, it is relative to the floor
For a sound to count as an "exhale" it doesn't have to pass a particular decibel level. It has to rise a certain amount above the floor. In a quiet room that threshold is low; in a noisy café it is high.
How far above the floor depends on the technique. A breath out through the mouth (extended exhale, pursed lip) comes out loud. A calm breath out through the nose (coherent, box) is much lower. A breath through a single nostril is the lowest of all. Every technique is listened to with its own threshold; holding them all to the same bar would make the nasal techniques inaudible.
The start and end of an exhale
The raw sound level is too jittery to use directly. It is smoothed first — each new measurement is blended with the one before, so a single click doesn't turn into an exhale.
The exhale begins when the smoothed line crosses the threshold. For it to end, either of two conditions is enough: the line drops below the threshold and stays there for a third of a second, or it falls a certain amount from the exhale's own peak. Without the second condition, an audible inhale would extend the exhale and two breaths would be measured as one.
Very short events are discarded. For that the raw measurement is used rather than the smoothed line: smoothing stretches a short click and makes it look longer than it was.
The quiet room and the tablet problem
Thresholds being relative to the floor works in most cases, but it has a trap: if the floor really is very low, the relative threshold becomes over-sensitive and every creak in the room can count as an exhale. So there is a lower bound on how far the floor can go.
That bound was too high for a while. In one tablet recording the real noise floor measured far lower; because the bound assumed the floor was higher than it was, the exhale's margin melted away and nothing was heard at all. Someone breathing out a hand's width from the tablet was being told to "bring the device closer".
The bound was rescanned against twenty-one real recordings and lowered: the number of exhales caught went up and the number of false detections didn't change. Decisions like this are made from the recordings we have, not from guesswork — that is the only job audio sample sharing does.
Fast breathing is a separate job
This method has a limit: telling that an exhale has ended needs a short silence afterwards. In a technique breathing out faster than once a second, that silence never appears.
So Kapalabhati is measured a different way. Rather than trying to separate the exhales one by one, the app counts the moments when the sound line peaks and looks at how regular the gaps are. The counter waits for the line to fall below the threshold after a peak closes — without that condition it was counting every exhale twice.