Y·B← All projects
Cardiology · audio signal processing

Your phone is a stethoscope

Press your phone's microphone against your chest. The page filters out everything except the low thumps of your heart valves closing, finds the two heart sounds doctors listen for (S1, "lub", and S2, "dub"), and measures your heart rate from them.

A demo, not a medical device. Phone microphones aren't made for this, and some phones filter out low sounds. It can't detect murmurs or diagnose anything.

1 · Use your phoneOpen this page on your phone. The microphone is the little hole on the bottom edge.
2 · Press it to your chestBottom edge flat against bare skin, just left of the breastbone, about a hand's width below the collarbone.
3 · Stay quiet and stillHold your breath for a few seconds or breathe very slowly. Talking and moving drown out the heart.
heart sounds · last 4 s · 25–200 Hz
Press Start listening with the phone on your chest,
or play the demo heartbeat.
energy envelope · S1 / S2
♥—bpm
Not listening.
Signal lock—
Beat length—
S1 → S2—
Beats seen—
Use headphones. Through the phone's speaker the sound loops back into the mic and squeals.
01FilterHeart sounds live between about 25 and 200 Hz. Band-pass filters remove voices and rustling, and notch filters remove 50/60 Hz electrical hum.
02EnvelopeShannon energy turns each thump into a smooth bump while ignoring background hiss. It's computed every 10 ms.
03Heart rateAutocorrelation finds how often the bump pattern repeats. That repeat time is one heartbeat.
04S1 vs S2The gap from S1 to S2 (the heart squeezing) is shorter than S2 back to S1 (refilling). That rule labels each sound.

Tested on simulated heart sounds from 50 to 140 bpm with added noise and mains hum: heart rate within about 1 bpm. Real phones vary a lot. iPhones and some Android phones apply their own processing to the microphone, which can weaken the heart sounds.