<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sarthak Patil</title>
    <description>The latest articles on DEV Community by Sarthak Patil (@sarthak_p07).</description>
    <link>https://dev.to/sarthak_p07</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4160745%2F05ac523a-92ec-448c-b064-915ba0c99690.jpg</url>
      <title>DEV Community: Sarthak Patil</title>
      <link>https://dev.to/sarthak_p07</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sarthak_p07"/>
    <language>en</language>
    <item>
      <title>Systole - your heartbeat is the drum machine</title>
      <dc:creator>Sarthak Patil</dc:creator>
      <pubDate>Sun, 22 Nov 2026 11:31:51 +0000</pubDate>
      <link>https://dev.to/sarthak_p07/systole-your-heartbeat-is-the-drum-machine-4i74</link>
      <guid>https://dev.to/sarthak_p07/systole-your-heartbeat-is-the-drum-machine-4i74</guid>
      <description>&lt;p&gt;&lt;strong&gt;This is a submission for the &lt;a href="https://dev.to/challenges/presage-2026-11-04"&gt;Presage SmartSpectra SDK Challenge&lt;/a&gt;&lt;/strong&gt;&lt;br&gt;
What I Built&lt;br&gt;
Systole is a musical instrument that knows exactly one thing about you: what your body is doing right now.&lt;/p&gt;

&lt;p&gt;You sit in front of a webcam, press Start, and it plays. Your heartbeat is the drummer - every systolic upstroke SmartSpectra finds in the arterial pressure waveform fires a kick drum and a ring of light, and the interval between your actual beats is the tempo of the piece. Your breathing opens the orchestra: as your chest rises a low-pass filter opens and the pad swells, and as you exhale it closes again. HRV picks the mode - open major pentatonic when you're calmer than your own session baseline, minor pentatonic when you're more charged. Pulse rate picks the key, and a smile adds a bell.&lt;/p&gt;

&lt;p&gt;No wearable. No controller. No microphone. No "tap here to play". The interface is your autonomic nervous system.&lt;/p&gt;

&lt;p&gt;The Systole instrument running: a glowing orb pulsing with the beat, a tempo readout of 73 bpm captioned "the kit is on your pulse", live pulse and breathing readouts, and the arterial pressure waveform along the bottom&lt;/p&gt;

&lt;p&gt;That shot comes from a headless CI run on a machine with no camera, so the app badges&lt;br&gt;
it SIMULATED - the demo video above is the real thing, with a real pulse in front of a&lt;br&gt;
real lens.&lt;/p&gt;

&lt;p&gt;The moment I was aiming for: you sit still, slightly bored, and then the kick lands on your own heartbeat. Not near it, not at a tempo somebody typed in - on the beat the SDK just heard in your face. People stop talking when that happens. Then they laugh, their pulse moves, and the music moves with it.&lt;/p&gt;

&lt;p&gt;A single unbroken take, with the camera preview, the live pulse number and the music all on screen at once, so you can hear the tempo tracking the reading. Two moments worth watching for:&lt;/p&gt;

&lt;p&gt;0:20-0:45 - the kick locks onto the detected beats. The caption under the big tempo readout switches from "tempo from pulse rate while the waveform settles" to "N beats heard in the pressure wave - the kit is on your pulse". That's the waveform driving it, not a reported average.&lt;br&gt;
1:10 - I cover the lens for three seconds. Signal quality collapses, the pad closes down and the bells stop, because the app refuses to keep playing to a body it can no longer see. Uncovering brings it back.&lt;br&gt;
There's also a landing page at SITE_URL describing the app, the signal mapping and the privacy design. Systole needs Electron and the native SmartSpectra runtime, so the page describes the instrument rather than running it - clone the repo to play.&lt;/p&gt;

&lt;p&gt;Code&lt;br&gt;
github.com/SarthakPatil18/Systole - MIT licensed, public, with setup instructions in the README.&lt;/p&gt;

&lt;p&gt;Bash&lt;/p&gt;

&lt;p&gt;git clone &lt;a href="https://github.com/SarthakPatil18/Systole.git" rel="noopener noreferrer"&gt;https://github.com/SarthakPatil18/Systole.git&lt;/a&gt; systole&lt;br&gt;
cd systole&lt;br&gt;
npm install&lt;br&gt;
npm start            # paste your Presage API key into the consent sheet&lt;br&gt;
npm test             # 18 logic tests + a headless run of the real renderer&lt;br&gt;
Stack: Electron plus the renderer-side @smartspectra/node-sdk binding, esbuild for the renderer bundle, and hand-written Web Audio and Canvas 2D - no audio library, no charting library, no UI framework.&lt;/p&gt;

&lt;p&gt;Three layers of tests, all runnable without a camera:&lt;/p&gt;

&lt;p&gt;npm test - 18 logic tests (musical mapping, breath normalisation, beat detection including the dicrotic-notch regression below) plus a headless run that fakes the DOM, canvas and Web Audio and executes the actual bundled renderer.&lt;br&gt;
npm run check:sdk - loads the real SDK native runtime, proves the metric list is accepted, and drives start() to the authentication boundary.&lt;br&gt;
SYSTOLE_SCREENSHOT / SYSTOLE_SMOKE_JS - scriptable headless UI runs on a virtual display. Every screenshot in this post came out of one of those.&lt;br&gt;
How It Responds to Human Signals&lt;br&gt;
Systole requests [...breathingMetrics, ...cardioMetrics, MetricType.EXPRESSIONS] and uses four of the SDK's signals in genuinely different ways:&lt;/p&gt;

&lt;p&gt;Signal  What it does in the instrument&lt;br&gt;
Arterial pressure trace Beat detection -&amp;gt; kick drum + light ring. Beat-to-beat interval is the tempo.&lt;br&gt;
Chest + abdomen traces  Normalised into a breath phase -&amp;gt; pad filter cutoff and gain. You hear yourself breathe.&lt;br&gt;
HRV (Baevsky index) Compared to a slow baseline of your own session -&amp;gt; chooses the pentatonic mode.&lt;br&gt;
Pulse rate  Sets the root of the piece and covers the tempo while the waveform is still settling.&lt;br&gt;
Expressions A smile raises the probability of a bell ornament. Optional - the app rebuilds without it if your plan doesn't include face metrics.&lt;br&gt;
Validation status + confidence  Fades the pad, suppresses new notes, shows the SDK's hint in plain language.&lt;br&gt;
The integration is deliberately the boring, recommended one for Electron:&lt;/p&gt;

&lt;p&gt;main.js&lt;br&gt;
 calls bindSmartSpectraIpc(win) and points webPreferences.preload at @smartspectra/node-sdk/preload. One SDK instance per window, torn down on close.&lt;br&gt;
The renderer constructs SmartSpectraSDK from @smartspectra/node-sdk/renderer, so the SDK owns capture and hands back a MediaStream via streamAvailable for the preview. The microphone is never requested.&lt;br&gt;
Metrics arrive as protobuf on the metrics event and are decoded with the SDK's own decodeMetrics from @smartspectra/node-sdk/messages.&lt;br&gt;
If the plan rejects expression metrics (kConfigurationFailed / kMetricNotAuthorized), the app rebuilds without them and says so instead of dying.&lt;br&gt;
Then the interesting part.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Beats, not averages. The SDK gives a waveform, not beat events, so &lt;br&gt;
signal-engine.js&lt;br&gt;
finds the systolic upstroke itself: a sample has to clear the recent mean plus 35% of the swing and 72% of the recent peak-to-peak range, then fall back near the mean before it can re-arm. That amplitude gate is what stops the dicrotic notch counting as a second heartbeat - the bug that doubles your tempo. There's a regression test pinning it. The resulting intervals go through a 7-sample median, so one bad frame can't rewrite the groove, and the median interval is the tempo.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Breath as a continuous control. Chest and abdomen traces are normalised against an 8-second rolling min/max into a breathPhase (0 = exhaled, 1 = inhaled), smoothed, and mapped to filter cutoff and pad gain. You can hear yourself breathe within two seconds, long before the 30-second breathing-rate window completes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;HRV relative to you. Baevsky's stress index only means something against a personal baseline, so the app builds one from your own session (a slow 2% EMA) and compares against it. Crossing +25% of baseline shifts the mode darker; sitting 15% under it opens the bright one. Nobody's absolute number decides anything.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Quality is audible. A quality value from the SDK's confidence scores and validationStatus control pad brightness and volume and suppress new notes. Bad light, motion, or no face means a thinner, quieter piece, with the SDK's validation hint shown as plain language ("Too dark - face a window or a lamp"). The instrument degrades honestly instead of inventing a reading.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Everything is scheduled with Web Audio lookahead (25 ms tick, 120 ms ahead) so the music never stutters when a frame is slow, and the audio graph is built once and retuned rather than reallocated on chord changes.&lt;/p&gt;

&lt;p&gt;Prize Categories&lt;br&gt;
Entering both - the honest fit is somewhere in between.&lt;/p&gt;

&lt;p&gt;Most Creative or Delightful Use. The thing that made me build it: a pulse is something you cannot perceive without a device touching you, and music is the one medium where "here is what your body is doing" needs no explanation. Your heart becomes a drummer - not a visualisation of a drummer, an actual one, playing in time with you. The delight is realising the room is being kept in time by your own body, and the fact that the same ninety seconds makes people lean in, go quiet, then start tapping.&lt;/p&gt;

&lt;p&gt;Best Thoughtful Real-World Use. What I removed on purpose points at who this is for. There is no wearable and no hands - nothing to strap on, hold, tap or charge - so the instrument is playable by people who can't grip a controller, who can't wear something on their wrist, or find both sensory-hostile, and by anyone who simply won't wear a heart-rate sensor. It also shows the signal without interpreting it: no scores, no stress level, no "you seem anxious", no diagnosis. For someone prone to over-monitoring their own body, "listen to this and breathe" is a kinder interface than a number that judges them. And because the mapping only ever nudges between gentle pentatonic modes, nothing the app detects can produce an alarming sound - the worst case of a wild reading is slightly odd music, which is the right failure mode for a wellness toy.&lt;/p&gt;

&lt;p&gt;Consent and Data Handling&lt;br&gt;
Full detail in PRIVACY.md; the summary:&lt;/p&gt;

&lt;p&gt;Consent gate. Nothing touches the camera until the person has read a plain-language sheet, ticked an explicit consent checkbox ("my camera will be used to measure my pulse and breathing while Systole is running") and pressed Begin. The tick is per-session and is not stored - the next launch asks again.&lt;/p&gt;

&lt;p&gt;The consent sheet: what the camera is used for, that nothing is recorded, the API key field, an opt-in diagnostics checkbox and the required consent checkbox&lt;/p&gt;

&lt;p&gt;In &lt;br&gt;
main.js&lt;br&gt;
 the camera is granted only for a video-only permission request, only from the app's own bundled file:// page; audio requests and any non-local origin are denied. Navigation and popups are blocked so the window can't be steered somewhere else. macOS's own prompt and camera indicator stay in force, and Stop releases the camera immediately.&lt;/p&gt;

&lt;p&gt;Processing. Frames go from the renderer to the SmartSpectra SDK in the app's main process; measurement is on-device. Systole itself records nothing: no video, no audio, no vitals history, no session log, no analytics, no account, no identifiers. The API key is held in memory for the session and never written to disk; it is sent only to Presage's authenticated API.&lt;/p&gt;

&lt;p&gt;Network. The only traffic Systole causes is the SDK's API-key authentication and subscription check - no video and no measured values in that request. There is no cloud service, no LLM call, and no optional AI feature in this app.&lt;/p&gt;

&lt;p&gt;SDK telemetry - reversed default, disclosed. Presage's SDK telemetry is on by default; Systole sets enableTelemetry from an unchecked box on the consent sheet, so it is off unless the person opts in. If enabled, the SDK sends aggregate measurement-session summaries (SDK build, platform/device/arch, session shape, throughput and startup timings, counts of quality warnings, coarse error codes, a timestamp) and full device-readiness diagnostic reports - no raw frames and no measured physiological values. Those requests are authenticated, so they can be correlated with an account and shouldn't be called anonymous. Readiness reports live in Presage's private diagnostic storage with no automatic expiry; deletion follows Presage's policies. Turning it off means the SDK starts no telemetry session at all.&lt;/p&gt;

&lt;p&gt;Retention and deletion. There is nothing to retain: quit the app and the session is gone, no server-side copy of measurements exists, and no files are written. For Presage-side diagnostic records, contact &lt;a href="mailto:support@presagetech.com"&gt;support@presagetech.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Not a medical device. Pulse, breathing, HRV and expression signals are used here for wellness and entertainment. Systole makes no diagnosis or treatment claims, takes no medical decisions, has no alerting or emergency behaviour, and is not for covert or non-consensual monitoring - it measures only the person who consented, in front of their own camera, with a visible indicator, and it never runs hidden or in the background. The consent sheet and the side rail both say so, inside the app, not just here.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/SarthakPatil18/Systole" rel="noopener noreferrer"&gt;https://github.com/SarthakPatil18/Systole&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4kvqz5i7vmflc6zm1z93.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4kvqz5i7vmflc6zm1z93.png" alt=" " width="800" height="496"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>presagechallenge</category>
      <category>electron</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
