This is a submission for the Presage SmartSpectra SDK Challenge
What I Built
M² (say "M squared") is a calm voice companion for the minutes after a message shakes you.
You know the moment. A text from your boss, a family group chat, a message you want to answer right now while your chest is still tight. That is the exact moment people send the thing they regret. M² sits beside you in that moment. You type or talk to it, it answers out loud in a calm voice, and with your consent it reads your breathing and pulse from a short video of your face using the Presage SmartSpectra SDK. It compares that reading with your own calm, then helps you decide what to say, or whether to wait a few breaths first.
It only advises. Sending a message is always your choice, and M² never touches your messages. It is a wellness companion, not a medical device. It does not diagnose or treat anyone, and it says so on the first screen.
Why I built it. M² is modelled after my girlfriend. She is the person who keeps me calm. When a message has me wound up, she is the one who slows me down, and that is the whole reason I am building this: I wanted that steady voice available in the moment, for the times when no one is next to you. M² is not her and does not replace her. It is my attempt to turn what she does for me into something anyone could have beside them.
Who made it. I am a student in Abuja. I do not write code myself, so this was built together with Claude (I used the AI Disclosure button for that). I decided what M² should be, what it should never claim, and what to cut when it did not work. Claude wrote the code, and we argued about the rest. The app is MIT licensed and public.
Demo
The demo shows Clip mode: a clip recorded on a phone is read by the Presage SDK inside the app, and M² then speaks the result and talks it through with me. In the recording the app reads about 15 breaths a minute (14.7) and a pulse of 70 bpm, against my own calm baseline. The screen says plainly that it is reading a recorded clip and that nothing from the video is saved or sent.
I want to be straight about how the video was made. It is cut from several takes because my laptop is slow. The scan is sped up 4x (the real read takes about 6 minutes), and the last question and answer is sound from an earlier take over the final screen, because the screen recorder had stopped by then. That is captioned in the video. The reading shown on screen is real and matches the caption.
Code
https://github.com/OlatundeOlabanj/m2-calm-companion
The README has a quick start (Node 22.12+, a free Presage key, optionally a Groq key, npm install && npm test, npm start), a "where Presage is used in the code" list, and an honest status section that says what was tested and what was not. There are 90 unit tests. Technical diagrams (data flow, state machine, sequence diagrams) are in docs/diagrams.
How It Responds to Human Signals
M² uses three things from the SDK: breathing rate, pulse, and the facial expression readings. (It also looks for HRV, but see the limits below.)
The reading. The Presage Node SDK is used through its file input (useFile) inside an Electron app. The app records about a minute from the camera to a temporary file, or you pick a clip you already have. A separate process feeds that file to the SDK and collects the breathing, pulse and expression messages. The SDK sends breathing and pulse as separate messages, so the reader merges them into one summary. Running the reader in its own process is what keeps a slow computer responsive.
Your calm, not an average. The first reading you take while relaxed becomes your calm. It is stored as the median of your breathing and pulse samples, plus a robust spread (median absolute deviation, with a floor so a very steady clip does not make every later reading look huge). Nothing is compared with a population number.
The tension number. A later reading is compared with your calm: how far breathing and pulse sit above it, in units of your own spread. Breathing counts 60 percent and pulse 40 percent, and only increases count, so being calmer than your baseline never raises the score. A small expression nudge can add a bit when the SDK's expression reading is stable. The result is a number from 0 to 100.
What M² does with it. The number decides what M² says, and the wording only states measurements, never an emotion or a diagnosis:
- Low: "You look settled."
- Middle: "A little above your calm," then an offer to breathe together.
- High: "Your body looks tense," then a suggestion to slow down before sending anything.
Every number on screen carries its unit (breaths per minute, bpm). A pulse outside a plausible range is rejected instead of shown, because a sensor value a person knows is wrong is worse than no value.
The send gate. There is a small state machine for the moment of sending: open, locked, review. Tension at or above 55 for 3 seconds holds Send. Tension below 30 for 8 seconds moves it to a review step where you read your message once more. If the signal is poor it pauses and never locks, and there is always a manual override, because the gate is advice, not a prison. This logic is unit-tested, but I have not shown it in the demo video.
Talking to it. You can type to M² or talk to it. It uses Groq for the conversation and a natural voice, only if you tick the box, with a plain offline voice as a fallback. The AI is told the few numbers it is allowed to use and is told not to talk about a body it cannot see.
The honest part about "live". I tried Live camera mode first. My laptop is a 2-core Intel Celeron with 3.6 GB of memory. Live reading froze the whole system, and in my test the camera gave a weak signal at about 6 frames a second. So I built Clip mode: record, then read in a separate process, one step at a time. On that laptop a clip took about 2 to 4 minutes and about 480 MB of memory. Live mode is still in the app for faster computers, with safeguards I added (lower camera resolution on small machines, a memory watchdog, a check that the camera shows a real picture), but I have not tested it on a fast computer and I do not claim it works there. Everything in the demo is real Presage SDK output on real clips, but it is Clip mode: near real time, not continuous. I do not know for certain whether the challenge counts that as a live signal, so I am saying it plainly instead of hoping nobody asks.
Prize Categories
Best Thoughtful Real-World Use.
What inspired it: the person who keeps me calm. Someone who says "breathe, don't send that yet" is the most useful thing I know in those moments, and most people do not have that person within reach at the time. M² is my attempt to put a little of that in a laptop.
The need: the minutes after a message that shakes you are when people send the thing they regret. Most wellness apps talk about stress in general. M² is for one specific moment, and it works at the moment of the decision, not afterwards.
Who it is for: anyone who has typed a reply too fast. I built it for people on ordinary, slow computers, which is why Clip mode exists at all. I use one myself.
How it is designed for them:
- It starts with a plain, kind voice and asks for consent before the camera is touched.
- It learns your calm from you, so a naturally fast breather is not told they are tense.
- It never needs the camera to simply talk.
- When a reading fails, it tells you why (too dark, too much motion, chest not visible) instead of guessing.
- It says clearly what it cannot do.
Consent and Data Handling
- Camera consent: the camera is used only after you tick the consent box on the first screen. A Read me tap starts each recording. No covert or background monitoring.
- Storage: Clip mode records about a minute of video to a temporary file only so Presage can read it. The file is deleted when the reading ends, on cancel, and on app start or quit. A clip you choose yourself is read in place and never copied or deleted.
- Not stored: audio, messages and readings are never written to disk.
- SDK telemetry: switched off.
- Optional AI service: Groq is off unless you tick the box. If you do, it receives short voice clips for transcription, text for the reply, and a few numbers when a reading exists. Never video.
- Keys: in
.env, which is git-ignored. - No diagnosis, treatment or medical decision-making claims anywhere. M² states measurements and suggests breathing.
The build, honestly
We started with Live mode and it did not survive my laptop. These are the things that went wrong, and what we did:
- Early clips failed for ordinary reasons: too much motion, too dark, and one upside down.
- My code needed breathing and pulse in the same message, but the SDK sends them separately. Fixed with the merge step above.
- Inside Electron the SDK could not open video files at all ("input unavailable"), though the same files opened in plain Node. The reader now falls back to the system Node, and retries when the servers drop the connection.
- Some recordings were refused as webm. The reader now makes a clean mp4 copy with ffmpeg and tries once more.
- The first demo videos were bad, and I said so and redid them. After feedback on the first demo I also changed the labels (units on every number), added the on-screen note that it reads a recorded clip, and wrote a rule that rejects an implausible pulse.
Honest limits
- Two reads of the same clip agreed (14.3 and 13.7 breaths a minute, pulse 79 and 76). That shows the reading repeats, not that it is accurate. I have not validated it against a medical device.
- HRV needs about 60 seconds of settled signal, and I have not confirmed an HRV value on a real clip.
- My calm baseline in the demo comes from one earlier clip, so it is a weak baseline.
- Live mode is untested on a fast computer. Recording with the laptop's own camera is the least-tested path; recording with a phone and choosing the clip is the reliable one.
- One person, one laptop. This is a prototype, not a product.
What I would do next
Test Live mode on a fast computer, take several calm and tense clips from several people with their consent, compare the readings with a proper pulse monitor, and see whether the baseline idea holds up beyond me. If it does, I will build the part I care about most: a quiet tap that appears next to the message box, just before you hit send.
Made by TJS Code.
