I built a breath-hold trainer that does not trust the stopwatch
DEV Community

I built a breath-hold trainer that does not trust the stopwatch

This is a submission for the Presage SmartSpectra SDK Challenge.

What I Built

DRY STATIC is a dry breath-hold trainer for freedivers that checks each hold with the camera instead of trusting a stopwatch.

Freedivers train on land every day with CO2 and O2 tables: a set of timed holds and rests, done seated or lying down, never in water. Today's table apps are timers. You tap to say the hold started, you tap for your first contraction, you tap when it ends. Nothing checks whether the hold was real, whether you sneaked a breath, or when the involuntary diaphragm contractions began.

DRY STATIC runs the same tables, but it watches the breathing waveform from the SmartSpectra SDK while each hold runs:

  • A hold is verified, not assumed. During a real hold the chest and abdomen traces go flat. Each hold ends as verified, breath detected, or partly readable, with the share of the hold the camera could actually see.
  • Contraction marks (experimental). Diaphragm contractions show up as short jerks in the abdominal trace. The app marks them and scores the marks against your own taps.
  • Pulse only after the hold. The SDK's pulse is a 12-second average, so showing it mid-hold would misstate when it was measured. It appears in the round summary, with the drop across the hold.

There is no dashboard, no streaks and no score. Each round gets a strip chart and at most three plain sentences.

Demo

Video file in the repo: docs/demo.mp4. The video plays the bundled replay (a synthetic recording, labeled as such in the app) at 4x speed, then shows the analyzer output from a real session of three dry holds.

Code

chintandb / dry-static

DRY STATIC - A dry apnea table trainer for freedivers that uses the camera to check each hold.

Freedivers train breath-holds on land with CO2 and O2 tables: a fixed series of timed holds and rests, done seated or lying down. Most table apps are a stopwatch, and nothing checks the hold itself. A small breath, a pause to talk, or a lost camera view all pass unnoticed.

DRY STATIC reads the breathing traces from the Presage SmartSpectra SDK and uses them for three things: it checks that each hold stayed still, it marks diaphragm contractions (experimental), and it shows how your pulse changed after each hold.

It is a desktop app built with Electron and TypeScript. It runs on macOS with Apple Silicon and needs Node.js 20 or newer.

Demo video (2:54): docs/demo.mp4. It plays the bundled synthetic recording at 4x speed, then shows the analyzer output from a real session of three dry holds.

View on GitHub.

Try it with no key and no camera:

git clone https://github.com/chintandb/dry-static.git
cd dry-static
npm install
npm run replay # bundled synthetic recording
npm test # 186 tests, no camera or key

Live mode: cp .env.example .env, add your PRESAGE_API_KEY, then npm start. macOS arm64.

How It Responds to Human Signals

Signals used: chest breathing trace, abdominal breathing trace, breathing rate, pulse rate, and the talking flag. If the key refuses that set, the app falls back to the three breathing metrics alone. It also listens to the SDK's validation codes and hints.

What happens in real time:

  • Framing. The SDK's validation hints ("move back", "chest not visible" and so on) are turned into one short instruction. Continue unlocks only after the SDK reports a good view for 3 s and both breathing traces are arriving.
  • Settle-in, 45 s. The app learns how big your normal breathing is on each trace, picks the cleaner one, and records your resting pulse.
  • During each hold a status chip updates live: HOLD VERIFIED while the trace stays flat. BREATH DETECTED if the trace moves away from its recent baseline by more than 0.4x your normal breathing size for at least 0.4 s. The baseline is a trailing 12 s median, so a quick exhale-and-sip shows up instead of being averaged away. NOT READABLE when samples stop for more than 1.5 s, the SDK's validation code stays bad for more than 1.5 s, or the SDK reports talking. A hold is never smoothed over.
  • After each hold: the verdict, your pulse curve and drop, and your breathing rate as it recovers.

Integration. It is an Electron app. The renderer runs the SmartSpectra Node SDK on the camera stream, and the main process holds the API key and the SDK's IPC bridge, so the key never reaches the page. The renderer is sandboxed. Every packet is timestamped on the SDK clock, and taps are mapped onto that clock through a median offset, so marks and taps line up. Telemetry is off. The same detectors run offline over recorded sessions (npm run analyze), which is how they were tested.

What a real session showed

I recorded three real dry holds (27 s, 13 s, 27 s):

  • Hold verdicts: 3 of 3 verified, 98-99.5% of each hold readable, 30 Hz, no gap over 0.03 s
  • Pulse drop: −7.7 and −17.3 BPM (round 1 had no pulse reading before the hold)
  • Contraction marks vs my taps: 0 of 6 matched. My waist was out of frame, so there was no abdominal trace

The first version flagged all three real holds as breaths. Two things from the real data changed the detector:

  • The chest kept settling for 5 to 8 s after the last inhale, so the first 8 s of a hold are now ignored (it was 3 s).
  • A felt contraction moved the chest trace 0.74x my normal breathing size for 1.6 s, which is enough to look like a breath. A short movement (2.5 s or less) next to a contraction tap is now excused, and the round summary lists it instead of hiding it.

The pass/fail thresholds were written before any data. Contraction marks failed them, so they stay labeled experimental.

Prize Categories

Best Thoughtful Real-World Use.

The need. In apnea training, how long a hold lasted and when contractions started are the main progress markers, and today they are self-reported. A camera that can see a breath makes the training log honest without a chest strap or any extra hardware.

Who it's for. Freedivers and breath-hold trainees doing dry tables at home, seated, with a laptop.

Designed for them:

  • Safety before the camera. Six checks (dry land, seated or lying down, someone nearby, no hyperventilation, stop at the first strong urge) must all be ticked before the camera opens. Holds are capped at 50-60% of your personal best, below the usual top of a classic O2 table, and nothing ever extends a hold. Stop is always one click away.
  • Honest output. Every verdict says how much of the hold was readable. A short movement excused by a contraction tap is still listed. Pulse is never shown during a hold because it lags.
  • Calm interface. One chip, one trace, a big timer. No rankings and no streaks that would push someone to hold longer.
  • Works without a key. Replay mode and the offline analyzer let anyone check the detectors without a camera or a trial.

Consent and Data Handling

Consent. The first screen says what the app does, what the camera is used for, what is stored, and that telemetry is off, before anything opens. The safety screen follows. The camera opens only after both, and only for the length of a session. The app grants camera access (video only, no microphone) to its own bundled page and denies every other permission request.

What is stored. Only numbers: breathing trace values, breathing rate, pulse rate, the talking flag, the SDK's validation codes, and the app's own timings (hold start and end, taps). No video, no images, no face data, and no text are stored.

Where. Everything stays on the Mac, in the app's data folder (~/Library/Application Support/dry-static/data; the About & Data screen shows the exact path): session summaries, recordings of the signal values, and a local count of live minutes used.

Sharing. Nothing is shared. The SmartSpectra SDK processes the camera feed and contacts Presage for authentication and processing; that is the SDK's own traffic. SDK telemetry is switched off (enableTelemetry: false), the app requests no Presage cloud insights, and it uses no AI service and makes no other network requests. There is no account, no analytics and no tracker.

Retention and deletion. Data stays until you delete it. One "Delete all data" button, on History and on About & Data, removes the whole data folder. CSV and PNG exports are written only to a file you choose.

The key. PRESAGE_API_KEY is read from .env or the environment in the main process. It is never logged, never shown, and never written into a recording. .env is git-ignored.

Not a medical device

DRY STATIC is a training aid for dry breath-hold practice. It does not measure oxygen or carbon dioxide, it cannot detect a blackout, and it is not a safety device. Never use it in or near water. People with heart, lung, blood-pressure or seizure conditions, and anyone pregnant, should talk to a doctor before starting breath-hold training. SmartSpectra metrics are for general wellness and informational purposes only and have not been cleared by the FDA.

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.