DEV Community

Cover image for Heart on Stream — your heartbeat as a consent-first OBS overlay, from the webcam you already have
Evgeny Vinokur
Evgeny Vinokur

Posted on AI-assisted

Heart on Stream — your heartbeat as a consent-first OBS overlay, from the webcam you already have

Presage SmartSpectra SDK Challenge Submission

This is a submission for the Presage SmartSpectra SDK Challenge

What I Built

Heart on Stream is a desktop app for streamers. It shows your heartbeat and breathing live on stream, read from the webcam you already stream with: no chest strap, no watch, no pairing.

  • A transparent OBS Browser Source at http://127.0.0.1:7777/overlay draws a heart that beats with your pulse waveform and a ribbon that rises and falls with your breathing.
  • A privacy dial decides what viewers get:
    • Vibe (default): the animation only, no numbers;
    • Numbers: rounded BPM and breaths per minute, labelled as a camera estimate;
    • Highlights only: nothing on screen;
    • Off.
  • Automatic highlights. The app learns your own baseline. When your pulse holds at least 15 BPM above it for 3 seconds, the moment is saved as a highlight and marked as a chapter in your OBS recording. After the stream, the receipt exports YouTube chapters.
  • Replay mode. Seven real recorded sessions replay through the exact same pipeline, so anyone can try the full flow without a camera or an API key.

Vibe overlay during replay: a heart with a halo ring, the live pulse trace and the breathing ribbon, with no numbers

Numbers overlay during replay: the heart next to 68 BPM and 17 breaths per minute, labelled camera estimate, not medical

The OBS overlay in Vibe mode (the default) and in Numbers mode, captured in replay mode.

Demo

Every clip in the video comes from a real camera session and is labelled LIVE, with its speed shown where it is sped up. There is no replayed footage. The voice-over is synthetic, and the phone photo used for the second-face test is blurred.

Code

GitHub logo Wertyk / heart-on-stream

Webcam pulse and breathing overlay for OBS, powered by the Presage SmartSpectra SDK. Consent-first, local-only, with automatic stream highlights.

Heart on Stream

Heart on Stream uses the Presage SmartSpectra SDK to turn webcam pulse and breathing estimates into a consent-first OBS overlay and mark rises above your own pulse baseline as recording chapters and local highlights.

Heart on Stream’s Vibe overlay during replay: a heart with a halo ring, the live pulse trace and the breathing ribbon, with no numbers

Built for the DEV Presage SmartSpectra SDK Challenge.

Watch the demo video (2:26). Clips marked LIVE are recordings of real camera sessions, sped-up clips show their speed, and the voice-over is synthetic.

Quick start without a camera or key

Use Node.js 24 or later and Corepack. If Corepack is missing, install it with npm install --global corepack. Run these commands from the repository root. Corepack uses the pnpm version pinned in package.json. Corepack installation and usage

corepack enable pnpm
pnpm install --frozen-lockfile
pnpm replay -- samples/live-b-exertion-strong.jsonl
Enter fullscreen mode Exit fullscreen mode

The first launch downloads Electron if its binary is missing. In the panel, click Continue to setup. Add the OBS Browser Source…

To try it without a camera or a key (Node.js 24+, Corepack):

corepack enable pnpm
pnpm install --frozen-lockfile
pnpm replay -- samples/live-b-exertion-strong.jsonl
Enter fullscreen mode Exit fullscreen mode

Click Continue to setup, add http://127.0.0.1:7777/overlay as an OBS Browser Source (1920×1080), and press Start replay. A highlight lands about 3 minutes 28 seconds in.

For live mode, put your SmartSpectra API key in .env and run pnpm start. The README has the OBS setup for chapters (Hybrid MP4 plus obs-websocket).

How It Responds to Human Signals

Signals used, live from the SDK (@smartspectra/node-sdk 3.5.0):

Signal What happens in real time
Pulse rate Drives the personal baseline and spike detection. Shown rounded in Numbers mode.
Pulse waveform Normalized to 0–1, it makes the overlay heart beat on your actual pulse.
Breathing rate Shown in Numbers mode when stable.
Chest breathing waveform Animates the breathing ribbon.
Talking Raises the spike threshold to +20 BPM, because talking can nudge the camera-based estimate.
Validation status and hints Gate every reading. The SDK's framing and lighting hints appear in the panel, for example when your chest is out of frame. A second face pauses everything at once.

From signal to highlight:

  1. Calibrating takes 12 s.
  2. Building your baseline takes 25 s of eligible readings. An eligible reading is stable, has confidence of at least 50, falls within 40–110 BPM, and arrives while validation is OK.
  3. Live. Your baseline is the median of the last 120 s, excluding rises that could themselves trigger a spike.
  4. Spike. The 5-second median stays at least 15 BPM above your baseline for 3 s (20 BPM if you were talking). The overlay turns red, a highlight is saved, and if OBS is recording, CreateRecordChapter marks the recording. A 45 s cooldown follows.

These thresholds were tuned on seven real recorded sessions. With the default policy there is exactly one spike in each of the two exertion recordings, and none in calm sitting, talking or framing sessions.

The streamer panel during replay: pulse and breathing, the personal baseline, a two-minute pulse chart with the baseline and spike threshold, the privacy dial and the SDK's conditions

SDK integration:

  • The Electron renderer owns the camera. The app opens the camera you picked with getUserMedia (video only) and hands it to the renderer SmartSpectraSDK with useMediaStream. It passes requestedMetrics explicitly and sets enableTelemetry: false.
  • Main binds the SDK's IPC bridge with bindSmartSpectraIpc. It loads lazily, only on the first consented live Start, so replay never touches the native runtime.
  • A metrics mapper decodes metrics packets with decodeMetrics into timestamped signal frames and forwards them to main. The session logic lives in a framework-free core (Clean Architecture). An architecture test keeps Electron, the SDK, OBS and Node out of the domain and application layers.
  • Replay feeds the same session logic from JSONL files with the original SDK timestamps, so the same file always gives the same highlight times.

The app has 1,100+ automated tests. I built it with Claude Code as the orchestrator, OpenAI Codex as the implementer, and a separate Codex model as an independent auditor. That auditor ran 15+ audit rounds, and every finding was fixed rather than deferred.

Prize Categories

I'm entering both prize categories.

Most Creative or Delightful Use. Heart rate on stream has always needed a wearable. Heart on Stream turns the webcam that is already pointed at the streamer into a living heart on the overlay. Your own heartbeat becomes the editor: the moments your pulse jumps mark themselves as chapters in your recording. Viewers see the rhythm, not a number, unless you choose otherwise.

Best Thoughtful Real-World Use. Streamers produce hours of video and lose the best minutes in it. Heart on Stream gives them automatic, personal highlights, with no extra hardware, inside the tools they already use (OBS and YouTube chapters). It was designed around consent and usability:

  • the camera stays off until you agree;
  • one person on camera, enforced by the SDK's face check;
  • a four-step privacy dial with hotkeys you can hit mid-game;
  • a receipt at the end that says exactly what happened and what was sent;
  • one-button deletion with confirmation;
  • a replay mode so you can try everything before turning a camera on.

Consent and Data Handling

  • Camera consent. The camera stays off until you check I am the only person on camera, click I agree, and then start a session. Electron main grants video permission and starts measurement only after that consent, and only for the app's own page. The consent screen states everything below before you agree.
  • One person only. If the SDK sees a second face, measurement pauses immediately. Readings from that interval are neither shown nor recorded. There is no guest mode.
  • What stays on your computer. Pulse and breathing are computed on-device by the SDK. Heart on Stream never saves or sends video or images.
    • The overlay is served only on 127.0.0.1 with Host and Origin checks.
    • OBS is reached only over loopback.
  • What is sent to Presage:
    • API key check. The SDK authenticates your API key with Presage for live measurement. This traffic is tied to your Presage developer account, so it is not anonymous.
    • SDK telemetry. Disabled (enableTelemetry: false).
    • Automatic LLM Insights. SmartSpectra SDK 3.5.0 sends automatic check-ins during live measurement: when readings first stabilize, then every 60 seconds. Each check-in contains an allowlisted set of the vitals the SDK has computed (pulse rate, breathing rate and heart-rate variability, where available) with session and request identifiers, but no video or images. Presage forwards them to a language model. The SDK offers no setting to turn this off, so the app discloses it before you agree. Heart on Stream never requests, reads, shows or stores insights. Replay mode does not use the SDK and sends nothing to Presage. (Presage LLM Insights · SDK telemetry and privacy)
  • What OBS and viewers get. Only what your privacy mode allows:
    • Vibe sends beat and breath waveform points with timing, intensity and status, with no BPM or breathing-rate number. A sharp viewer could still estimate a rate from the rhythm, and the app says so.
    • Numbers adds rounded values.
    • Highlights only sends nothing but the mode.
    • Confidence, baseline and change from baseline never reach the overlay.
  • Storage and retention. Data stays on your computer until you delete it.
    • Highlights: highlights.json in the app's data folder, holding timestamps, labels and change from baseline.
    • Camera choice: remembered by the app.
    • Optional numeric session recordings: saved only if you tick Record session.
  • Deletion. Delete all data (on Setup and on the receipt, with a confirmation) stops the session and removes the highlights file, the app-created recordings and the remembered camera. Exported chapter files and chapters already written into your OBS videos stay where you put them.
  • Pause. Cmd/Ctrl+Shift+P releases the camera and hides live readings on the overlay at once.
  • Intended use. Heart on Stream is for wellness and entertainment. It is not a medical device and makes no medical claims. All readings are camera-based estimates.

Agent Session

I built Heart on Stream with Claude Code as the orchestrator: it split the work into Backlog tasks, briefed the agents, reviewed every diff and reran the checks. OpenAI Codex implemented the tasks, and a second Codex model audited the work read-only on clean clones. Here are two Codex sessions, with local paths scrubbed.

Implementation: the canvas OBS overlay redesign. It includes the orchestrator's review feedback after capturing the real overlay in Electron, and the fix that followed.

Heart on Stream: Codex implements the canvas OBS overlay redesign openai
You

You are the implementer. Implement Backlog task task-70. Read it with the backlog MCP tool task_view; it holds the full visual spec, with colours, sizes and states, for the new OBS overlay indicator. The design canvas it references is private, so the spec in the task is your source of truth.

Work only in src/presentation/overlay/ and in tests under test/ (for example test/presentation/overlay/). Keep the existing rendering split:
- view.ts: what to show;
- scene.ts and wave-buffer.ts: data and timing;
- render.ts: drawing.

Put pure helpers where they can be tested, such as ring spawning from beat peaks, trace sampling and layout metrics. Keep the per-frame work cheap.

Hard rules:
- Never change the overlay payload, the domain privacy projection, the overlay server, or the overlay page CSP. Use system fonts only, with no network and no new files outside the overlay folder.
- Off and Highlights only must keep clearing the canvas completely.
- Draw no "highlight" text.
- Rings and trace must come from the real beat signal, never from synthetic timers.

Follow AGENTS.md. Never run pnpm install or pnpm add. Do not edit Backlog files. You are in a git worktree. Another implementer works in parallel on task-71 (the panel, src/presentation/panel/), so stay strictly inside your scope.

Testing:
- First add tests using a recording fake CanvasRenderingContext2D (or extend the existing overlay test helpers). Cover: rings spawn on beat peaks (max 3) and none without a beat signal; the spike flare fires once on the transition; calibrating draws the arc and no numbers; paused draws a dim heart with no trace, ribbon or rings; numbers mode draws the BPM, breathing and caption labels; vibe draws the trace; hidden modes clear.
- Every existing test must keep passing; do not weaken tests. Keep pnpm tune -- samples/*.jsonl unchanged. The architecture test must stay green.

In your sandbox the overlay-server socket tests fail with listen EPERM; this is expected. Verify with pnpm check, pnpm build and pnpm tune. End with the final report format from AGENTS.md.

Agent

I’ll read task-70 and the repository specs, then add recording-canvas tests before changing the overlay.

Agent
Agent
Agent
Agent
Agent
Agent

The task specifies a single card layout for both themes. I’ll drive the trace and rings from the existing delayed waveform cursor so they stay in sync with the heart.

Agent
Agent
Agent
Agent
Agent
Agent
Agent

The new recording-canvas tests and the architecture test pass. I’ll add coverage for waveform gaps and spike flare timing, then run the full checks, build, and sample tuning.

Agent
Agent
Agent
Agent
Agent
Agent
Agent
You

Review feedback for task-70 (orchestrator). I ran the built app in Electron, capturing the real overlay page at 1920×1080 during replays. The card, colours, statuses, REPLAY pill, numbers block and calibrating arc look right. Two real defects remain.

  1. The pulse trace is a dense comb, not a clean waveform. At --speed=1 on samples/live-b-calm.jsonl in Live, the Vibe trace shows tightly packed vertical zigzags filling the band: many near-vertical strokes between high and low values within a few pixels. A pulse trace should be one smooth line with one peak per beat.

    • Diagnose this with the real data. Feed samples/live-b-calm.jsonl through the real replay source, session and privacy projection, or reconstruct the OverlayState beatWave batches another way. Then inspect what reaches receiveWave.
    • Likely causes:
      • overlapping batches, possibly late re-sent windows, that the buffer merges by atMs, so values from separately normalized batches interleave;
      • synthetic gap-fill points (fill-beat-gaps, 50 ms grid) interleaving with real points;
      • points that are not monotonic within a batch.
    • Fix it in src/presentation/overlay only, without changing the payload or the domain. For example, when a new batch overlaps the time range already buffered, replace the overlapped range with the new batch instead of merging point by point. Use whatever matches the real cause. If it still looks jagged, add light smoothing to the drawn trace only, such as a short moving average or resampling to a fixed step.
    • Add a regression test built from real batch shapes taken from the sample. Keep beat peaks, rings and the heart scale correct.
  2. At replay speeds above 1, the trace, ribbon and rings disappear. At --speed=2 and above, the Vibe card shows only the heart and the status, and Numbers shows no ribbon. playWave lets the cursor catch up with the target by at most 15% per frame. When session time runs 2–20× faster than wall time, the cursor falls further and further behind, past the 12 s history, and the trace window becomes empty.

    • Make playback keep up. For example, when the lag behind the target exceeds a threshold (more than 2 × delayMs), snap or fast-forward the cursor. Or let the correction scale with the incoming data rate.
    • Then trace, ribbon and rings stay visible at --speed up to 20. Normal 1× live behaviour must not change: same delay, and no jumps under ordinary jitter.
    • Add tests that simulate batches arriving at 2× and 8× session-to-wall rates and assert a non-empty trace span after some seconds.
    • If this removes the "overlay animation can stutter at replay speeds above --speed=1" limitation, update that README Known limitations line to say what remains. This README line is the only file outside src/presentation/overlay you may touch.
  3. Small polish:

    • Calibrating currently leaves the info column empty below the label. Add one short muted line under CALIBRATING, for example "Learning your baseline", with no numbers and no progress value.
    • Keep the heart glow and rings as they are.

Same scope and rules as before. Verify with pnpm check, pnpm build and pnpm tune; the overlay-server EPERM failures are expected in your sandbox. End with the AGENTS.md report format.

Agent

I’ll inspect the beat batches produced by the calm replay, then use what reaches the overlay to build regression tests for the comb and fast playback.

Agent
Agent
Agent
Agent
Agent

The calm replay produced 868 ordered Live beat batches. In 177 of them, late waveform samples overlapped earlier gap-fill points. Replacing the covered range eliminated the steep, closely spaced jumps in the diagnostic, so I’ll apply that to the beat buffer and keep the breathing buffer’s existing merge behavior.

Agent
Agent
Agent
Agent
Agent
Agent
Agent
Agent
Agent

The updated calm replay produced a trace and ribbon on every Live frame at 1×, 2×, 8×, and 20× in the offline diagnostic. The steep close-pair jumps dropped from 131 to zero. At 20×, the cursor sometimes skips ahead, which the README now describes.

Agent
Agent
Agent

Final audit: the independent auditor signs off the release after measuring the overlay frame by frame at several replay speeds.

Heart on Stream: an independent Codex auditor signs off the release openai
You

You are the auditor (Codex gpt-6.2-astra) for Heart on Stream. You run read-only: never modify files, and never read or print any .env file or anything containing an API key.

This is the confirmation re-audit after your round 7 "ready to publish". You are in a fresh clone of the public submission repository, Wertyk/heart-on-stream (currently private). The new commit is 2773657, on top of 04e5e34.

Your round 7 had one minor finding. At 0.25× replay, the learned replay rate was discarded after Resume, which caused a 0.63 s hold. A switch from Highlights only back to Vibe caused a 0.23 s hold (wave-buffer.ts:298).

The owner's earlier decision stands: the commit email is intentional. Do not raise it.

Report:
1. Whether the finding is fixed, with your own evidence. Re-run your round 7 scenario at 0.25× and 0.5×: a 30 s pause at 112 s, then Resume, and a Highlights only → Vibe switch. Report the holds beyond the 125 ms margin and the time to first trace.
2. A regression review of 2773657 (git diff 04e5e34 2773657):
- The live, non-replay cursor path must stay identical.
- A new replay run after End and Start must not inherit the previous rate.
- The rate must not leak into a live session.
- Recorded capture pauses inside a file must still be excluded from the estimate.
- Nothing may grow without bound.
3. Whether the diff is confined to overlay playback and its tests.
4. Whether pnpm tune -- samples/*.jsonl still gives exactly one spike at 207.878 s in live-b-exertion-strong, one at 745.814 s in live-b-exertion-recovery, and zero elsewhere.

You may run pnpm check and pnpm tune. Sandbox socket or temp-file failures are environment limits, not findings.

Output a one-line verdict first: either "ready to publish" or "hold". Then give the status table and the findings ordered by severity, each with file:line, the evidence and a suggested fix. Severity is blocker, major, minor or nit; only blockers and majors hold publication. Report only verified, realistic issues, and do not pad the list.

Agent

I’ll check the commit scope, replay both speeds, and verify the spike counts. I’ll keep the audit read-only and avoid credential-bearing files.

Agent
Agent
Agent
Agent
Agent
Agent
Agent
Agent

The first trace appeared on the same frame in both commits for all four cases. On 2773657, it then advanced on every frame I measured. I’ll check the rate across End and Start, a subsequent live session, and the capture pauses recorded in the recovery sample.

Agent
Agent
Agent
Agent
Agent

Built for the DEV Presage SmartSpectra SDK Challenge. Thanks to Presage for the SDK and to the OBS community for obs-websocket.

Top comments (0)