<?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: a474443481</title>
    <description>The latest articles on DEV Community by a474443481 (@474443481).</description>
    <link>https://dev.to/474443481</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%2F4223992%2Fe69d5d17-c575-4278-b583-6e1df8101610.png</url>
      <title>DEV Community: a474443481</title>
      <link>https://dev.to/474443481</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/474443481"/>
    <language>en</language>
    <item>
      <title>Slow-Breath Coach: your webcam scores how well you breathe along</title>
      <dc:creator>a474443481</dc:creator>
      <pubDate>Sat, 07 Nov 2026 13:44:13 +0000</pubDate>
      <link>https://dev.to/474443481/slow-breath-coach-your-webcam-scores-how-well-you-breathe-along-3a7f</link>
      <guid>https://dev.to/474443481/slow-breath-coach-your-webcam-scores-how-well-you-breathe-along-3a7f</guid>
      <description>&lt;p&gt;&lt;strong&gt;Challenge entry for the Presage SmartSpectra SDK Challenge.&lt;/strong&gt; Code: &lt;a href="https://github.com/474443481/slow-breath-coach" rel="noopener noreferrer"&gt;https://github.com/474443481/slow-breath-coach&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 The idea
&lt;/h2&gt;

&lt;p&gt;Most breathing apps count seconds and &lt;em&gt;assume&lt;/em&gt; you followed along. Slow-Breath Coach does not assume anything: it watches your chest through a plain webcam with the &lt;strong&gt;Presage SmartSpectra SDK&lt;/strong&gt;, measures your actual breathing waveform, and scores how well you tracked the pacer after each session.&lt;/p&gt;

&lt;p&gt;The target is 5.5 breaths per minute — the resonance pace where six seconds in and six seconds out line up with heart-rate rhythms. The pacer circle expands as you inhale, contracts as you exhale, and the score tells you how close your real chest motion came to that rhythm.&lt;/p&gt;

&lt;h2&gt;
  
  
  🎬 Demo
&lt;/h2&gt;

&lt;p&gt;▶ &lt;strong&gt;Watch the 30-second demo:&lt;/strong&gt; &lt;a href="https://raw.githubusercontent.com/474443481/slow-breath-coach/main/demo.webm" rel="noopener noreferrer"&gt;demo.webm — 10 MB, webm, direct play&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(Also committed at &lt;a href="https://github.com/474443481/slow-breath-coach" rel="noopener noreferrer"&gt;github.com/474443481/slow-breath-coach&lt;/a&gt; — pacer circle, live waveform and the follow score, recorded straight from the app's own &lt;code&gt;/demo&lt;/code&gt; canvas.)&lt;/p&gt;

&lt;p&gt;30 seconds, canvas-rendered, self-recorded by the page itself (&lt;code&gt;/demo?record=1&lt;/code&gt;). The demo replays a synthetic breathing signal through the exact same scoring function used on live camera captures, so the UI is honest even without a face in frame.&lt;/p&gt;

&lt;h2&gt;
  
  
  🧠 How it works
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Three metric channels&lt;/strong&gt; from the SDK (&lt;code&gt;requestedMetrics: [0, 2, 15]&lt;/code&gt;): the chest breathing trace, breathing rate, and pulse. Frames go from the browser (JPEG, 15 fps) to a local Node server, which decodes them and feeds the SDK through a forked worker process over IPC.&lt;/p&gt;

&lt;p&gt;Two SDK quirks ate most of my debugging time — worth documenting for the next person:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Timestamps must be epoch microseconds, and they must be gap-free.&lt;/strong&gt; I first passed process uptime. The SDK silently treated the frames as days old, stalled the pipeline, and the session died at exactly 151 frames — every single time. Then real-world browser capture jitter (a dropped frame here, a 40 ms stall there) trips the SDK's gap detector: &lt;code&gt;SmartSpectra detected a gap between camera frame timestamps.&lt;/code&gt; The fix: a virtual 15 fps clock, +16 667 µs per frame, re-anchored to &lt;code&gt;Date.now() * 1000&lt;/code&gt; on every new worker.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IPC must use &lt;code&gt;serialization: "advanced"&lt;/code&gt;.&lt;/strong&gt; A plain &lt;code&gt;child_process.fork&lt;/code&gt; turns &lt;code&gt;Uint8Array&lt;/code&gt; frame buffers into plain objects on the other side, and &lt;code&gt;sendFrame&lt;/code&gt; rejects them with a confusing type error.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;The score.&lt;/strong&gt; Every second the server takes the last 30 s of the smoothed upper-chest trace and computes a normalized cross-correlation against the pacer's cosine reference, maximized over lags of ±half a period (a steady lag is fine — you may breathe slightly behind the circle — but the rhythm must match). That blends with a rate gate from zero-crossings: &lt;code&gt;score = 100 × (0.6·corr + 0.4·rateGate)&lt;/code&gt;. A noise-only trace can fake a high correlation, but the rate gate kills it. Validated on synthetic signals from perfect following (1.00) down to pure noise (0.12).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Survivability.&lt;/strong&gt; The native SDK pipeline wedges in long real sessions, so the HTTP server never loads the SDK itself. The worker is a disposable fork that self-recycles (no face for 140 frames, no metrics for 400, 9 s of silence) and a tiny supervisor respawns it — the dashboard websocket never dies with the SDK.&lt;/p&gt;

&lt;h2&gt;
  
  
  🛠 Run it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/474443481/slow-breath-coach
&lt;span class="nb"&gt;cd &lt;/span&gt;slow-breath-coach
npm &lt;span class="nb"&gt;install&lt;/span&gt; @smartspectra/node-sdk jpeg-js
&lt;span class="nv"&gt;PRESAGE_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&amp;lt;your key&amp;gt;"&lt;/span&gt; node coach_server.mjs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;http://localhost:8815/&lt;/code&gt; — camera capture page (consent gate, then keep the tab in the foreground)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;http://localhost:8815/dashboard&lt;/code&gt; — pacer circle + live waveform + score&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;http://127.0.0.1:8815/demo?record=1&amp;amp;secs=30&lt;/code&gt; — the canvas demo above, and it records itself&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Free API key: &lt;a href="https://physiology.presagetech.com/" rel="noopener noreferrer"&gt;physiology.presagetech.com&lt;/a&gt; (100 credits on the free tier).&lt;/p&gt;

&lt;h2&gt;
  
  
  🔐 Consent and Data Handling
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Consent first.&lt;/strong&gt; The capture page shows a blocking consent notice explaining what is captured and where it goes; nothing starts until you press &lt;strong&gt;I agree&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What leaves your machine.&lt;/strong&gt; JPEG frames go to the local Node process and are forwarded to the &lt;strong&gt;Presage cloud API&lt;/strong&gt; for physiological inference — that is the SDK's architecture (see Presage's &lt;a href="https://physiology.presagetech.com/docs/telemetry-and-privacy/" rel="noopener noreferrer"&gt;Telemetry and Privacy documentation&lt;/a&gt;). The SDK also reports anonymous usage telemetry to Presage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What is stored.&lt;/strong&gt; Nothing, anywhere. The server keeps a bounded in-memory ring buffer for the live chart and discards it on restart. No frames, no video, no waveforms are written to disk. Closing the capture page stops the stream.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No medical claims.&lt;/strong&gt; This is a breathing-pacing toy, not a diagnostic device. Its numbers are not medical measurements and it makes no health claims.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  🎯 What I learned
&lt;/h2&gt;

&lt;p&gt;Camera pipelines are 20% vision and 80% plumbing. This week a webcam was held hostage by a QQ video call, then by the Windows Camera app, then by a quietly stopped Frame Server service, then by zombie device handles inside Edge — and underneath all of that, the SDK wanted a frame clock more regular than any real camera delivers. The virtual clock fixed the SDK; the process firewall fixed everything the SDK still throws at you.&lt;/p&gt;

&lt;p&gt;The nicest surprise: once the timestamps were honest, the correlation between "am I following the circle" and "what the SDK sees in my chest" was immediately visible on the waveform — no calibration, no tuning.&lt;/p&gt;

</description>
      <category>presagechallenge</category>
      <category>node</category>
      <category>webdev</category>
      <category>showdev</category>
    </item>
    <item>
      <title>One documentation site from five sources</title>
      <dc:creator>a474443481</dc:creator>
      <pubDate>Wed, 04 Nov 2026 04:45:53 +0000</pubDate>
      <link>https://dev.to/474443481/one-documentation-site-from-five-sources-16eh</link>
      <guid>https://dev.to/474443481/one-documentation-site-from-five-sources-16eh</guid>
      <description>&lt;p&gt;If your repository mixes languages, you almost certainly ship four kinds of documentation that four different tools generate: the HTTP API reference from OpenAPI, the C and C++ pages from Doxygen, Go and Rust pages from godoc and rustdoc, and the guides sitting in a Markdown folder that every tool renders differently. Each generator brings its own theme, its own search, and its own idea of where output belongs.&lt;/p&gt;

&lt;p&gt;The fix is boring and effective: treat documentation as a build artifact. Leave every source where it already lives, then run a single build that turns all of them into one static site.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why static, and why one build
&lt;/h2&gt;

&lt;p&gt;Static HTML has three properties that matter in 2026. It hosts anywhere: a bucket, a CDN, a small VPS, or a folder inside the repo. It needs no runtime, so it cannot rot when a server dependency breaks. And it can be read by anything, including the agents people now point at documentation.&lt;/p&gt;

&lt;p&gt;A single build matters because readers do not care which generator produced which page. They want one search box, one navigation tree, one place where the version number is correct. If the API reference says 2.4.0 and the guide says 2.3.1, trust is gone.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the build has to ingest
&lt;/h2&gt;

&lt;p&gt;A realistic project needs at least three of these sources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OpenAPI or Swagger definitions for the HTTP API.&lt;/li&gt;
&lt;li&gt;Doxygen XML for C and C++ code.&lt;/li&gt;
&lt;li&gt;godoc for Go packages.&lt;/li&gt;
&lt;li&gt;rustdoc for Rust crates.&lt;/li&gt;
&lt;li&gt;Markdown for guides, tutorials, and changelogs.&lt;/li&gt;
&lt;li&gt;MCP server definitions, if the project exposes tools to agents.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each source already has a canonical extractor. Doxygen parses C and C++ comments into XML. godoc reads Go doc comments. rustdoc ships with cargo. OpenAPI is a YAML file. The only real decision is what renders the final site.&lt;/p&gt;

&lt;h2&gt;
  
  
  The tool landscape, briefly
&lt;/h2&gt;

&lt;p&gt;Doxygen plus a theme is still the standard for C and C++, and it now emits usable HTML on its own. Sphinx owns the Python world and handles Markdown through MyST. MkDocs with Material is the default for Markdown-first projects and is easy to wire into CI. Redoc and Swagger UI render OpenAPI well but stop there; they do not know about the rest of your documentation.&lt;/p&gt;

&lt;p&gt;There is also a newer option worth a look: Sourcey, a free, self hosted documentation generator that takes OpenAPI, MCP, Doxygen, godoc, rustdoc, and Markdown in the same build and outputs static HTML. It is AGPL-3.0, installs with &lt;code&gt;npx sourcey init&lt;/code&gt;, needs Node 22 or newer, and ships four themes with custom CSS. The detail I care about is that the same build also emits llms.txt, OpenAPI, and API catalogs, so agent facing readers get machine readable versions without a second pipeline. You can see the engine at &lt;a href="https://sourcey.com/docs" rel="noopener noreferrer"&gt;https://sourcey.com/docs&lt;/a&gt; and the source at github.com/sourcey/sourcey.&lt;/p&gt;

&lt;h2&gt;
  
  
  A layout that works
&lt;/h2&gt;

&lt;p&gt;Keep sources under &lt;code&gt;docs/&lt;/code&gt; and let the build own &lt;code&gt;build/site&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docs/
  guides/*.md
  openapi.yaml
  doxygen/Doxyfile
src/                # godoc and rustdoc read from here
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A CI job runs the extractors first, then the site build, then deploys &lt;code&gt;build/site&lt;/code&gt; to your host. Cache the extractor outputs; Doxygen on a large C++ tree is the slow step, and it does not need to rerun when only a guide changed.&lt;/p&gt;

&lt;p&gt;Two rules keep this honest. First, the version string comes from one file, not from prose. Second, a broken link fails the build, not the reader's afternoon.&lt;/p&gt;

&lt;h2&gt;
  
  
  Search and the agent question
&lt;/h2&gt;

&lt;p&gt;Client side search over static files works fine up to a few thousand pages. Past that, prebuild the index at build time and ship it as a static asset.&lt;/p&gt;

&lt;p&gt;The agent question is newer. If your product exposes an MCP server or an API that agents call, your docs are part of the interface. Agents do not click; they fetch. Serving llms.txt, a clean OpenAPI file, and plain HTML without JavaScript requirements costs almost nothing and removes a whole class of failures. A documentation build that emits these by default saves you from bolting them on later.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would do first
&lt;/h2&gt;

&lt;p&gt;Pick the one build that already understands your largest source. Add the other sources one at a time. Deploy the static output somewhere boring. Then spend the remaining time on the guides, because the generator was never the hard part.&lt;/p&gt;

&lt;p&gt;Documentation is a product surface. Treat the build like code: versioned, tested, deployed on every merge. The rest is details.&lt;/p&gt;

</description>
      <category>api</category>
      <category>devops</category>
      <category>markdown</category>
      <category>documentation</category>
    </item>
  </channel>
</rss>
