This is a submission for the Presage SmartSpectra SDK Challenge
What I Built
As a developer, I know we've all been there. The long days, blocked PRs, getting stuck and needing a pause. This is where Ctrl+Rest comes in, when we need to just take a step back and breathe.
Ctrl+Rest is a desktop breathing break with Mochi, a very sleepy sloth. You pick a scene (rain on a cozy window, a sunset beach, or a sunlit forest), and Mochi breathes slowly next to you. If you choose to turn on your camera, a second circle follows your real breathing rate, measured on your own computer with the Presage SmartSpectra SDK, and the whole scene breathes with you:
- 🌧️ Rain falls on the window and softens as your breathing slows
- 🌊 Waves slide up the sand when you breathe in and back when you breathe out
- 🌲 Forest sunlight glows with each breath while leaves drift down
- 🔊 Calm sounds made in code follow your breath too
- 🙂 Smile at Mochi and he waves back
- 😴 Near the end Mochi nods off, falls asleep, and shows how your breathing changed, like "from about 16 to about 9 breaths a minute"
It's a relaxation break, not a medical tool. No scores, no targets, no diagnosis. Just a few minutes to Ctrl+Rest.
Demo
The video shows a live break on the rain scene: my real breathing rate on screen, the rain softening as I slow down, Mochi waving back when I smile, and Mochi falling asleep at the end.
Code
tmott13 / ctrl-rest
Pause with Mochi 🦥 A breathing break that follows your real breath from your webcam. Scenes, sounds and a sleepy sloth that breathe with you. Angular 22 + Electron + Presage SmartSpectra, on-device and accessible.
Ctrl+Rest 🦥
Pause with Mochi. A short breathing break for developers. Mochi the sloth breathes slowly on screen. If you choose to turn on the camera, a second circle follows your real breathing rate, measured on your own computer with the Presage SmartSpectra SDK, and the whole scene breathes with you.
Built with Angular 22 (zoneless, signals) inside Electron for the DEV Presage SmartSpectra SDK Challenge.
Ctrl+Rest is a relaxation break, not a medical device. It doesn't diagnose, treat or monitor anything.
Demo video: Watch Ctrl+Rest in action on YouTube
What it does
- Breathe with Mochi: pick a break length (2, 3 or 5 minutes) and Mochi's pace (5 to 10 breaths a minute). There's no target. Follow along only if it feels good.
- With the camera (after consent): your live breathing rate shows next to Mochi's, your camera view sits inside…
Setup instructions are in the README. You'll need Node 20+, a free Presage API key, and an Apple Silicon Mac, Windows or Linux. No key or camera? Click Preview with simulated breathing on the start screen to try the whole flow.
Built with: Angular 22 (zoneless, signals, the new control flow) inside Electron 45, the SmartSpectra Node.js SDK, the Web Audio API and the Web Speech API.
How It Responds to Human Signals
Ctrl+Rest uses three live Presage signals:
| Signal | What it drives |
|---|---|
| Breathing rate | Your circle's pace, the number on screen, how hard it rains, the waves, the forest light, the sounds, and the end summary |
| Facial expressions | When "happy" is your top expression for a moment, Mochi waves back with floating hearts |
| Validation status | Plain-language framing hints like "Move a little closer" or "A little more light would help," shown and optionally spoken |
Integrating the SDK in an Electron + Angular app
The SDK has a renderer entry for Electron. The renderer captures the camera and sends frames to the main process, which runs the SDK and sends results back. Wiring it up took three small pieces:
// electron/main.cjs const { bindSmartSpectraIpc } = require('@smartspectra/node-sdk/main'); bindSmartSpectraIpc(win); // electron/preload.cjs require('@smartspectra/node-sdk/preload'); // src/app/breath.service.ts const sdk = new SmartSpectraSDK({ apiKey, requestedMetrics: [...breathingMetrics, MetricType.EXPRESSIONS], enableTelemetry: false, }); sdk.on('metrics', (buf) => { const metrics = decodeMetrics(buf); const latest = metrics.breathing?.rate?.at(-1); if (latest?.value) this.record(latest.value, !!latest.stable); this.checkSmile(metrics.face?.expression?.at(-1)?.scores); }); The readings feed Angular signals, and everything else (the scene, the sound, Mochi) reacts to them.
Making it feel alive, not jumpy
- Patience built in. The breathing rate is a 30-second average, so the app says "Settling in" until the SDK marks a reading as stable, instead of showing a shaky number.
- Easing. The scenes and sounds ease toward each new reading, so nothing jumps when the number changes.
- Moving the photo itself. For the beach, I stopped drawing cartoon waves and moved the real photo instead. The water near the shore stretches up the sand on the inhale and slides back on the exhale, and the rocks stay in front.
- Rain only on the glass. I made a mask of the window glass so the rain never lands on the pillows.
- Sound made in code. Rain, waves and birdsong are generated with the Web Audio API, so the rain gets lighter as you slow down, and the waves swell when you breathe in.
What surprised me is how well it counted my breaths from just the webcam.
Prize Categories
I'm entering both.
Most Creative or Delightful Use
Mochi is a character I created in a previous project, called Bookmark Buddy. I loved the character so much that I decided to make him the star. I personally love rain, the forest, and beach so I chose those themes to start with.
Mochi is the delightful part. He waves hello, blinks, breathes from his belly, waves back when you smile, and slowly nods off as the break ends. The scenes don't just play in the background. They breathe with you, so you can see yourself calming down: the rain softens, the waves slow, the lights dim.
Best Thoughtful Real-World Use
The need: developers (and anyone at a desk) spend long, tense stretches in front of a screen, and "take a break" is easy to skip. This matters to me because a lot of times coding is stressful.
Who it's for: people who want a short, gentle reset, including people who are blind or low vision, Deaf or hard of hearing, sensitive to motion, or living with a breathing condition.
Designed to be usable for them:
- Keyboard only, and Esc ends a break anytime
- Screen reader announcements for framing hints and the breathing rate (throttled so they aren't chatty), with focus moving to each new screen
- Spoken cues ("breathe in… breathe out") and spoken framing hints, so you can close your eyes or use it without the screen
- Reduce motion stops every animation, and follows your system setting
- Captions for what's moving in the scene and what sound is playing
- Text contrast checked on every scene, and nothing flashes
- Mochi's pace is a suggestion, never a target ("Follow along only if it feels good"), which matters for people with asthma or other breathing conditions
- A full no-camera mode
Consent and Data Handling
- Camera consent: the camera never turns on until you choose "Breathe with the camera" and confirm on a consent screen that explains what it reads. It's on only during that break, a "Camera on" label is always visible, and Esc ends it immediately. The app grants camera access only to its own bundled page. There's no covert or background monitoring.
- On-device processing: SmartSpectra measures breathing and facial expressions on your computer. Video frames and images are never saved or sent anywhere.
- Storage and retention: no readings are stored. They live in memory for the current break and are gone when it ends. There's no account, database or history. The app only remembers your settings (scene, volume, voice) in local storage.
- Sharing: none.
- What goes online: only the SDK's check that your Presage API key is valid. The key lives in a git-ignored
.envfile. - SDK telemetry: turned off with
enableTelemetry: false. - AI services: none at runtime. Sounds are generated in code, and spoken cues use your computer's built-in voices.
- Deletion: there are no readings to delete. Removing the key from
.envturns camera mode off. - Not medical: Ctrl+Rest makes no diagnosis or treatment claims and makes no medical decisions. It's a relaxation break.
A note on how it was made
Mochi and the theme backgrounds were generated by ChatGPT and I used Claude as my AI pair programmer.
I invite you to give Ctrl+Rest a try and allow Mochi to give you that break that you needed. You deserve it and your body will thank you. 🦥🖤








