Breathing monitor

Breathing is the physiological signal that music reaches first and that musicians control most directly: a singer plans every breath, and a listener breathes more slowly to a calm piece and faster to a driving one. In the lab, breathing is recorded with a belt around the chest that stretches with every breath. This app does a rougher version of the same thing with a device you already have. A phone lying on the chest or belly tilts a little with every breath, and its motion sensor records the tilt; a webcam watching the chest and shoulders sees them rise and fall. Either way the result is a waveform that goes up and down once per breath, from which the app counts breaths and finds the breathing rate. Choose a source, press Start, and sit or lie still.

Privacy: the motion-sensor and camera data are analysed locally in your browser and drawn to the screen; nothing is uploaded, stored, or sent anywhere. The only thing that ever leaves this page is the CSV file you choose to download, and it goes to your own device.

Source
No data yet
Lie down and lay the phone flat on your chest or belly with the screen up, or sit and hold it flat against the chest. Every breath tilts the phone a little, and the share of gravity that falls on each of its three axes changes with the tilt. The app filters all three axes (and their combined magnitude), keeps the one that swings most, removes the steady part, and smooths away anything faster than about one swing per second, which leaves the breathing. Choose the axis yourself if the automatic choice jumps about. The phone must not slide, and the page must be opened over https for the browser to offer the sensor.
0:00

Breathing waveform

Breathing rate: no data yet

The trace is the filtered signal over the last 60 s, scaled to fit the box, with the detected breaths marked as dots. A breath is counted when the trace rises and then falls by more than half of its recent swing, and two breaths closer than 1.5 s are taken as one. The breathing rate is 60 divided by the median of the last five breath intervals, so one odd breath does not move it much. Resting adults breathe roughly 12–20 times a minute; singing, speaking, and simply paying attention all change it. The coefficient of variation is the standard deviation of the intervals divided by their mean, so it says how regular the breathing is regardless of how fast it is.
Spectrum of the last 30 s

Spectrum: waiting for 10 s of data

The spectrum is the Fourier transform of the last 30 s of the filtered trace, computed by the app itself. Regular breathing shows up as one peak, and its position on the axis is the breathing rate found a second way: from what repeats, rather than from counting events. The shaded band is the typical resting range. The two estimates agree when the breathing is regular and drift apart when it is not, which is itself worth noticing. With only 30 s of signal the peak is a few breaths per minute wide, as the window explorer app shows for sound.
Breath intervals
No breaths detected yet.
Each row is one detected breath with the time since the previous one. The CSV has one row per sample: the time in seconds, the raw signal (acceleration in m/s² on the chosen axis, or the row position in the camera box), the filtered signal, and a 1 in the last column at each detected breath, so the analysis can be redone in a spreadsheet or in Python.
Pacing tone (optional)
The tone rises in pitch while you breathe in and falls while you breathe out, at the pace set here. Breathe along with it for a minute and compare the rate and the coefficient of variation with those of your free breathing before it; the pace is also marked in the spectrum. The Breath and pulse app has a fuller guide with a breathing circle.

Things to try: sit quietly for two minutes and note the rate and the coefficient of variation. Then read a paragraph aloud and watch both change: speech makes the breaths short and uneven, because the in-breaths come where the sentences allow. Hum one long note for as long as you can and see a single slow breath appear in the trace. Listen to a slow piece and then a fast one, three minutes each, and compare. Finally, measure the same person with both sources at the same time (the phone on the chest, the laptop camera on the shoulders) and compare the two rates and the two traces: they measure the same breathing in two different ways and should agree, but they will not agree perfectly.

Limits: the app measures the motion of the chest or belly, not the air that moves in and out, so a shallow breath and a deep one can look alike, and a shift of posture can look like a breath. The person must sit or lie still; walking, gesturing, and laughing all swamp the signal. The phone must not slide, and clothing that moves on its own confuses the camera. Breaths shorter than 1.5 s are not counted, and the first few seconds after Start are unreliable while the filters settle. This is a classroom device, not a medical one: it is fine for comparing conditions within one person and poor at comparing people.