<?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: SleepTrace</title>
    <description>The latest articles on DEV Community by SleepTrace (@sleeptrace).</description>
    <link>https://dev.to/sleeptrace</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%2F4017719%2F3e26e38a-eb06-495b-bb5b-971201b31c39.png</url>
      <title>DEV Community: SleepTrace</title>
      <link>https://dev.to/sleeptrace</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sleeptrace"/>
    <language>en</language>
    <item>
      <title>Overnight mobile sensing without murdering the battery: field-tested tactics</title>
      <dc:creator>SleepTrace</dc:creator>
      <pubDate>Mon, 06 Jul 2026 16:35:53 +0000</pubDate>
      <link>https://dev.to/sleeptrace/overnight-mobile-sensing-without-murdering-the-battery-field-tested-tactics-lc4</link>
      <guid>https://dev.to/sleeptrace/overnight-mobile-sensing-without-murdering-the-battery-field-tested-tactics-lc4</guid>
      <description>&lt;p&gt;Battery is the silent killer of always-on mobile sensing. If your app records or samples through the whole night, you are one bad release away from a 40% overnight drain and a one-star review that just says "killed my battery." Some hard-won tactics.&lt;/p&gt;

&lt;h2&gt;
  
  
  The budget mindset
&lt;/h2&gt;

&lt;p&gt;Treat energy like a memory budget. Every wakeup, every sensor poll, every network call has a cost. The goal is not zero cost - it is predictable, disclosed cost. Users forgive "uses ~8% overnight" if you tell them; they do not forgive a surprise.&lt;/p&gt;

&lt;h2&gt;
  
  
  Concrete tactics
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Batch, do not stream.&lt;/strong&gt; Buffer samples and process in chunks instead of waking the CPU continuously. Coalesced work is far cheaper than the same work sprinkled across the night.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Downsample aggressively.&lt;/strong&gt; Full-resolution capture is rarely needed end to end. Capture high, immediately reduce to the features you actually use, discard the rest.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;On-device beats network.&lt;/strong&gt; Classify locally and upload summaries, not raw data. Radios are among the most expensive things you can touch; a nightly sync of small summaries costs a fraction of streaming.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Respect thermal and low-power state.&lt;/strong&gt; Back off when the OS signals low-power mode. Fighting it drains battery and gets you throttled anyway.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Measure on real devices.&lt;/strong&gt; Simulators lie about energy. Profile an actual older phone across a full night before shipping.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Why it is worth the effort
&lt;/h2&gt;

&lt;p&gt;Overnight sensing only delivers value if users leave it on, and they only leave it on if it does not cost them their morning charge. For sleep specifically, the payoff is capturing events other sensors miss - the acoustic ones like snoring and breathing pauses covered in &lt;a href="https://sleeptrace.app/blog/snoring-and-sleep-apnea/" rel="noopener noreferrer"&gt;this overview of snoring vs. sleep apnea&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;What is your worst overnight-battery war story?&lt;/p&gt;

</description>
      <category>mobile</category>
      <category>ios</category>
      <category>android</category>
      <category>performance</category>
    </item>
    <item>
      <title>The sleep score is the least honest number in your health app</title>
      <dc:creator>SleepTrace</dc:creator>
      <pubDate>Mon, 06 Jul 2026 16:35:30 +0000</pubDate>
      <link>https://dev.to/sleeptrace/the-sleep-score-is-the-least-honest-number-in-your-health-app-2g1l</link>
      <guid>https://dev.to/sleeptrace/the-sleep-score-is-the-least-honest-number-in-your-health-app-2g1l</guid>
      <description>&lt;p&gt;Consumer sleep apps love a single number: 82, 78, "your sleep score." As someone building in this space, I want to make the case that the score is often the least honest thing on the screen.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why one number is seductive and wrong
&lt;/h2&gt;

&lt;p&gt;A score compresses a messy, multi-dimensional night - duration, continuity, stage distribution, disturbances - into a scalar you can feel good or bad about. That is great for engagement and terrible for truth. Two very different nights can produce the same 78, and a small model change can move the number without anything about your sleep changing.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the number hides
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Continuity vs. duration:&lt;/strong&gt; eight fragmented hours and seven solid ones can score similarly, yet feel nothing alike.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Confidence:&lt;/strong&gt; the app rarely tells you how sure it is. A stage estimate from wrist motion is a guess with wide error bars, presented as a fact.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Events:&lt;/strong&gt; the actually-actionable stuff - a snoring cluster at 2 a.m., a long awakening - gets averaged away into the score.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A more honest UI
&lt;/h2&gt;

&lt;p&gt;Show the timeline, not the trophy. "Here is when you were restless, here is a disturbance at 03:14" beats "your score is 78" because it is falsifiable and useful. Users can act on an event; nobody can act on a decimal.&lt;/p&gt;

&lt;p&gt;The clinical reason the audible events matter - especially for apnea screening - is summarized in &lt;a href="https://sleeptrace.app/blog/snoring-and-sleep-apnea/" rel="noopener noreferrer"&gt;this overview of snoring vs. sleep apnea&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;How does your product handle the tension between a friendly single metric and honest uncertainty?&lt;/p&gt;

</description>
      <category>ux</category>
      <category>datascience</category>
      <category>health</category>
      <category>mobile</category>
    </item>
    <item>
      <title>Sleep-stage detection is mostly inference. Be honest about it.</title>
      <dc:creator>SleepTrace</dc:creator>
      <pubDate>Mon, 06 Jul 2026 14:04:22 +0000</pubDate>
      <link>https://dev.to/sleeptrace/sleep-stage-detection-is-mostly-inference-be-honest-about-it-1381</link>
      <guid>https://dev.to/sleeptrace/sleep-stage-detection-is-mostly-inference-be-honest-about-it-1381</guid>
      <description>&lt;p&gt;Sleep-stage classification is where a lot of consumer sleep tech quietly cheats. A quick tour of the honest-vs-hand-wavy spectrum, from someone who has stared at too many hypnograms.&lt;/p&gt;

&lt;h2&gt;
  
  
  The ground truth nobody ships
&lt;/h2&gt;

&lt;p&gt;The clinical gold standard is polysomnography: EEG, EOG, EMG, scored in 30-second epochs by a human. No wrist wearable or phone reproduces that. Anything claiming "REM detected" from a single accelerometer is estimating, and the honest ones say so.&lt;/p&gt;

&lt;h2&gt;
  
  
  What each signal can and cannot do
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Actigraphy (motion):&lt;/strong&gt; decent at sleep-vs-wake, weak at staging. It infers deep sleep from stillness, which fails for anyone who lies still while awake.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Heart rate / HRV:&lt;/strong&gt; adds real signal - autonomic tone shifts across stages - but the mapping is probabilistic, not deterministic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audio:&lt;/strong&gt; the underused one. It cannot stage sleep on its own, but it directly captures events other sensors only infer: snoring intensity, breathing pauses, movement, environmental disturbance. Events, not stages.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The design lesson
&lt;/h2&gt;

&lt;p&gt;Do not oversell staging. Report what you actually measured (an audio event at 03:14, a long quiet stretch, a cluster of arousals) and be honest about what you inferred. Users trust "here is what happened" more than "your REM was 18%" - especially when the second number is a model's guess.&lt;/p&gt;

&lt;p&gt;The clinical background on why the audible events matter, particularly for apnea screening, is in &lt;a href="https://sleeptrace.app/blog/snoring-and-sleep-apnea/" rel="noopener noreferrer"&gt;this overview of snoring vs. sleep apnea&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Curious how others handle the honesty-vs-simplicity tradeoff in sleep UIs - what does your app claim vs. measure?&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>datascience</category>
      <category>mobile</category>
      <category>health</category>
    </item>
    <item>
      <title>Field notes: all-night audio recording on iOS without dying in the background</title>
      <dc:creator>SleepTrace</dc:creator>
      <pubDate>Mon, 06 Jul 2026 13:46:42 +0000</pubDate>
      <link>https://dev.to/sleeptrace/field-notes-all-night-audio-recording-on-ios-without-dying-in-the-background-19c</link>
      <guid>https://dev.to/sleeptrace/field-notes-all-night-audio-recording-on-ios-without-dying-in-the-background-19c</guid>
      <description>&lt;p&gt;Keeping a microphone alive all night on iOS sounds trivial and is not. Some field notes from building an audio-first sleep tracker, for anyone fighting the same OS behaviors.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;iOS suspends backgrounded apps aggressively. An &lt;code&gt;AVAudioSession&lt;/code&gt; with the &lt;code&gt;playAndRecord&lt;/code&gt; category keeps you alive - until the user locks the phone, another app grabs the session, or the system decides you are idle. Result: silent gaps in the night you only discover in the morning.&lt;/p&gt;

&lt;h2&gt;
  
  
  What actually works
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;A keep-alive audio node.&lt;/strong&gt; A muted output node on the audio graph signals "actively doing audio" to the OS. Without it, recording-only sessions get reaped on lock on some OS versions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interruption handling as a state machine.&lt;/strong&gt; Calls, alarms, Siri, CarPlay handoffs - each fires &lt;code&gt;AVAudioSession.interruptionNotification&lt;/code&gt; with slightly different resume semantics. Treat resume as &lt;em&gt;maybe&lt;/em&gt;: re-activate, verify input, and log the gap if re-activation fails.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Watchdog timestamps.&lt;/strong&gt; Write a heartbeat every N seconds. Morning-after, the gaps between heartbeats tell you exactly when and how long recording was dead - which is also honest UX: show the user the gap instead of pretending the night was complete.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Battery discipline.&lt;/strong&gt; Process in chunks, classify on-device, discard raw audio you do not need. A full night of raw PCM is storage and battery poison.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Why bother
&lt;/h2&gt;

&lt;p&gt;Because the acoustic events - snoring patterns, breathing pauses, sleep talking - are the part of the night that motion sensors cannot see. The clinical background on why those sounds matter is summarized in &lt;a href="https://sleeptrace.app/blog/snoring-and-sleep-apnea/" rel="noopener noreferrer"&gt;this overview of snoring vs. sleep apnea&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Questions about the audio session details welcome - happy to share more specifics in the comments.&lt;/p&gt;

</description>
      <category>ios</category>
      <category>swift</category>
      <category>audio</category>
      <category>mobile</category>
    </item>
    <item>
      <title>Why we built an audio-first sleep tracker (and what it taught us about on-device ML)</title>
      <dc:creator>SleepTrace</dc:creator>
      <pubDate>Mon, 06 Jul 2026 11:54:14 +0000</pubDate>
      <link>https://dev.to/sleeptrace/why-we-built-an-audio-first-sleep-tracker-and-what-it-taught-us-about-on-device-ml-1d35</link>
      <guid>https://dev.to/sleeptrace/why-we-built-an-audio-first-sleep-tracker-and-what-it-taught-us-about-on-device-ml-1d35</guid>
      <description>&lt;p&gt;Most sleep apps work like this: a motion sensor or heart-rate curve feeds a model, the model guesses your sleep stages, and you get a score in the morning. The score might say 78. What it can't tell you is &lt;em&gt;why&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;We build &lt;a href="https://sleeptrace.app/" rel="noopener noreferrer"&gt;SleepTrace&lt;/a&gt;, an audio-first sleep tracker, and this post is about the engineering reasons we bet on sound instead of another wearable.&lt;/p&gt;

&lt;h2&gt;
  
  
  The signal nobody records
&lt;/h2&gt;

&lt;p&gt;The events that actually destroy sleep quality are acoustic:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;snoring (intensity, patterns, position-dependence)&lt;/li&gt;
&lt;li&gt;gasping / breathing pauses that may warrant a doctor visit&lt;/li&gt;
&lt;li&gt;sleep talking and grinding&lt;/li&gt;
&lt;li&gt;environmental noise: partner, street, pets&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A phone microphone on the nightstand captures all of these. A wrist wearable captures none of them directly — it infers downstream effects (movement, heart rate) and guesses at the cause.&lt;/p&gt;

&lt;h2&gt;
  
  
  Evidence beats scores
&lt;/h2&gt;

&lt;p&gt;The product insight: people act when they &lt;em&gt;hear&lt;/em&gt; a 20-second clip of their own 3 a.m. snoring. Nobody changes their behavior because a number dropped from 82 to 78. So instead of leading with a score, the app leads with an audio timeline of the night — the moments worth hearing, classified on-device.&lt;/p&gt;

&lt;h2&gt;
  
  
  The hard constraints
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;All-night recording on iOS/Android without draining the battery.&lt;/strong&gt; Background audio sessions, watchdog timers, and OS-specific keep-alive quirks are half the codebase's gray hair.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;On-device classification.&lt;/strong&gt; Recording a bedroom is the most privacy-sensitive thing an app can do. Clips are processed locally; nothing leaves the phone without explicit opt-in. Privacy has to be structural, not a checkbox.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Storage discipline.&lt;/strong&gt; A full night of audio is large. We keep event clips, not raw nights.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What the literature says
&lt;/h2&gt;

&lt;p&gt;Acoustic analysis is a legitimate screening signal — snoring characteristics and audible breathing pauses correlate with apnea-hypopnea severity. We collect the relevant studies with citations on the &lt;a href="https://sleeptrace.app/blog/" rel="noopener noreferrer"&gt;SleepTrace sleep science blog&lt;/a&gt; if you want to dig into the research side.&lt;/p&gt;

&lt;p&gt;Happy to answer questions about background audio sessions, on-device audio ML, or the privacy architecture in the comments.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>mobile</category>
      <category>showdev</category>
      <category>startup</category>
    </item>
  </channel>
</rss>
