Microphone-based breath detection sounds simple until you actually try it. Energy goes up, energy goes down — that's a breath, right? In practice, you run into continuous breathing with no silence gaps, noisy environments that drift over time, and (on iOS) a Web Audio API that silently returns all zeros. This post walks through how @shiihaa/breath-detection solves each of these problems. The library was extracted from shii·haa , a breathwork and biofeedback app built by Felix Zeller, a Swiss physician (Intensive Care + Internal Medicine + Diplompsychologe). It's MIT-licensed, zero dependencies, and ships TypeScript types. Installation npm install @shiihaa/breath-detection The Core Idea: Spectral Centroid for Inhale/Exhale Classification Most breath detectors only measure when breathing occurs — they can't tell you whether a given phase is an inhale or an exhale. This one can, and the reason is grounded in physiology. When you inhale through your nose, air moves through narrow nasal passages and turbinates.…