<?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: mincho milev</title>
    <description>The latest articles on DEV Community by mincho milev (@mincho_milev_c7753077d5af).</description>
    <link>https://dev.to/mincho_milev_c7753077d5af</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%2F1938279%2Fec79864f-f7ff-444d-a8f8-432d21e838f8.png</url>
      <title>DEV Community: mincho milev</title>
      <link>https://dev.to/mincho_milev_c7753077d5af</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mincho_milev_c7753077d5af"/>
    <language>en</language>
    <item>
      <title>Why Voice Barge-In Matters for IELTS &amp; Job Interview Prep (Building with OpenAI's Realtime API on Apple Platforms)</title>
      <dc:creator>mincho milev</dc:creator>
      <pubDate>Wed, 02 Dec 2026 13:00:00 +0000</pubDate>
      <link>https://dev.to/mincho_milev_c7753077d5af/why-voice-barge-in-matters-for-ielts-job-interview-prep-building-with-openais-realtime-api-on-56hf</link>
      <guid>https://dev.to/mincho_milev_c7753077d5af/why-voice-barge-in-matters-for-ielts-job-interview-prep-building-with-openais-realtime-api-on-56hf</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclosure: I am the developer of &lt;a href="https://gpt-realtime-assistant.arte-soft.com/" rel="noopener noreferrer"&gt;GPT Realtime Assistant&lt;/a&gt; (Arte Soft EOOD, independent of OpenAI).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When preparing for an &lt;strong&gt;IELTS Speaking test&lt;/strong&gt;, &lt;strong&gt;TOEFL Speaking&lt;/strong&gt;, or an &lt;strong&gt;English job interview&lt;/strong&gt;, it is easy to rehearse answers silently or type prompts into a text chat instead of practising aloud.&lt;/p&gt;

&lt;p&gt;Then the real examiner or hiring manager interrupts mid-sentence, challenges a vague claim, and asks an unexpected follow-up. Your brain freezes—not because you don't know the grammar, but because you never trained &lt;strong&gt;real-time spoken reflexes&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Turn-Based Voice vs. Realtime Barge-In
&lt;/h2&gt;

&lt;p&gt;Some voice-practice tools wait until you finish recording an answer before processing it and returning a reply. That can work for drills, while an interactive conversation lets you practise responding to follow-up questions and interruptions.&lt;/p&gt;

&lt;p&gt;When building &lt;strong&gt;GPT Realtime Assistant&lt;/strong&gt; for iPhone (iOS 17+), iPad (iPadOS 17+), and Apple silicon Mac (macOS 15+), we connected directly to &lt;strong&gt;OpenAI's Realtime API&lt;/strong&gt; with semantic turn detection and natural &lt;strong&gt;barge-in&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can interrupt the AI naturally by speaking, just like in a human conversation.&lt;/li&gt;
&lt;li&gt;You can set &lt;strong&gt;Answer Length&lt;/strong&gt; to &lt;em&gt;Brief&lt;/em&gt; so the AI examiner asks sharp 1–2 sentence follow-ups instead of lecturing.&lt;/li&gt;
&lt;li&gt;Every spoken turn appears in a &lt;strong&gt;side-by-side live transcript&lt;/strong&gt; next to the AI's phrasing upgrades.&lt;/li&gt;
&lt;li&gt;You can attach a &lt;strong&gt;camera photo or Mac window capture&lt;/strong&gt; of an IELTS cue card, textbook exercise, or job description via Vision AI so every question targets your exact material.&lt;/li&gt;
&lt;li&gt;Afterward, you can drill the upgraded phrasing aloud with on-device &lt;strong&gt;Karaoke Readback&lt;/strong&gt; (word-by-word highlighting as you speak).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Copy-Paste Examiner Prompt (IELTS Part 1, 2 &amp;amp; 3)
&lt;/h2&gt;

&lt;p&gt;You can adapt this instruction in GPT Realtime Assistant or any live Realtime voice setup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Act as a strict, realistic IELTS Speaking examiner. Run a live 3-part mock test with me:
- Part 1: Ask 4 short personal questions, one at a time. Wait for my spoken answer before moving on.
- Part 2: Give me a Cue Card topic with 3 bullet points. After I speak for 1–2 minutes, ask 1 quick follow-up.
- Part 3: Ask 3 abstract discussion questions and challenge vague claims with natural follow-ups.
After each part, give brief, concrete feedback on: (1) Fluency &amp;amp; pauses, (2) Stronger Band 8+ vocabulary upgrades for phrases I actually said, and (3) Grammar fixes. Keep spoken replies concise.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Honest Tradeoffs
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live workspace only:&lt;/strong&gt; GPT Realtime Assistant works live while open on screen (it is not a batch uploader for old MP3 recordings).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pricing &amp;amp; requirements:&lt;/strong&gt; US App Store pricing is &lt;code&gt;$11.99/month&lt;/code&gt; (2,000 AI credits/mo) or &lt;code&gt;$119.99/year&lt;/code&gt; (2,500 AI credits/mo × 12 = 30,000 total), covering iPhone, iPad, and Mac under one Apple ID (auto-renews; regional prices vary; no free trial).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local Mac option:&lt;/strong&gt; On a supported Apple silicon Mac with an active subscription and initial model download, Whisper Large v3 Turbo + Qwen 3 8B run locally without consuming AI credits (text answers).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Further reading &amp;amp; comparisons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://realtime-assistant.arte-soft.com/guides/ielts-toefl-speaking-mock-examiner-part-1-2-3-ai-voice/" rel="noopener noreferrer"&gt;IELTS &amp;amp; TOEFL Speaking Mock Examiner Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://realtime-assistant.arte-soft.com/compare/realtime-assistant-vs-goprep-ielts-speaking-ai/" rel="noopener noreferrer"&gt;GPT Realtime Assistant vs GoPrep (IELTS.GG)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://realtime-assistant.arte-soft.com/compare/realtime-assistant-vs-pingo-ai-language-tutor/" rel="noopener noreferrer"&gt;GPT Realtime Assistant vs Pingo AI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://apps.apple.com/us/app/gpt-realtime-assistant/id6770536523" rel="noopener noreferrer"&gt;App Store Listing&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>ios</category>
      <category>macos</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Shrinking an encrypted photo vault on the phone: AES-256-GCM plus HEVC, and no cloud</title>
      <dc:creator>mincho milev</dc:creator>
      <pubDate>Sun, 29 Nov 2026 12:16:14 +0000</pubDate>
      <link>https://dev.to/mincho_milev_c7753077d5af/shrinking-an-encrypted-photo-vault-on-the-phone-aes-256-gcm-plus-hevc-and-no-cloud-a90</link>
      <guid>https://dev.to/mincho_milev_c7753077d5af/shrinking-an-encrypted-photo-vault-on-the-phone-aes-256-gcm-plus-hevc-and-no-cloud-a90</guid>
      <description>&lt;p&gt;Most photo vault apps solve one problem: hiding pictures behind a PIN. We wanted to solve two at once on a phone that is already full: keep private photos encrypted on the device, and make that private library take less space, without sending anything to a server.&lt;/p&gt;

&lt;p&gt;That became &lt;a href="https://photovault.arte-soft.com/" rel="noopener noreferrer"&gt;PhotoVault&lt;/a&gt; (on the App Store as "PhotoVault: Encrypt &amp;amp; Compress", on Google Play as "Photo Vault: Private Gallery"). This post covers the design choices and the trade-offs we decided to be honest about.&lt;/p&gt;

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

&lt;ul&gt;
&lt;li&gt;No account and no cloud. Nothing leaves the device unless the user exports it.&lt;/li&gt;
&lt;li&gt;Encryption at rest that does not depend on the phone's own file protection alone.&lt;/li&gt;
&lt;li&gt;A real storage win, measured, not promised.&lt;/li&gt;
&lt;li&gt;iPhone, iPad and Android, with a way to move a library between them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Encryption
&lt;/h2&gt;

&lt;p&gt;Media files and the metadata indexes are encrypted on the device with AES-256-GCM. The key is device-bound and lives in the iOS Keychain or the Android Keystore. Unlocking the app (password, 5x5 pattern, or Face ID / Touch ID) is a gate in front of that encrypted store; it is not the encryption key itself.&lt;/p&gt;

&lt;p&gt;What this means in practice: there is no server copy to subpoena or leak, and also no server copy to restore from. We do not offer a password reset or a recovery phrase. That is a deliberate trade-off, and we say so in the app and on the site.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two storage modes, and no default
&lt;/h2&gt;

&lt;p&gt;At import the user picks one of two buttons:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mode&lt;/th&gt;
&lt;th&gt;What is stored&lt;/th&gt;
&lt;th&gt;Space saved&lt;/th&gt;
&lt;th&gt;Export&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Lossless&lt;/td&gt;
&lt;td&gt;The original file, byte for byte&lt;/td&gt;
&lt;td&gt;Practically none&lt;/td&gt;
&lt;td&gt;The original file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Compact&lt;/td&gt;
&lt;td&gt;A lossy HEVC re-encode&lt;/td&gt;
&lt;td&gt;Typically 60%+&lt;/td&gt;
&lt;td&gt;A re-encoded copy, not the original&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;We did not want a silent default here. Compact is great for a big archive of everyday pictures; Lossless is the right choice for anything where exact fidelity matters (evidence, professional editing). Making the user choose each time keeps that decision visible.&lt;/p&gt;

&lt;p&gt;Measured results from our demos (your photos will differ):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Device&lt;/th&gt;
&lt;th&gt;Before&lt;/th&gt;
&lt;th&gt;After&lt;/th&gt;
&lt;th&gt;Smaller by&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;iOS demo set&lt;/td&gt;
&lt;td&gt;313.3 MB&lt;/td&gt;
&lt;td&gt;122.7 MB&lt;/td&gt;
&lt;td&gt;60.8%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;iPhone 18 Pro Max&lt;/td&gt;
&lt;td&gt;470 MB&lt;/td&gt;
&lt;td&gt;27 MB&lt;/td&gt;
&lt;td&gt;94%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Android demo set&lt;/td&gt;
&lt;td&gt;120.8 MB&lt;/td&gt;
&lt;td&gt;20.5 MB&lt;/td&gt;
&lt;td&gt;83.0%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Moving a vault without a cloud: .pvsecure
&lt;/h2&gt;

&lt;p&gt;Without sync, users still need to get photos onto a new phone. Secure Share writes an encrypted &lt;code&gt;.pvsecure&lt;/code&gt; file protected by a password or a pattern. You move that file any way you like (AirDrop, USB, a messenger), and Secure Import opens it on another iPhone, iPad or Android device. It is a one-time transfer, not sync, and no account is involved.&lt;/p&gt;

&lt;p&gt;The container format is documented here: &lt;a href="https://github.com/minchopm/pvsecure-spec" rel="noopener noreferrer"&gt;https://github.com/minchopm/pvsecure-spec&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What it deliberately does not do
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;No in-app camera (photos you take land in the system Photos app first).&lt;/li&gt;
&lt;li&gt;No decoy vault.&lt;/li&gt;
&lt;li&gt;No cloud backup, no recovery phrase, no password reset.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you need cloud sync or a decoy vault, other apps do that better, and we keep an honest comparison table of 18 of them: &lt;a href="https://photovault.arte-soft.com/compare/" rel="noopener noreferrer"&gt;https://photovault.arte-soft.com/compare/&lt;/a&gt; . For example, Vaultaire (iPhone and iPad) offers encrypted iCloud backup and decoy vaults, while PhotoVault adds on-device compression and Android: &lt;a href="https://photovault.arte-soft.com/compare/photovault-vs-vaultaire/" rel="noopener noreferrer"&gt;https://photovault.arte-soft.com/compare/photovault-vs-vaultaire/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;iPhone and iPad (iOS 18+): &lt;a href="https://apps.apple.com/us/app/id6824412013" rel="noopener noreferrer"&gt;https://apps.apple.com/us/app/id6824412013&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Android (Android 11+): &lt;a href="https://play.google.com/store/apps/details?id=com.artesoft.photovault" rel="noopener noreferrer"&gt;https://play.google.com/store/apps/details?id=com.artesoft.photovault&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Free to download, with optional plans. Questions about the crypto or the HEVC pipeline are welcome in the comments. I am the developer, at Arte Soft in Sofia, Bulgaria.&lt;/p&gt;

</description>
      <category>ios</category>
      <category>android</category>
      <category>security</category>
      <category>privacy</category>
    </item>
    <item>
      <title>Why iPhone's Hidden Album Isn't Encrypted—and How We Built a Zero-Cloud AES-256-GCM Vault (.pvsecure)</title>
      <dc:creator>mincho milev</dc:creator>
      <pubDate>Wed, 25 Nov 2026 18:32:45 +0000</pubDate>
      <link>https://dev.to/mincho_milev_c7753077d5af/why-iphones-hidden-album-isnt-encrypted-and-how-we-built-a-zero-cloud-aes-256-gcm-vault-1414</link>
      <guid>https://dev.to/mincho_milev_c7753077d5af/why-iphones-hidden-album-isnt-encrypted-and-how-we-built-a-zero-cloud-aes-256-gcm-vault-1414</guid>
      <description>&lt;p&gt;Every week people assume locking Apple Photos' &lt;strong&gt;Hidden Album&lt;/strong&gt; protects private IDs, medical scans, financial receipts, and personal videos. Under the hood, however, the Hidden Album shares the &lt;strong&gt;exact same device passcode&lt;/strong&gt; as the iPhone lock screen—meaning anyone who knows or shoulder-surfs your phone's unlock PIN opens your Hidden Album in two seconds—and iCloud Photos sync replicates those files off-device unless disabled globally.&lt;/p&gt;

&lt;p&gt;When building &lt;strong&gt;&lt;a href="https://photovault.arte-soft.com/" rel="noopener noreferrer"&gt;PhotoVault: Encrypt &amp;amp; Compress&lt;/a&gt;&lt;/strong&gt; (&lt;a href="https://apps.apple.com/us/app/photovault-encrypt-compress/id6824412013" rel="noopener noreferrer"&gt;App Store &lt;code&gt;id6824412013&lt;/code&gt;&lt;/a&gt; for iPhone &amp;amp; iPad on iOS 18+), we wanted an accountless, zero-server architecture that solves three hard engineering constraints simultaneously:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;True At-Rest &lt;code&gt;AES-256-GCM&lt;/code&gt; Encryption&lt;/strong&gt; with an independent Password or &lt;code&gt;5×5&lt;/code&gt; Pattern (separate from the iPhone passcode) and zero cloud key escrow.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;60%+ Storage Reduction in Compact Mode&lt;/strong&gt; (shrinking a 313.3 MB camera-roll set down to a 122.7 MB encrypted container via hardware &lt;code&gt;VideoToolbox&lt;/code&gt; HEVC, alongside bit-exact &lt;strong&gt;Lossless Mode&lt;/strong&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Offline Device-to-Device Migration (&lt;code&gt;.pvsecure&lt;/code&gt;)&lt;/strong&gt; + &lt;strong&gt;On-Device Vision OCR&lt;/strong&gt; so users can search printed text inside encrypted receipts and contracts with zero network requests.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We also published the wire-format specification in our open documentation repo: &lt;strong&gt;&lt;a href="https://github.com/minchopm/pvsecure-spec" rel="noopener noreferrer"&gt;https://github.com/minchopm/pvsecure-spec&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Separating Vault Credentials From the Device Passcode
&lt;/h2&gt;

&lt;p&gt;A common mistake in mobile "folder hider" apps is storing raw JPEGs in the app's sandbox &lt;code&gt;Documents/&lt;/code&gt; directory behind a UI-only PIN screen. Anyone backing up an unencrypted Finder/iTunes snapshot or inspecting the sandbox sees plaintext media.&lt;/p&gt;

&lt;p&gt;In PhotoVault:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Media payloads and the searchable metadata index are encrypted on disk with &lt;strong&gt;&lt;code&gt;AES-256-GCM&lt;/code&gt;&lt;/strong&gt; via Apple &lt;code&gt;CryptoKit&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The per-installation symmetric key is sealed with &lt;code&gt;kSecAttrAccessibleWhenUnlockedThisDeviceOnly&lt;/code&gt; so it never leaves the physical iPhone's Secure Enclave-backed Keychain.&lt;/li&gt;
&lt;li&gt;Users can configure an &lt;strong&gt;independent Password or 5×5 Pattern&lt;/strong&gt; (in addition to Face ID / Touch ID) that locks immediately whenever &lt;code&gt;scenePhase&lt;/code&gt; leaves &lt;code&gt;.active&lt;/code&gt;. See our full breakdown: &lt;a href="https://photovault.arte-soft.com/guides/iphone-hidden-album-vs-encrypted-photo-vault/" rel="noopener noreferrer"&gt;iPhone Hidden Album vs. True Encrypted Photo Vault&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. Portable &lt;code&gt;.pvsecure&lt;/code&gt; Archives (&lt;code&gt;PBKDF2-HMAC-SHA256&lt;/code&gt; + &lt;code&gt;AES-256-GCM&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;Zero cloud servers creates an obvious UX question: &lt;em&gt;How do I move 20 GB of encrypted family videos to a new iPhone without uploading them to iCloud or Keepsafe's cloud?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;PhotoVault's &lt;strong&gt;Secure Share&lt;/strong&gt; exports a standalone &lt;code&gt;.pvsecure&lt;/code&gt; file derived from a user-chosen Password or &lt;code&gt;5×5&lt;/code&gt; Pattern:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;32-byte CSPRNG salt&lt;/strong&gt; (&lt;code&gt;SecRandomCopyBytes&lt;/code&gt;) + &lt;strong&gt;&lt;code&gt;PBKDF2-HMAC-SHA256&lt;/code&gt;&lt;/strong&gt; (&lt;code&gt;210,000+&lt;/code&gt; iterations) derives a 256-bit key.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;96-bit nonce + 128-bit GCM authentication tag&lt;/strong&gt; guarantees full integrity verification before a single byte is unpacked during &lt;strong&gt;Secure Import&lt;/strong&gt; over AirDrop, Files, or USB-C drive.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  3. Running Searchable Receipt OCR 100% Offline
&lt;/h2&gt;

&lt;p&gt;Cloud photo managers index your receipts and ID cards on remote GPUs. On Apple silicon iPhones (&lt;code&gt;iOS 18+&lt;/code&gt;), &lt;code&gt;VNRecognizeTextRequest&lt;/code&gt; (&lt;code&gt;.accurate&lt;/code&gt; recognition level with automatic language detection) extracts printed text locally in milliseconds:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PhotoVault normalizes HDR/wide-gamut frames to 8-bit sRGB buffers in memory, runs &lt;code&gt;Vision&lt;/code&gt; OCR + barcode detection locally, and writes the tokens straight into the &lt;strong&gt;encrypted on-device index&lt;/strong&gt;—zero external API calls, zero ad SDKs, and zero telemetry.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you're comparing local-first iOS vaults against cloud subscription lockers, check out our &lt;a href="https://photovault.arte-soft.com/compare/" rel="noopener noreferrer"&gt;2026 Encrypted iPhone Photo Vault Comparison Matrix&lt;/a&gt; or try &lt;strong&gt;&lt;a href="https://apps.apple.com/us/app/photovault-encrypt-compress/id6824412013" rel="noopener noreferrer"&gt;PhotoVault: Encrypt &amp;amp; Compress on the App Store&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>ios</category>
      <category>security</category>
      <category>swift</category>
      <category>privacy</category>
    </item>
    <item>
      <title>Visualizing King-and-Pawn Endgame Geometry in the Browser: Square of the Pawn, Opposition, and Key Squares</title>
      <dc:creator>mincho milev</dc:creator>
      <pubDate>Tue, 24 Nov 2026 14:00:20 +0000</pubDate>
      <link>https://dev.to/mincho_milev_c7753077d5af/visualizing-king-and-pawn-endgame-geometry-in-the-browser-square-of-the-pawn-opposition-and-key-2726</link>
      <guid>https://dev.to/mincho_milev_c7753077d5af/visualizing-king-and-pawn-endgame-geometry-in-the-browser-square-of-the-pawn-opposition-and-key-2726</guid>
      <description>&lt;p&gt;Chess players learn King-and-Pawn (&lt;code&gt;K+P vs K&lt;/code&gt;) endgames visually—drawing an imaginary bounding box from a passed pawn to the promotion rank ("the rule of the square") or counting files and ranks between rival kings to claim direct, distant, or diagonal opposition. Yet most web chess boards treat endgame instruction as static arrows drawn manually over PGN comments: the moment a student drags the defending king one square to the left to ask &lt;em&gt;"what if Black plays &lt;code&gt;...Kf6&lt;/code&gt; instead?"&lt;/em&gt;, the static arrows vanish.&lt;/p&gt;

&lt;p&gt;While building the browser endgame visualizers at &lt;strong&gt;&lt;a href="https://chess-trainer.arte-soft.com/tools/" rel="noopener noreferrer"&gt;chess-trainer.arte-soft.com/tools/&lt;/a&gt;&lt;/strong&gt; as open web companions to our AGPLv3 native Stockfish 18 trainer &lt;strong&gt;&lt;a href="https://brasspawn.com/" rel="noopener noreferrer"&gt;Brass Pawn&lt;/a&gt;&lt;/strong&gt;, we wanted instant (&lt;code&gt;&amp;lt; 1 ms&lt;/code&gt;), zero-WASM client-side algorithms that compute &lt;strong&gt;both&lt;/strong&gt; human geometric heuristics &lt;em&gt;and&lt;/em&gt; exact game-theoretic win/draw truth for any legal &lt;code&gt;K+P vs K&lt;/code&gt; configuration.&lt;/p&gt;

&lt;p&gt;Here is how the geometry works—and where human rules of thumb diverge from exact retrograde truth.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Chebyshev Distance and the "Square of the Pawn"
&lt;/h2&gt;

&lt;p&gt;On an $8 \times 8$ board indexed by file $f \in [0..7]$ (&lt;code&gt;a&lt;/code&gt;–&lt;code&gt;h&lt;/code&gt;) and rank $r \in [0..7]$ (&lt;code&gt;1&lt;/code&gt;–&lt;code&gt;8&lt;/code&gt;), a chess king moves in every direction by 1 unit per turn, meaning king travel time in an unobstructed plane is governed by the &lt;strong&gt;Chebyshev ($L_\infty$) metric&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;$$d_\infty(A, B) = \max(|f_A - f_B|, |r_A - r_B|)$$&lt;/p&gt;

&lt;p&gt;For a White passed pawn at $(f_P, r_P)$ promoting at $(f_P, 7)$, naive distance to queening is $7 - r_P$ moves—with one crucial classical adjustment: &lt;strong&gt;if the pawn still stands on its starting rank ($r_P = 1$, rank 2), its double-step option reduces effective promotion distance to $7 - 2 = 5$ tempos&lt;/strong&gt;, meaning the geometric square starts from rank 3 (&lt;code&gt;rEffective = Math.max(rP, 2)&lt;/code&gt; when White is to move, or after accounting for side-to-move tempo).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;computeSquareOfPawn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pawn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;defendingKing&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pawnSide&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"w"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sideToMove&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"w"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;promoRank&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pawnSide&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"w"&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;startRank&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pawnSide&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"w"&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;effectiveRank&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pawn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rank&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;startRank&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pawnSide&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"w"&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;pawn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rank&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;promoRank&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;effectiveRank&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;defenderTempo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sideToMove&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="n"&gt;pawnSide&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;bounds&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;minFile&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pawn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;maxFile&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pawn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;minRank&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;effectiveRank&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;promoRank&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;maxRank&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;effectiveRank&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;promoRank&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;distToPromoSquare&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;defendingKing&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;pawn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;defendingKing&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;rank&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;promoRank&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;bounds&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;distToPromoSquare&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;catchesGeometrically&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;distToPromoSquare&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;defenderTempo&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why the Geometric Overlay Needs an Obstruction Warning
&lt;/h3&gt;

&lt;p&gt;Every strong club player remembers famous studies (most notably &lt;strong&gt;Réti, 1921&lt;/strong&gt;) where the pure Square-of-the-Pawn formula misleads casual students for two reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Self-Interference / Friendly King Obstruction:&lt;/strong&gt; If the attacking king stands &lt;em&gt;directly on the pawn's file ahead of the pawn&lt;/em&gt;, the pawn may lose a tempo waiting for its own king to step aside—or conversely, the attacking king can shoulder (&lt;code&gt;shouldering&lt;/code&gt;) the defending king off its shortest Chebyshev path!&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dual Threats:&lt;/strong&gt; A king pursuing a passed pawn along a diagonal simultaneously approaches a second target (such as supporting its own passed pawn).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Showing &lt;strong&gt;both&lt;/strong&gt; the translucent geometric square &lt;em&gt;and&lt;/em&gt; the exact win/draw badge immediately teaches students &lt;em&gt;when&lt;/em&gt; the shortcut holds and &lt;em&gt;when&lt;/em&gt; king interference overrides it.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Classifying Direct, Distant, and Diagonal Opposition in $O(1)$
&lt;/h2&gt;

&lt;p&gt;Two kings at $(f_W, r_W)$ and $(f_B, r_B)$ stand in generalized &lt;strong&gt;opposition&lt;/strong&gt; whenever the file gap $\Delta f = |f_W - f_B|$ and rank gap $\Delta r = |r_W - r_B|$ are &lt;strong&gt;both even&lt;/strong&gt; (so they occupy squares of the same color and an odd number of squares separates them along ranks/files):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;$\Delta f = |f_W - f_B|$&lt;/th&gt;
&lt;th&gt;$\Delta r = |r_W - r_B|$&lt;/th&gt;
&lt;th&gt;Classification&lt;/th&gt;
&lt;th&gt;Who Holds the Opposition?&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;2&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Direct Vertical Opposition&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The side &lt;strong&gt;NOT&lt;/strong&gt; to move&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;2&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Direct Horizontal Opposition&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The side &lt;strong&gt;NOT&lt;/strong&gt; to move&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;2&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;2&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Direct Diagonal Opposition&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The side &lt;strong&gt;NOT&lt;/strong&gt; to move&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;0&lt;/code&gt; and $\Delta r \in {4, 6}$ (or vice versa)&lt;/td&gt;
&lt;td&gt;Even&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Distant Orthogonal Opposition&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The side &lt;strong&gt;NOT&lt;/strong&gt; to move&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Even ($\ge 2$)&lt;/td&gt;
&lt;td&gt;Even ($\ge 2$), $\max \ge 4$&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Virtual / Distant Rectangle Opposition&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The side &lt;strong&gt;NOT&lt;/strong&gt; to move&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That parity invariant (&lt;code&gt;(df % 2 === 0) &amp;amp;&amp;amp; (dr % 2 === 0)&lt;/code&gt;) explains in one line why diagonal and distant opposition work: whichever player just moved into the even-parity state forces the opponent to break parity on the next half-move, allowing the holder to step closer while restoring even &lt;code&gt;(df, dr)&lt;/code&gt; parity until converting distant opposition into direct opposition!&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Key Squares vs. Rook-Pawn Corner Exceptions
&lt;/h2&gt;

&lt;p&gt;When the defending king &lt;em&gt;is&lt;/em&gt; inside the square of the pawn, &lt;code&gt;K+P vs K&lt;/code&gt; revolves around &lt;strong&gt;Key Squares&lt;/strong&gt; (critical squares): if the attacking king reaches any key square—regardless of whose turn it is—the pawn promotes by force:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Non-Rook Pawns (&lt;code&gt;b&lt;/code&gt;–&lt;code&gt;g&lt;/code&gt; files) on Ranks 2, 3, or 4 (White):&lt;/strong&gt; The 3 squares &lt;strong&gt;two ranks ahead&lt;/strong&gt; of the pawn: &lt;code&gt;(fP - 1, rP + 2)&lt;/code&gt;, &lt;code&gt;(fP, rP + 2)&lt;/code&gt;, &lt;code&gt;(fP + 1, rP + 2)&lt;/code&gt;. Reaching them with opposition from one rank below relies on who has the move, whereas occupying them wins unconditionally!&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Non-Rook Pawns on Rank 5 or 6:&lt;/strong&gt; Expanded to &lt;strong&gt;6 key squares&lt;/strong&gt;—both one rank ahead and two ranks ahead across &lt;code&gt;(fP - 1 .. fP + 1)&lt;/code&gt;—because the sixth-rank rule eliminates stalemating defenses!&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rook Pawns (&lt;code&gt;a&lt;/code&gt; and &lt;code&gt;h&lt;/code&gt; files):&lt;/strong&gt; Classic geometric rules break down completely on the board edge! Even if White's king occupies &lt;code&gt;a6&lt;/code&gt; ahead of an &lt;code&gt;a5&lt;/code&gt; pawn, if Black's king reaches &lt;code&gt;c7&lt;/code&gt; or &lt;code&gt;c8&lt;/code&gt; (or &lt;code&gt;a8&lt;/code&gt;/&lt;code&gt;b8&lt;/code&gt;), Black draws by perpetual corner stalemate or trapping White's king in front of its own pawn (&lt;code&gt;b7&lt;/code&gt;/&lt;code&gt;c7&lt;/code&gt; boxing).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  4. Exact Client-Side Retrograde &lt;code&gt;KPK&lt;/code&gt; Verification in ~25 Milliseconds
&lt;/h2&gt;

&lt;p&gt;Because rook pawns, pawn captures, and king-blocking create tactical exceptions to textbook key-square charts, an educational visualizer should never guess. Instead of downloading a 7 MB Stockfish WebAssembly binary just to verify a 3-piece endgame, you can build a &lt;strong&gt;complete in-memory &lt;code&gt;K+P vs K&lt;/code&gt; retrograde tablebase&lt;/strong&gt; in pure JavaScript right on page load!&lt;/p&gt;

&lt;p&gt;Using horizontal symmetry (&lt;code&gt;pawnFile&lt;/code&gt; mirrored into &lt;code&gt;0..3&lt;/code&gt;, i.e., files &lt;code&gt;a&lt;/code&gt;–&lt;code&gt;d&lt;/code&gt;), the entire state space is tiny:&lt;/p&gt;

&lt;p&gt;$$64 \text{ (White King)} \times 64 \text{ (Black King)} \times 24 \text{ (Pawn: 4 files} \times \text{6 ranks)} \times 2 \text{ (Side to Move)} = 196,608 \text{ states}$$&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;Uint8Array(196608)&lt;/code&gt; occupies just &lt;strong&gt;192 KB of RAM&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Seed Terminal &amp;amp; Promotion Transitions:&lt;/strong&gt; Mark illegal overlapping/adjacent-king states invalid; mark states where Black legally captures the undefended pawn as &lt;code&gt;DRAW&lt;/code&gt;; for pawn promotions to Queen/Rook (remembering underpromotion to Rook avoids rare corner stalemates!), check whether Black is immediately stalemated or captures the new queen; otherwise mark &lt;code&gt;WIN&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Iterative Retrograde Fixed-Point Loop:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;An &lt;code&gt;UNKNOWN&lt;/code&gt; White-to-move state becomes &lt;code&gt;WIN&lt;/code&gt; as soon as &lt;strong&gt;any&lt;/strong&gt; legal White move enters a &lt;code&gt;WIN&lt;/code&gt; state.&lt;/li&gt;
&lt;li&gt;An &lt;code&gt;UNKNOWN&lt;/code&gt; Black-to-move state becomes &lt;code&gt;WIN&lt;/code&gt; only when &lt;strong&gt;every&lt;/strong&gt; legal Black move leads to a &lt;code&gt;WIN&lt;/code&gt; state (and Black is not stalemated!).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Repeat until a pass marks zero new &lt;code&gt;WIN&lt;/code&gt; states (~28 passes, completing in &lt;strong&gt;~22 ms&lt;/strong&gt; on a laptop or modern phone). Every remaining legal state is a proven &lt;strong&gt;theoretical &lt;code&gt;DRAW&lt;/code&gt;&lt;/strong&gt;!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With that 192 KB table in memory, dragging any of the three pieces updates &lt;strong&gt;every legal destination square&lt;/strong&gt; on the chessboard in &lt;code&gt;O(1)&lt;/code&gt; microseconds—coloring winning king steps green and drawing blunders amber while overlaying the classical Square-of-the-Pawn and Key-Square geometry on top.&lt;/p&gt;




&lt;h2&gt;
  
  
  Try the Interactive Endgame Visualizers &amp;amp; Open-Source Engine
&lt;/h2&gt;

&lt;p&gt;You can experiment with interactive endgame geometry, opposition, and tactics visualizers directly in your browser (zero sign-up) at &lt;strong&gt;&lt;a href="https://chess-trainer.arte-soft.com/tools/" rel="noopener noreferrer"&gt;chess-trainer.arte-soft.com/tools/&lt;/a&gt;&lt;/strong&gt;, or train across 14,351 Stockfish 18 tactics puzzles, 116 positional judgement studies, and offline endgame drills in &lt;strong&gt;&lt;a href="https://brasspawn.com/" rel="noopener noreferrer"&gt;Brass Pawn&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>gamedev</category>
      <category>algorithms</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Multi-Provider Calendar Sync: Solving IANA Timezone, DST Gap, and Weather Window Edge Cases</title>
      <dc:creator>mincho milev</dc:creator>
      <pubDate>Sat, 21 Nov 2026 14:00:06 +0000</pubDate>
      <link>https://dev.to/mincho_milev_c7753077d5af/multi-provider-calendar-sync-solving-iana-timezone-dst-gap-and-weather-window-edge-cases-13ag</link>
      <guid>https://dev.to/mincho_milev_c7753077d5af/multi-provider-calendar-sync-solving-iana-timezone-dst-gap-and-weather-window-edge-cases-13ag</guid>
      <description>&lt;p&gt;Unifying schedules from Apple iCloud (CalDAV / EventKit), Google Calendar REST APIs, and Microsoft 365 Graph looks deceptively simple when every test fixture lives in &lt;code&gt;UTC&lt;/code&gt; during mid-June. The moment real users coordinate cross-Atlantic recurring standups across March and November Daylight Saving Time (DST) shifts—or overlay hourly outdoor weather windows onto calendar blocks—naive epoch-millisecond arithmetic quietly shifts meetings by an hour.&lt;/p&gt;

&lt;p&gt;While engineering &lt;strong&gt;&lt;a href="https://cloud-calendars.arte-soft.com/" rel="noopener noreferrer"&gt;Cloud Calendars&lt;/a&gt;&lt;/strong&gt; and our free browser scheduling utilities at &lt;strong&gt;&lt;a href="https://www.cloud-calendars.com/tools/" rel="noopener noreferrer"&gt;www.cloud-calendars.com/tools/&lt;/a&gt;&lt;/strong&gt;, we isolated four structural invariants that any multi-provider calendar engine must uphold.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. An Event Time Is Not Always a UTC Timestamp
&lt;/h2&gt;

&lt;p&gt;Developers accustomed to backend event logs instinctively store every timestamp as UTC epoch milliseconds (&lt;code&gt;1794304800000&lt;/code&gt;) and add &lt;code&gt;86_400_000 * 7&lt;/code&gt; for a weekly series. In calendar systems, &lt;strong&gt;recurring human commitments are anchored to local wall-clock rules in a named IANA timezone&lt;/strong&gt;, not fixed SI-second intervals:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Every Tuesday at &lt;code&gt;09:00&lt;/code&gt; in &lt;code&gt;Europe/Sofia&lt;/code&gt;" means &lt;code&gt;09:00 EET (UTC+2)&lt;/code&gt; in January and &lt;code&gt;09:00 EEST (UTC+3)&lt;/code&gt; in July. Stepping by &lt;code&gt;604,800&lt;/code&gt; UTC seconds makes the summer meeting land at &lt;code&gt;10:00&lt;/code&gt; local time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Asymmetric Transatlantic Shift Weeks:&lt;/strong&gt; Between the second Sunday of March (when &lt;code&gt;America/New_York&lt;/code&gt; springs forward to &lt;code&gt;EDT&lt;/code&gt;, &lt;code&gt;UTC-4&lt;/code&gt;) and the last Sunday of March (when &lt;code&gt;Europe/London&lt;/code&gt; and &lt;code&gt;Europe/Sofia&lt;/code&gt; switch to summer time), New York and Europe are &lt;strong&gt;one hour closer&lt;/strong&gt; than usual for roughly two weeks. The reverse asymmetry happens between late October and early November.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Floating All-Day Dates (&lt;code&gt;VALUE=DATE&lt;/code&gt;):&lt;/strong&gt; Birthdays, public holidays, and multi-day travel banners carry calendar dates (&lt;code&gt;2026-11-14&lt;/code&gt;) without a timezone offset. Converting &lt;code&gt;2026-11-14T00:00:00Z&lt;/code&gt; into &lt;code&gt;America/Los_Angeles&lt;/code&gt; shifts a Saturday birthday back to Friday afternoon (&lt;code&gt;2026-11-13 16:00 PST&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Therefore, a multi-provider model must separate &lt;strong&gt;three distinct temporal representations&lt;/strong&gt; at the type level rather than forcing everything through &lt;code&gt;Date&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Temporal Kind&lt;/th&gt;
&lt;th&gt;Wire Examples (ICS / Graph / Google)&lt;/th&gt;
&lt;th&gt;Canonical In-Memory Representation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Fixed Instant&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;20261110T140000Z&lt;/code&gt; (one-off flight / webhook)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{ kind: "instant", epochMs: number }&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Zoned Wall-Clock&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;DTSTART;TZID=America/New_York:20260308T093000&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{ kind: "zoned", date: "YYYY-MM-DD", time: "HH:mm:ss", tzid: string }&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Floating Date (All-Day)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;DTSTART;VALUE=DATE:20261114&lt;/code&gt; (end exclusive)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{ kind: "allDay", startDate: "YYYY-MM-DD", endDateExclusive: "YYYY-MM-DD" }&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  2. Resolving Non-Existent ("Spring Forward") and Ambiguous ("Fall Back") Wall Clocks
&lt;/h2&gt;

&lt;p&gt;When expanding recurring rules (&lt;code&gt;RRULE&lt;/code&gt;) in a zone with daylight-saving transitions, local times can encounter two kinds of anomaly:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The Spring-Forward Gap (Non-Existent Local Time):&lt;/strong&gt; On spring transition morning in &lt;code&gt;Europe/Sofia&lt;/code&gt;, clocks jump directly from &lt;code&gt;02:59:59&lt;/code&gt; to &lt;code&gt;04:00:00&lt;/code&gt;. A recurring maintenance task or night-shift check-in scheduled at &lt;code&gt;03:30&lt;/code&gt; has zero valid instants on that date.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Fall-Back Fold (Ambiguous Local Time):&lt;/strong&gt; On autumn transition night, &lt;code&gt;03:00&lt;/code&gt;–&lt;code&gt;03:59&lt;/code&gt; occurs &lt;strong&gt;twice&lt;/strong&gt;—first in summer offset (&lt;code&gt;+03:00&lt;/code&gt;), then an hour later in standard offset (&lt;code&gt;+02:00&lt;/code&gt;).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://datatracker.ietf.org/doc/html/rfc5545#section-3.3.5" rel="noopener noreferrer"&gt;RFC 5545 §3.3.5&lt;/a&gt; resolves an explicit DATE-TIME using the first occurrence in a fold and the pre-transition offset in a gap, so Sofia &lt;code&gt;03:30&lt;/code&gt; maps to &lt;code&gt;04:30&lt;/code&gt; summer time. But for occurrences generated by an RRULE, &lt;a href="https://datatracker.ietf.org/doc/html/rfc5545#section-3.3.10" rel="noopener noreferrer"&gt;§3.3.10&lt;/a&gt; says invalid dates and nonexistent local times must be ignored and not counted. A recurrence expander must detect this gap instead of automatically moving every generated occurrence forward.&lt;/p&gt;

&lt;p&gt;The example below illustrates that distinction using the Temporal polyfill. It resolves one wall-clock value; a full recurrence engine also needs RRULE expansion, exceptions, and provider-specific behavior:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Temporal&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"@js-temporal/polyfill"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;WallTime&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;timeZone&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;year&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;hour&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;minute&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;second&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// An explicit DATE-TIME: earlier in a fold, pre-transition offset in a gap.&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;resolveExplicitDateTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fields&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;WallTime&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;local&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Temporal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;PlainDateTime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fields&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;overflow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"reject"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;local&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toZonedDateTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fields&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;timeZone&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;disambiguation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"compatible"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;epochMilliseconds&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// A generated RRULE occurrence: ignore an invalid date or a local-time gap.&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;resolveRecurrenceOccurrence&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fields&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;WallTime&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;local&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Temporal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;PlainDateTime&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;local&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Temporal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;PlainDateTime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fields&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;overflow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"reject"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nc"&gt;RangeError&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;zoned&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;local&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toZonedDateTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fields&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;timeZone&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;disambiguation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"compatible"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;zoned&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toPlainDateTime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;equals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;local&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;zoned&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;epochMilliseconds&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  3. Normalizing Windows Timezone IDs from Microsoft 365 / Exchange
&lt;/h2&gt;

&lt;p&gt;Here is a subtle multi-provider bug that bites every Outlook / Microsoft Graph integration: Google Calendar and Apple iCloud emit standard IANA identifiers (&lt;code&gt;Europe/Berlin&lt;/code&gt;, &lt;code&gt;America/Chicago&lt;/code&gt;), whereas Microsoft Exchange and Outlook invitations frequently emit &lt;strong&gt;Windows Timezone IDs&lt;/strong&gt; such as &lt;code&gt;"FLE Standard Time"&lt;/code&gt;, &lt;code&gt;"Romance Standard Time"&lt;/code&gt;, &lt;code&gt;"Eastern Standard Time"&lt;/code&gt;, or &lt;code&gt;"UTC+02"&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Even trickier, &lt;code&gt;"FLE Standard Time"&lt;/code&gt; stands for &lt;em&gt;Finland, Lithuania, Estonia&lt;/em&gt; (which observe DST!), despite containing the word &lt;code&gt;"Standard"&lt;/code&gt; in the identifier name. Passing &lt;code&gt;"FLE Standard Time"&lt;/code&gt; directly to &lt;code&gt;Intl.DateTimeFormat&lt;/code&gt; throws &lt;code&gt;RangeError: Invalid time zone specified&lt;/code&gt;. Maintaining a verified CLDR &lt;code&gt;windowsZones.xml&lt;/code&gt; mapping table (with territory overrides where applicable, and graceful fallback to parsed &lt;code&gt;VTIMEZONE&lt;/code&gt; rules on &lt;code&gt;.ics&lt;/code&gt; imports) prevents silent drops when rendering side-by-side work and personal calendars.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Horizon-Bounded Weather Joins and Widget Reload Budgets
&lt;/h2&gt;

&lt;p&gt;Overlaying live forecast conditions (such as Apple WeatherKit temperature, precipitation probability, and UV/wind advisories) onto calendar agenda rows introduces two architectural boundaries that UI code must communicate honestly:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Forecast Horizon Limits:&lt;/strong&gt; Hourly meteorological forecasts cover roughly 10 days; daily summaries extend slightly further, while calendar views let users scroll six months ahead. A calendar cell without weather badges at &lt;code&gt;T + 25 days&lt;/code&gt; means &lt;em&gt;beyond forecast horizon&lt;/em&gt;, not &lt;em&gt;clear skies&lt;/em&gt;. Moreover, all-day banners (&lt;code&gt;VALUE=DATE&lt;/code&gt;) require daily high/low summaries rather than a misleading midnight (&lt;code&gt;00:00&lt;/code&gt;) hourly reading.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;iOS WidgetKit Reload Quotas:&lt;/strong&gt; Home Screen and Lock Screen widgets do not execute live network polls every minute. The host app pre-computes a finite timeline of upcoming timed-event transitions (e.g., exact start/end boundaries over the next 12 hours) so the system advances the "Up Next" slot right when a meeting finishes—even while the app is suspended—reserving background push/fetch reloads for genuine schedule or forecast changes.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Checklist for Multi-Timezone Scheduling Systems
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Store &lt;code&gt;tzid&lt;/code&gt; + local wall-clock components alongside computed &lt;code&gt;startUtcMs&lt;/code&gt; / &lt;code&gt;endUtcMs&lt;/code&gt; query indexes so future IANA tzdata updates (when countries abolish or alter DST rules) can re-index cleanly.&lt;/li&gt;
&lt;li&gt;Always test overlap calculators across the &lt;strong&gt;March US/EU two-week DST mismatch window&lt;/strong&gt; (&lt;code&gt;2026-03-09&lt;/code&gt; to &lt;code&gt;2026-03-28&lt;/code&gt;), where standard 7-hour/6-hour mental shortcuts fail.&lt;/li&gt;
&lt;li&gt;Keep all-day &lt;code&gt;VALUE=DATE&lt;/code&gt; ranges timezone-independent from end to end.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can check multi-city meeting overlaps, DST transition shifts, and calendar feed diagnostics directly in your browser (zero login) at &lt;strong&gt;&lt;a href="https://www.cloud-calendars.com/tools/" rel="noopener noreferrer"&gt;www.cloud-calendars.com/tools/&lt;/a&gt;&lt;/strong&gt;, or explore multi-account iCloud, Google, and Outlook workflows at &lt;strong&gt;&lt;a href="https://cloud-calendars.arte-soft.com/" rel="noopener noreferrer"&gt;cloud-calendars.arte-soft.com&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>ios</category>
      <category>architecture</category>
      <category>testing</category>
    </item>
    <item>
      <title>Adaptive QUIC Datagrams (RFC 9221), L4S &amp; Automatic TCP 443 Fallback Inside Apple's NEPacketTunnelProvider</title>
      <dc:creator>mincho milev</dc:creator>
      <pubDate>Wed, 18 Nov 2026 01:53:57 +0000</pubDate>
      <link>https://dev.to/mincho_milev_c7753077d5af/adaptive-quic-datagrams-rfc-9221-l4s-automatic-tcp-443-fallback-inside-apples-1pan</link>
      <guid>https://dev.to/mincho_milev_c7753077d5af/adaptive-quic-datagrams-rfc-9221-l4s-automatic-tcp-443-fallback-inside-apples-1pan</guid>
      <description>&lt;p&gt;When building &lt;a href="https://vpn.arte-soft.com/" rel="noopener noreferrer"&gt;Wonek VPN&lt;/a&gt; (&lt;code&gt;id6831932522&lt;/code&gt;) natively for iPhone, iPad, and macOS using Apple's &lt;code&gt;NEPacketTunnelProvider&lt;/code&gt;, we wanted to solve two practical frustrations we kept hitting on travel Wi-Fi and cloud DevOps workflows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Fixed-port UDP VPNs (UDP 500/4500 IKEv2 or UDP 51820 WireGuard) routinely get dropped&lt;/strong&gt; on hotel, hospital, and university guest networks—while falling back to classic TCP-over-TCP tunnels introduces severe head-of-line blocking under 1–3% Wi-Fi packet loss.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Occasional travelers shouldn't have to sign up for an auto-renewing $13/month subscription&lt;/strong&gt; (or create yet another email/password account) just to encrypt two weeks of hotel and airport Wi-Fi.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is how we designed an adaptive &lt;strong&gt;QUIC Datagram (RFC 9221) + L4S -&amp;gt; Encrypted TCP 443/80&lt;/strong&gt; transport inside iOS's strict &lt;code&gt;&amp;lt;50 MB&lt;/code&gt; NetworkExtension memory ceiling, alongside &lt;a href="https://vpn.arte-soft.com/tools/" rel="noopener noreferrer"&gt;12 zero-signup client-side network calculators&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Racing QUIC Datagrams on UDP 443 With Automatic WSS:443 &amp;amp; TLS:80 Fallback
&lt;/h2&gt;

&lt;p&gt;Instead of forcing users to dig into Settings to toggle between UDP and TCP when a captive guest VLAN drops raw IPsec/WireGuard ports, our Automatic transport races standard web ports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Primary path (&lt;code&gt;0 ms&lt;/code&gt;):&lt;/strong&gt; &lt;a href="https://vpn.arte-soft.com/articles/quic-datagrams-rfc-9221-prevent-head-of-line-blocking/" rel="noopener noreferrer"&gt;QUIC Datagrams (RFC 9221)&lt;/a&gt; over &lt;strong&gt;UDP 443&lt;/strong&gt; (the exact port used by HTTP/3) paired with &lt;a href="https://vpn.arte-soft.com/articles/apple-l4s-low-latency-low-loss-vpn-jitter-explained/" rel="noopener noreferrer"&gt;Apple L4S&lt;/a&gt; ECN-aware pacing. Each inner IPv4 packet travels as an independent TLS 1.3-authenticated datagram—so a dropped background download frame never stalls concurrent SSH keystrokes or FaceTime audio.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fallback 1 (&lt;code&gt;+700 ms&lt;/code&gt;):&lt;/strong&gt; If UDP 443 is blocked, the racer opens pinned inner-TLS over &lt;strong&gt;TCP 443 (&lt;code&gt;WSS&lt;/code&gt;)&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fallback 2 (&lt;code&gt;+1,400 ms&lt;/code&gt;):&lt;/strong&gt; On heavily shaped guest portals, pinned inner-TLS over &lt;strong&gt;TCP 80&lt;/strong&gt; provides a secondary path while probing periodically to return to QUIC when UDP clears.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can model the exact p99 latency difference between TCP-over-TCP retransmission stalls and independent QUIC datagrams at any RTT and loss percentage in our &lt;a href="https://vpn.arte-soft.com/tools/quic-vs-tcp-latency-calculator/" rel="noopener noreferrer"&gt;Interactive QUIC vs TCP VPN Latency Simulator&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Cryptographic StoreKit &lt;code&gt;appTransactionId&lt;/code&gt; Sync &amp;amp; &lt;code&gt;/32&lt;/code&gt; Static IPv4 Allowlists
&lt;/h2&gt;

&lt;p&gt;Rather than collecting emails and passwords, entitlements sync across iPhone, iPad, and Mac via Apple's signed &lt;code&gt;appTransactionId&lt;/code&gt;—supporting both &lt;strong&gt;non-renewing one-time GO data packs&lt;/strong&gt; (30 GB / 31 days or 100 GB / 92 days) and &lt;strong&gt;Dedicated Static IPv4&lt;/strong&gt; reservations for &lt;a href="https://vpn.arte-soft.com/articles/aws-security-group-iam-lockdown-dedicated-ipv4-vpn/" rel="noopener noreferrer"&gt;locking AWS Security Groups, SSH (&lt;code&gt;ufw&lt;/code&gt;), and PostgreSQL (&lt;code&gt;pg_hba.conf&lt;/code&gt;) to a portable &lt;code&gt;/32&lt;/code&gt; address&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Explore all 12 client-side networking calculators at &lt;a href="https://vpn.arte-soft.com/tools/" rel="noopener noreferrer"&gt;vpn.arte-soft.com/tools/&lt;/a&gt;—including the &lt;a href="https://vpn.arte-soft.com/tools/vpn-mtu-overhead-calculator/" rel="noopener noreferrer"&gt;VPN MTU &amp;amp; MSS Calculator&lt;/a&gt; and &lt;a href="https://vpn.arte-soft.com/tools/vpn-pack-vs-subscription-calculator/" rel="noopener noreferrer"&gt;One-Time Pack vs Subscription Cost Calculator&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>ios</category>
      <category>macos</category>
      <category>networking</category>
      <category>security</category>
    </item>
    <item>
      <title>Zero-Upload Browser Media Tools &amp; Native iOS PiP Screen Recording With ReplayKit and ScreenCaptureKit</title>
      <dc:creator>mincho milev</dc:creator>
      <pubDate>Tue, 17 Nov 2026 23:25:12 +0000</pubDate>
      <link>https://dev.to/mincho_milev_c7753077d5af/zero-upload-browser-media-tools-native-ios-pip-screen-recording-with-replaykit-and-1ch0</link>
      <guid>https://dev.to/mincho_milev_c7753077d5af/zero-upload-browser-media-tools-native-ios-pip-screen-recording-with-replaykit-and-1ch0</guid>
      <description>&lt;p&gt;When building &lt;a href="https://reel-studio.arte-soft.com/" rel="noopener noreferrer"&gt;Reel: Screen Recorder Face Cam&lt;/a&gt; (&lt;code&gt;id6758941990&lt;/code&gt;) across iPhone, iPad, and macOS, we kept running into two stubborn engineering problems that trip up creators every day:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;On iOS&lt;/strong&gt;, Apple sandboxes apps so strictly that standard screen recorders cannot keep a selfie camera visible once you swipe out to demonstrate Safari, Xcode builds, or a 60fps game.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;On the Web&lt;/strong&gt;, developers who just want to convert a 600 MB QuickTime &lt;code&gt;.mov&lt;/code&gt; screen capture to &lt;code&gt;.mp4&lt;/code&gt;, check their microphone dBFS clipping, or trim two seconds off a bug report get funneled into upload-heavy websites that ship confidential screen footage to remote cloud buckets.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is how we solved both—first in native Swift with &lt;code&gt;AVPictureInPictureController&lt;/code&gt; + &lt;code&gt;ReplayKit&lt;/code&gt; / &lt;code&gt;ScreenCaptureKit&lt;/code&gt;, and second by shipping &lt;a href="https://reel-studio.arte-soft.com/tools/" rel="noopener noreferrer"&gt;12 zero-upload client-side browser creator tools&lt;/a&gt; that run 100% in local RAM.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Keeping a Live Camera Over Other Apps on iOS (&lt;code&gt;AVPictureInPictureController&lt;/code&gt; + &lt;code&gt;ReplayKit&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;Apple's built-in Control Center recorder captures the framebuffer and app audio, but has no camera pipeline. Meanwhile, third-party apps that draw a &lt;code&gt;UIView&lt;/code&gt; camera preview lose visibility the millisecond &lt;code&gt;sceneDidEnterBackground&lt;/code&gt; fires.&lt;/p&gt;

&lt;p&gt;The sanctioned path on modern iOS is pairing &lt;strong&gt;multitasking camera access&lt;/strong&gt; with a video-call style &lt;code&gt;AVPictureInPictureController&lt;/code&gt; source while a &lt;code&gt;RPSystemBroadcastPickerView&lt;/code&gt; / ReplayKit session captures the composited screen:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Because iOS composites the system Picture-in-Picture window above the foreground application, ReplayKit records the target app, the live draggable camera bubble, internal app audio, and microphone audio into &lt;strong&gt;one finished MP4&lt;/strong&gt; without a second post-production pass.&lt;/li&gt;
&lt;li&gt;We documented the exact step-by-step user behavior and edge cases (such as &lt;code&gt;CallKit&lt;/code&gt; VoIP muting and &lt;code&gt;UIScreen.isCaptured&lt;/code&gt; rules) in our guide on &lt;a href="https://reel-studio.arte-soft.com/articles/keep-camera-on-over-other-apps-iphone/" rel="noopener noreferrer"&gt;keeping your camera on over other apps while screen recording on iPhone&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On macOS, &lt;code&gt;ScreenCaptureKit&lt;/code&gt; solves the opposite classic pain point—&lt;a href="https://reel-studio.arte-soft.com/articles/quicktime-screen-recording-no-audio-mac-fix/" rel="noopener noreferrer"&gt;QuickTime screen recordings having no internal system audio&lt;/a&gt;—by delivering 48 kHz desktop audio frames directly alongside &lt;code&gt;VideoToolbox&lt;/code&gt; hardware H.264/HEVC encoding at 30, 60, or 120 fps without virtual audio drivers like BlackHole.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Zero-Upload &lt;code&gt;.MOV&lt;/code&gt; -&amp;gt; &lt;code&gt;.MP4&lt;/code&gt; &amp;amp; GIF89a Encoding in Pure Client-Side JavaScript
&lt;/h2&gt;

&lt;p&gt;Not every task needs an installed app, yet uploading private engineering PR demos to third-party converter servers violates most company NDAs. Modern browser APIs (&lt;code&gt;HTMLCanvasElement.captureStream&lt;/code&gt;, &lt;code&gt;AudioContext.createMediaStreamDestination&lt;/code&gt;, and &lt;code&gt;MediaRecorder&lt;/code&gt; supporting &lt;code&gt;video/mp4;codecs=avc1&lt;/code&gt; in Safari and Chromium 126+) make zero-upload media utilities surprisingly compact:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Route &amp;lt;video&amp;gt; audio + scaled &amp;lt;canvas&amp;gt; frames into a local MP4 MediaRecorder&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;canvasStream&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;captureStream&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;audioCtx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;AudioContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;sourceNode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;audioCtx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createMediaElementSource&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;videoEl&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;destNode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;audioCtx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createMediaStreamDestination&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;sourceNode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;destNode&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;destNode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getAudioTracks&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;canvasStream&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addTrack&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;recorder&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;MediaRecorder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;canvasStream&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;mimeType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'video/mp4;codecs=avc1.42E01E,mp4a.40.2'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;videoBitsPerSecond&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2_500_000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// e.g., target &amp;lt;10 MB for GitHub PR inline video&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We packaged twelve of these 100% client-side, zero-upload tools at &lt;a href="https://reel-studio.arte-soft.com/tools/" rel="noopener noreferrer"&gt;reel-studio.arte-soft.com/tools/&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://reel-studio.arte-soft.com/tools/mov-to-mp4-converter/" rel="noopener noreferrer"&gt;In-Browser QuickTime &lt;code&gt;.MOV&lt;/code&gt; to &lt;code&gt;.MP4&lt;/code&gt; Converter&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reel-studio.arte-soft.com/tools/compress-video-for-discord/" rel="noopener noreferrer"&gt;Target-Bitrate Video Compressor for Discord &amp;amp; GitHub PRs (&amp;lt;10 MB)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reel-studio.arte-soft.com/tools/video-to-gif/" rel="noopener noreferrer"&gt;Pure-JS GIF89a LZW Video-to-GIF Encoder&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://reel-studio.arte-soft.com/tools/app-store-preview-checker/" rel="noopener noreferrer"&gt;App Store Connect Preview Video Dimension &amp;amp; Duration Validator&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://reel-studio.arte-soft.com/tools/webcam-facecam-test/" rel="noopener noreferrer"&gt;Live Webcam PiP Shape &amp;amp; Luma Check&lt;/a&gt; and &lt;a href="https://reel-studio.arte-soft.com/tools/microphone-audio-test/" rel="noopener noreferrer"&gt;Web Audio dBFS Clipping Meter&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every byte stays inside &lt;code&gt;Blob&lt;/code&gt; URLs in your own tab, and when you need full system-wide iOS Picture-in-Picture or 120fps Apple Silicon capture, &lt;a href="https://apps.apple.com/us/app/reel-screen-recorder-face-cam/id6758941990" rel="noopener noreferrer"&gt;Reel&lt;/a&gt; picks up right where the browser sandbox stops.&lt;/p&gt;

</description>
      <category>ios</category>
      <category>macos</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Implementing 207 Excel Financial and Statistical Formulas in Client-Side JavaScript Without IEEE-754 Traps</title>
      <dc:creator>mincho milev</dc:creator>
      <pubDate>Mon, 16 Nov 2026 14:00:09 +0000</pubDate>
      <link>https://dev.to/mincho_milev_c7753077d5af/implementing-207-excel-financial-and-statistical-formulas-in-client-side-javascript-without-4l5o</link>
      <guid>https://dev.to/mincho_milev_c7753077d5af/implementing-207-excel-financial-and-statistical-formulas-in-client-side-javascript-without-4l5o</guid>
      <description>&lt;p&gt;Shipping basic spreadsheet arithmetic (&lt;code&gt;SUM&lt;/code&gt;, &lt;code&gt;AVERAGE&lt;/code&gt;, &lt;code&gt;IF&lt;/code&gt;, &lt;code&gt;VLOOKUP&lt;/code&gt;) in JavaScript takes an afternoon. Scaling that evaluator to &lt;strong&gt;207 Excel-compatible functions&lt;/strong&gt;—including irregular cash-flow discounting (&lt;code&gt;XNPV&lt;/code&gt;, &lt;code&gt;XIRR&lt;/code&gt;), amortization schedules (&lt;code&gt;PMT&lt;/code&gt;, &lt;code&gt;IPMT&lt;/code&gt;, &lt;code&gt;PPMT&lt;/code&gt;, &lt;code&gt;CUMIPMT&lt;/code&gt;), sample vs. population moments (&lt;code&gt;STDEV.S&lt;/code&gt;, &lt;code&gt;SKEW&lt;/code&gt;, &lt;code&gt;KURT&lt;/code&gt;), quantile interpolation (&lt;code&gt;PERCENTILE.INC&lt;/code&gt;, &lt;code&gt;PERCENTILE.EXC&lt;/code&gt;), and Student's $t$ / $F$ tail probabilities—exposes every sharp corner of IEEE-754 double-precision floating-point numbers.&lt;/p&gt;

&lt;p&gt;When expanding the Web Worker calculation engine behind &lt;strong&gt;&lt;a href="https://sheets.arte-soft.com/" rel="noopener noreferrer"&gt;Arte Sheets&lt;/a&gt;&lt;/strong&gt; and its &lt;strong&gt;&lt;a href="https://sheets.arte-soft.com/en/courses/" rel="noopener noreferrer"&gt;22 guided spreadsheet courses&lt;/a&gt;&lt;/strong&gt;, we found that textbook mathematical definitions routinely fail on real &lt;code&gt;.xlsx&lt;/code&gt; financial models. Below are the four engineering boundaries that separate a toy formula parser from a reliable client-side numerical engine.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Decimal Display Hygiene vs. Binary Floating-Point Drift
&lt;/h2&gt;

&lt;p&gt;Every JavaScript number is an IEEE-754 binary64 float with 53 bits of significand (~15–17 significant decimal digits). In a financial budget grid, a user who enters &lt;code&gt;=0.1 + 0.2 - 0.3&lt;/code&gt; expects &lt;code&gt;0&lt;/code&gt;, not &lt;code&gt;5.551115123125783e-17&lt;/code&gt;. Worse, if a downstream &lt;code&gt;IF(B12 = 0, "Balanced", "Variance")&lt;/code&gt; compares that residual against zero, naive binary64 arithmetic flips the branch and breaks ledger reconciliation.&lt;/p&gt;

&lt;p&gt;Desktop spreadsheets rely on two complementary safeguards that browser engines should replicate:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;15-Significant-Digit Snapping at Comparison and Display Boundaries:&lt;/strong&gt; Keep IEEE-754 &lt;code&gt;number&lt;/code&gt; primitives on the hot path (avoiding the 20x slowdown of arbitrary-precision objects) and normalize near-zero cancellation noise when evaluating &lt;code&gt;=&lt;/code&gt; comparisons or formatting cell strings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Neumaier Compensated Summation for Large Ranges:&lt;/strong&gt; When &lt;code&gt;SUM&lt;/code&gt; or &lt;code&gt;SUMIFS&lt;/code&gt; aggregates thousands of rows mixing large balances with cent-level adjustments, compensated addition preserves low-order bits:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;neumaierSum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;compensation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;values&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;compensation&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;compensation&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;compensation&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On synthetic 50,000-row alternating-magnitude ledgers (&lt;code&gt;+1e9&lt;/code&gt;, &lt;code&gt;0.01&lt;/code&gt; repeated, &lt;code&gt;-1e9&lt;/code&gt;), naive &lt;code&gt;Array.prototype.reduce&lt;/code&gt; drifts by several dollars, while &lt;code&gt;neumaierSum&lt;/code&gt; recovers the exact cent total in under 0.4 milliseconds inside a Web Worker.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Root-Finding for &lt;code&gt;IRR&lt;/code&gt; and &lt;code&gt;XIRR&lt;/code&gt;: Why Pure Newton–Raphson Diverges
&lt;/h2&gt;

&lt;p&gt;Internal Rate of Return (&lt;code&gt;IRR&lt;/code&gt; for periodic cash flows and &lt;code&gt;XIRR&lt;/code&gt; for irregular calendar dates) solves for the discount rate $r &amp;gt; -1$ where Net Present Value equals zero:&lt;/p&gt;

&lt;p&gt;$$\mathrm{XNPV}(r) = \sum_{i=0}^{n-1} \frac{C_i}{(1 + r)^{(d_i - d_0)/365}} = 0$$&lt;/p&gt;

&lt;p&gt;Most JavaScript helpers run pure Newton–Raphson from &lt;code&gt;guess = 0.1&lt;/code&gt;, which diverges in three common corporate-finance cases:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Steep Negative Returns (&lt;code&gt;-0.95 &amp;lt; r &amp;lt; -0.5&lt;/code&gt;):&lt;/strong&gt; Large derivatives near $r \to -1^+$ push the next step below &lt;code&gt;-1.0&lt;/code&gt;, turning fractional exponents $(1 + r)^{\Delta t}$ into &lt;code&gt;NaN&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Long-Horizon Plateaus:&lt;/strong&gt; Tiny derivatives on 30-year schedules catapult &lt;code&gt;rNext&lt;/code&gt; to &lt;code&gt;1e8&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Missing Sign Change:&lt;/strong&gt; Cash flows without at least one positive and one negative entry have no real root and must return &lt;code&gt;#NUM!&lt;/code&gt; immediately.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A resilient solver pairs &lt;strong&gt;domain-clamped Newton steps&lt;/strong&gt; with &lt;strong&gt;bracketed bisection fallback&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;solveXirr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cashFlows&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dayOffsets&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;guess&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;hasPos&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;hasNeg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;cf&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;cashFlows&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cf&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;hasPos&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cf&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;hasNeg&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;hasPos&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;hasNeg&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"#NUM!"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;fAndDf&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;rate&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;base&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mf"&gt;1e-12&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;Infinity&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="kc"&gt;Infinity&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;cashFlows&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;years&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dayOffsets&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;365.0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;denom&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;years&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;cashFlows&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;denom&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;years&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;-=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;years&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;cashFlows&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;denom&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// Phase 1: Safeguarded Newton-Raphson from caller's guess&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;0.99&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;guess&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;100.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;iter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;iter&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;iter&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;fAndDf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mf"&gt;1e-9&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isFinite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mf"&gt;1e-14&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;next&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;0.999999&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mf"&gt;0.999999&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;next&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mf"&gt;1e-11&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;next&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;next&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Phase 2: Bracket scan + bisection polish&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;grid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;0.95&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;0.75&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;0.25&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.05&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.25&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prevR&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prevF&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;fAndDf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prevR&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;currR&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;currF&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;fAndDf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;currR&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prevF&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;currF&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;lo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;prevR&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;currR&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fLo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;prevF&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lo&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;hi&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fMid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;fAndDf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mid&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fMid&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mf"&gt;1e-10&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hi&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;lo&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mf"&gt;1e-12&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fLo&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;fMid&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;hi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;lo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;fLo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fMid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lo&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;hi&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;prevR&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;currR&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;prevF&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;currF&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"#NUM!"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  3. Single-Pass Welford Moments for &lt;code&gt;VAR.S&lt;/code&gt;, &lt;code&gt;STDEV.S&lt;/code&gt;, &lt;code&gt;SKEW&lt;/code&gt;, and &lt;code&gt;KURT&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Statistical formulas are equally treacherous when implemented from textbook two-pass or naive sum-of-squares identities. Computing variance as $\frac{1}{n-1}(\sum x_i^2 - \frac{1}{n}(\sum x_i)^2)$ suffers catastrophic cancellation whenever the standard deviation is small relative to the mean—for instance, measuring basis-point yield fluctuations around &lt;code&gt;100,000.00&lt;/code&gt; can even yield a &lt;strong&gt;negative&lt;/strong&gt; variance and throw &lt;code&gt;NaN&lt;/code&gt; inside &lt;code&gt;Math.sqrt()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Welford's online algorithm updates the running mean $M_1$ and centered sums of powers ($M_2, M_3, M_4$) in a single numerically stable pass while filtering out booleans, empty cells, and text strings according to spreadsheet type-coercion rules (&lt;code&gt;STDEV.S&lt;/code&gt; ignores text in range references, whereas &lt;code&gt;STDEVA&lt;/code&gt; coerces &lt;code&gt;TRUE -&amp;gt; 1&lt;/code&gt; and text &lt;code&gt;-&amp;gt; 0&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;welfordVariance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;isSample&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;mean&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;m2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;delta&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;mean&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;delta&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;delta2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;m2&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;delta&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;delta2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;dof&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;isSample&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dof&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"#DIV/0!"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;m2&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;dof&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  4. Type Coercion &amp;amp; Error Propagation Contract Across 207 Functions
&lt;/h2&gt;

&lt;p&gt;Expanding from core arithmetic to 207 Excel-compatible functions requires enforcing uniform argument semantics so nested expressions like &lt;code&gt;=IFERROR(INDEX(A2:F500, XMATCH(H2, A2:A500, 0), 4), 0)&lt;/code&gt; behave deterministically:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Boundary Rule&lt;/th&gt;
&lt;th&gt;Naive JS Evaluator Behavior&lt;/th&gt;
&lt;th&gt;Spreadsheet-Compatible Engine Behavior&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;First-Error Propagation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Coerces &lt;code&gt;NaN&lt;/code&gt; to &lt;code&gt;0&lt;/code&gt; or &lt;code&gt;"NaN"&lt;/code&gt; string&lt;/td&gt;
&lt;td&gt;Propagates first &lt;code&gt;#N/A&lt;/code&gt;, &lt;code&gt;#VALUE!&lt;/code&gt;, &lt;code&gt;#REF!&lt;/code&gt;, &lt;code&gt;#DIV/0!&lt;/code&gt;, or &lt;code&gt;#NUM!&lt;/code&gt; unless caught by &lt;code&gt;IFERROR&lt;/code&gt; / &lt;code&gt;IFNA&lt;/code&gt; / &lt;code&gt;ISERROR&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Range vs. Direct Scalar Args&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Treats &lt;code&gt;SUM("5", A1:A3)&lt;/code&gt; identically&lt;/td&gt;
&lt;td&gt;Direct scalar &lt;code&gt;"5"&lt;/code&gt; coerces to &lt;code&gt;5&lt;/code&gt;; string &lt;code&gt;"5"&lt;/code&gt; inside range &lt;code&gt;A1:A3&lt;/code&gt; is ignored by &lt;code&gt;SUM&lt;/code&gt; / &lt;code&gt;AVERAGE&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Annuity Sign Convention (&lt;code&gt;PMT&lt;/code&gt;, &lt;code&gt;FV&lt;/code&gt;, &lt;code&gt;PV&lt;/code&gt;)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Positive payment for positive principal&lt;/td&gt;
&lt;td&gt;Cash-flow sign symmetry: borrowing &lt;code&gt;+100,000&lt;/code&gt; yields negative periodic &lt;code&gt;PMT&lt;/code&gt; outflow&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Zero-Rate Annuity Edge Case&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Divides by &lt;code&gt;rate = 0&lt;/code&gt; -&amp;gt; &lt;code&gt;#DIV/0!&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Continuous limit branch: when &lt;code&gt;rate === 0&lt;/code&gt;, &lt;code&gt;PMT = -(pv + fv) / nper&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Quantile Exclusivity (&lt;code&gt;PERCENTILE.EXC&lt;/code&gt;)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Clamps $k \in [0, 1]$ silently&lt;/td&gt;
&lt;td&gt;Rejects $k \le \frac{1}{n+1}$ or $k \ge \frac{n}{n+1}$ with &lt;code&gt;#NUM!&lt;/code&gt; per Excel specification&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Practical Takeaways for Browser Data Engines
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Test edge limits, not just happy-path textbook inputs.&lt;/strong&gt; Every annuity function (&lt;code&gt;PMT&lt;/code&gt;, &lt;code&gt;IPMT&lt;/code&gt;, &lt;code&gt;PPMT&lt;/code&gt;, &lt;code&gt;PV&lt;/code&gt;, &lt;code&gt;FV&lt;/code&gt;, &lt;code&gt;NPER&lt;/code&gt;) needs explicit &lt;code&gt;rate === 0&lt;/code&gt;, &lt;code&gt;type === 1&lt;/code&gt; (annuity-due), and negative-rate unit tests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep statistical distributions dependency-free.&lt;/strong&gt; Regularized incomplete gamma and continued-fraction incomplete beta (Lentz's method) cover normal, Student-$t$, $\chi^2$, and $F$ distributions in ~180 lines of pure TypeScript with zero WASM cold-start penalty.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pair engine documentation with runnable workbooks.&lt;/strong&gt; Users trust formulas they can inspect and perturb live in the browser without creating an account.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can test the 207-formula Web Worker engine right in your browser (zero sign-up) at &lt;strong&gt;&lt;a href="https://sheets.arte-soft.com/" rel="noopener noreferrer"&gt;sheets.arte-soft.com&lt;/a&gt;&lt;/strong&gt;, or work through structured financial, statistical, lookup, and variance-bridge lessons across our &lt;strong&gt;&lt;a href="https://sheets.arte-soft.com/en/courses/" rel="noopener noreferrer"&gt;22 guided spreadsheet courses&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>algorithms</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Building a Local-First AI Video Pipeline on Apple Silicon: Whisper, Qwen/Gemma &amp; Maya1 TTS</title>
      <dc:creator>mincho milev</dc:creator>
      <pubDate>Fri, 13 Nov 2026 14:00:06 +0000</pubDate>
      <link>https://dev.to/mincho_milev_c7753077d5af/building-a-local-first-ai-video-pipeline-on-apple-silicon-whisper-qwengemma-maya1-tts-27pc</link>
      <guid>https://dev.to/mincho_milev_c7753077d5af/building-a-local-first-ai-video-pipeline-on-apple-silicon-whisper-qwengemma-maya1-tts-27pc</guid>
      <description>&lt;p&gt;If you edit long-form podcasts, tutorials, or multi-channel YouTube videos on an M-series Mac, browser-based AI video editors introduce an ironic bottleneck: your laptop sits idle with a 16-core Neural Engine and unified high-bandwidth memory while you wait 20 minutes uploading gigabytes of 4K ProRes/HEVC footage to a remote server—only to burn monthly "AI minutes" every time you fix a typo in a subtitle or re-time a clip.&lt;/p&gt;

&lt;p&gt;When we built &lt;strong&gt;&lt;a href="https://studio.wonek.com/" rel="noopener noreferrer"&gt;Wonek Video Studio for macOS&lt;/a&gt;&lt;/strong&gt; (&lt;a href="https://apps.apple.com/us/app/wonek-video-studio/id6761376446?pt=127093297&amp;amp;ct=article_wonek_studio&amp;amp;mt=12" rel="noopener noreferrer"&gt;Mac App Store&lt;/a&gt;), we set a strict architectural rule: &lt;strong&gt;every repeatable post-production task—speech recognition, audio denoising, highlight detection, subtitle translation, and voiceover synthesis—must run locally on Apple Silicon with zero cloud credit meters.&lt;/strong&gt; And when a creator genuinely wants frontier cloud video generation, they should be able to plug in their own API keys (BYOK) at raw provider cost.&lt;/p&gt;

&lt;p&gt;Here is how the media and inference pipeline fits together natively on macOS.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Decoupling Audio Extraction from Multi-Track Timeline Playback
&lt;/h2&gt;

&lt;p&gt;A common mistake in desktop AI editors is running transcription or denoising directly against timeline video assets, locking file handles or starving real-time preview decoding.&lt;/p&gt;

&lt;p&gt;On macOS, &lt;code&gt;AVFoundation&lt;/code&gt; and &lt;code&gt;VideoToolbox&lt;/code&gt; decode H.264, HEVC, and ProRes in dedicated hardware media engines—leaving CPU performance cores and GPU/ANE compute free if you extract a lightweight mono PCM stream first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[4K HEVC / ProRes Source]
   ├──► VideoToolbox Hardware Decode ──► Real-Time J-K-L Multi-Track Timeline
   └──► 16 kHz / 48 kHz Mono PCM Stream
          ├──► DeepFilterNet (Local Noise Cleanup @ 48 kHz)
          └──► Local Whisper ASR (Word-Level Timestamps @ 16 kHz)
                 └──► Local Qwen / Gemma LLM
                        ├──► Auto Clips (Topic &amp;amp; Hook Scoring)
                        └──► Context-Aware Subtitle Translation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because Whisper only needs a 16 kHz mono audio buffer (~1.9 MB per minute of audio), extracting audio from a 6 GB hour-long 4K recording takes seconds locally—versus uploading 6 GB over residential upstream bandwidth before a browser SaaS editor can even begin transcribing.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Word-Level Whisper Timestamps + Local Qwen/Gemma Highlight Cutting
&lt;/h2&gt;

&lt;p&gt;Cutting vertical 9:16 Shorts, Reels, and TikToks from a 60-minute recording requires two distinct signals that fail if you conflate them:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Acoustic timing precision (millisecond boundaries):&lt;/strong&gt; Handled by local &lt;strong&gt;Whisper&lt;/strong&gt; models producing word-level token timestamps so animated captions never drift mid-syllable and cuts never clip the first consonant of a sentence.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Semantic hook &amp;amp; payoff detection:&lt;/strong&gt; Handled by quantized local &lt;strong&gt;Qwen / Gemma&lt;/strong&gt; models running on Apple Silicon unified memory. Instead of feeding raw transcripts blindly into an expensive cloud prompt, we chunk transcript windows aligned to natural pause boundaries (&lt;code&gt;&amp;gt;= 350 ms&lt;/code&gt; silence gaps), score self-contained segments for standalone clarity, and snap cut points back to exact PCM frame boundaries.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The same local LLM pass powers &lt;strong&gt;subtitle translation&lt;/strong&gt;: translating full sentence windows alongside neighboring context avoids the broken literal idioms you get when translating 3-word subtitle cards in isolation.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. On-Device Voiceovers with Local Maya1 TTS (Zero Per-Character Fees)
&lt;/h2&gt;

&lt;p&gt;Faceless channels, tutorial updates, and localized videos constantly iterate on narration scripts. With cloud TTS APIs, re-generating a 10-minute narration five times while tweaking pacing burns 35,000+ characters of quota and forces manual &lt;code&gt;.mp3&lt;/code&gt; download-and-reimport loops.&lt;/p&gt;

&lt;p&gt;Integrating &lt;strong&gt;Maya1 Text-to-Speech&lt;/strong&gt; directly inside the macOS studio changes voiceover from an external asset import into a live timeline primitive:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Slideshow Studio &amp;amp; Bulk Video:&lt;/strong&gt; Scripted segments synthesize directly onto timeline audio lanes with exact duration metadata, automatically driving slide transitions and burned-in caption timing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero round-trip files:&lt;/strong&gt; Edit one sentence in a paragraph, regenerate just that cue locally on Apple Silicon, and ripple-update the timeline lane immediately.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  4. Hybrid BYOK for Heavy Cloud Video Generation
&lt;/h2&gt;

&lt;p&gt;Local Apple Silicon models excel at ASR, audio cleanup, text intelligence, and TTS—but when a creator wants heavy text-to-video B-roll generation (such as &lt;strong&gt;Google Veo 3.1&lt;/strong&gt;, &lt;strong&gt;LTX&lt;/strong&gt;, or &lt;strong&gt;OpenAI&lt;/strong&gt; image/video models), wrapping those APIs in a 3x–5x SaaS credit markup punishes heavy users.&lt;/p&gt;

&lt;p&gt;Instead, we built a &lt;strong&gt;Bring Your Own Key (BYOK)&lt;/strong&gt; provider layer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;API keys stay locally on your Mac (zero vendor proxy servers, zero analytics, zero user account wall).&lt;/li&gt;
&lt;li&gt;Generated clips download straight into the local &lt;strong&gt;Creator Channel Asset Library&lt;/strong&gt;, tagged and ready for 4K ProRes or HEVC export, &lt;strong&gt;39-layout Thumbnail Studio&lt;/strong&gt; composition, and direct YouTube publishing.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Architecture Comparison: Browser Credit SaaS vs. Native Apple Silicon Studio
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Workflow Stage&lt;/th&gt;
&lt;th&gt;Browser AI Video SaaS (OpusClip / VEED / Captions)&lt;/th&gt;
&lt;th&gt;Wonek Video Studio on macOS (&lt;code&gt;studio.wonek.com&lt;/code&gt;)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Source Media Ingestion&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Upload multi-GB video to cloud bucket first&lt;/td&gt;
&lt;td&gt;Instant local disk read via &lt;code&gt;AVFoundation&lt;/code&gt; / &lt;code&gt;VideoToolbox&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Subtitles &amp;amp; Word Timing&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Metered monthly cloud transcription minutes&lt;/td&gt;
&lt;td&gt;Local Whisper on Apple Silicon (offline, unlimited)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Auto Clips &amp;amp; Translation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Cloud LLM credits per processed video&lt;/td&gt;
&lt;td&gt;Local Qwen / Gemma inference on unified memory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Voiceover Synthesis (TTS)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Per-character cloud voice quota&lt;/td&gt;
&lt;td&gt;Built-in local Maya1 TTS directly on timeline&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Generative Video B-Roll&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Proprietary non-refundable credit packs&lt;/td&gt;
&lt;td&gt;Direct BYOK (Veo 3.1, LTX, OpenAI) at raw API cost&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Export Codecs&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Re-encoded browser H.264 MP4&lt;/td&gt;
&lt;td&gt;Native hardware HEVC, H.264 &amp;amp; Apple ProRes up to 4K&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Account &amp;amp; Telemetry&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Mandatory cloud login &amp;amp; project hosting&lt;/td&gt;
&lt;td&gt;Zero user account, zero ads, zero analytics&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Practical Lessons Building Local AI Media Apps on macOS
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Unified Memory is a superpower—if you serialize model lifecycles.&lt;/strong&gt; Don't keep Whisper, a 4-bit LLM, and a TTS model resident in VRAM simultaneously when running batch jobs on 16 GB Macs. Run staged passes (ASR → unload → LLM clip/translate → unload → TTS/encode) so peak memory stays predictable alongside 4K video composition.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Snap semantic cuts to acoustic silence.&lt;/strong&gt; LLM token timestamps alone feel jarring; snapping cut-in and cut-out points to short local RMS energy troughs produces natural broadcast edits without manual audio fades.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep project files plain and local.&lt;/strong&gt; Creators hate getting locked out of past edits when pausing a SaaS plan. Even on the free tier of Wonek Video Studio, the multi-track editor, DeepFilterNet noise cleanup, and BYOK generation work locally without an account.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Explore the full macOS workflow guides at &lt;strong&gt;&lt;a href="https://studio.wonek.com/guides" rel="noopener noreferrer"&gt;studio.wonek.com/guides&lt;/a&gt;&lt;/strong&gt;, side-by-side benchmarks against 30 video editors at &lt;strong&gt;&lt;a href="https://studio.wonek.com/compare" rel="noopener noreferrer"&gt;studio.wonek.com/compare&lt;/a&gt;&lt;/strong&gt;, or download &lt;strong&gt;&lt;a href="https://apps.apple.com/us/app/wonek-video-studio/id6761376446?pt=127093297&amp;amp;ct=article_wonek_studio&amp;amp;mt=12" rel="noopener noreferrer"&gt;Wonek Video Studio on the Mac App Store&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>macos</category>
      <category>ai</category>
      <category>swift</category>
      <category>video</category>
    </item>
    <item>
      <title>Testing Photo + Voice AI on a Multi-Connection Train Timetable: What Worked (and What Still Needs a Human Check)</title>
      <dc:creator>mincho milev</dc:creator>
      <pubDate>Mon, 09 Nov 2026 22:29:14 +0000</pubDate>
      <link>https://dev.to/mincho_milev_c7753077d5af/testing-photo-voice-ai-on-a-multi-connection-train-timetable-what-worked-and-what-still-needs-a-2b9p</link>
      <guid>https://dev.to/mincho_milev_c7753077d5af/testing-photo-voice-ai-on-a-multi-connection-train-timetable-what-worked-and-what-still-needs-a-2b9p</guid>
      <description>&lt;p&gt;You are running for a train, carrying luggage, and the departure board is full of unfamiliar names and times. Translating every word is useful, but your real question is relational: &lt;strong&gt;Which services connect, where do I change, and which platform should I check?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We tried that workflow in &lt;a href="https://realtime-assistant.arte-soft.com/" rel="noopener noreferrer"&gt;GPT Realtime Assistant&lt;/a&gt;, our voice and photo assistant for iPhone, iPad, and Mac. We attached a &lt;strong&gt;prepared sample timetable image&lt;/strong&gt; to a real app session and asked for a route. This is a practical demonstration with one illustrative timetable, not a benchmark against other products or a test of live station information.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why translating the words is only the first step
&lt;/h2&gt;

&lt;p&gt;A camera translator can help you understand labels such as departure, arrival, and platform. A traveler still has to match rows across the connections, compare arrival and departure times, and check whether each transfer is possible. Typing all those rows into a chat is another option, but it can be awkward while juggling a phone and a suitcase.&lt;/p&gt;

&lt;p&gt;Attaching an image and asking a direct question is a useful alternative: “Which route reaches the destination before 10:30, where do I change, and which platforms are shown?” It does not eliminate the need to check the answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  The train timetable demo
&lt;/h2&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/p8f-OksdV5k" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What the video actually shows:&lt;/strong&gt; the station scene and presenter are AI-generated, and the timetable is illustrative. For the test, we attached the prepared timetable image as a file to a real GPT Realtime Assistant session; the app response in the video is edited for time. The video is &lt;strong&gt;not&lt;/strong&gt; a recording of an actual camera capture at a live station.&lt;/p&gt;

&lt;p&gt;There is also a &lt;a href="https://www.youtube.com/shorts/cPGV5TFoZuI" rel="noopener noreferrer"&gt;13-second edit of the train demo&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What worked in this sample
&lt;/h2&gt;

&lt;p&gt;The illustrative board lists three legs from Midoricho to Kaze Onsen. In the demonstrated response, the assistant identified a route using A12, B24, and K16, with arrival at 10:24. The sample board shows:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Leg&lt;/th&gt;
&lt;th&gt;Departure&lt;/th&gt;
&lt;th&gt;Arrival&lt;/th&gt;
&lt;th&gt;Departure platform on the sample board&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;A12: Midoricho → Aoba&lt;/td&gt;
&lt;td&gt;09:00&lt;/td&gt;
&lt;td&gt;09:23&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;B24: Aoba → Sora&lt;/td&gt;
&lt;td&gt;09:30&lt;/td&gt;
&lt;td&gt;09:52&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;K16: Sora → Kaze Onsen&lt;/td&gt;
&lt;td&gt;10:01&lt;/td&gt;
&lt;td&gt;10:24&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Reading the rows together gives a seven-minute connection at Aoba and a nine-minute connection at Sora. The point of the demo is that the assistant can use an image and a question as context for an answer, instead of merely translating labels. We have not run a controlled speed or accuracy comparison with camera translators or other chat tools, so this example does not establish that it is more accurate or faster than them.&lt;/p&gt;

&lt;h2&gt;
  
  
  What still needs a human check
&lt;/h2&gt;

&lt;p&gt;It is not flawless. Blurred numbers, cropped rows, small footnotes, dates, service restrictions, and ambiguous station names can change the answer. The model can also misunderstand a connection or state an incorrect platform. A photograph captures a moment; it cannot by itself reveal a later cancellation or platform change.&lt;/p&gt;

&lt;p&gt;Before acting on a suggested route:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Check the service date and any symbols or weekend-only footnotes.&lt;/li&gt;
&lt;li&gt;Compare the departure time and platform with the &lt;strong&gt;live station board or an official rail source&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Check that there is enough time to change platforms, especially with luggage or accessibility needs.&lt;/li&gt;
&lt;li&gt;If the image is unclear or the answer is uncertain, ask station staff.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The fictional route and stations above are for demonstration only. Do not use them to plan an actual journey.&lt;/p&gt;

&lt;h2&gt;
  
  
  A second demo: conversation context
&lt;/h2&gt;

&lt;p&gt;The longer demo shows a different set of situations: a Japanese family conversation, a lecture point turned into a task, and interview preparation.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/wOWFlpuPaZk" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Its scenes and voices are AI-generated, and some app text was adapted for the demonstration. The &lt;a href="https://www.youtube.com/shorts/4Zec352CkPo" rel="noopener noreferrer"&gt;family translation Short&lt;/a&gt; and &lt;a href="https://www.youtube.com/shorts/SjVWbIQCGe8" rel="noopener noreferrer"&gt;technical interview Short&lt;/a&gt; are also available.&lt;/p&gt;

&lt;p&gt;GPT Realtime Assistant's live voice path uses the cloud; sessions on iPhone and iPad need an internet connection. On supported Macs the app also offers downloadable local Whisper Large v3 Turbo and Qwen 3 8B variants. Those local models are a separate workflow; this train demo is not evidence that its photo reasoning ran offline.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try the workflow
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://realtime-assistant.arte-soft.com/" rel="noopener noreferrer"&gt;GPT Realtime Assistant product home&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://realtime-assistant.arte-soft.com/articles/ask-ai-about-a-screenshot/" rel="noopener noreferrer"&gt;How to ask AI about a photo or screenshot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://realtime-assistant.arte-soft.com/articles/translation-app-for-travel/" rel="noopener noreferrer"&gt;Travel translation guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://realtime-assistant.arte-soft.com/compare/" rel="noopener noreferrer"&gt;Product comparisons&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://apps.apple.com/us/app/gpt-realtime-assistant/id6770536523?pt=127093297&amp;amp;ct=ext_train_demo&amp;amp;mt=8" rel="noopener noreferrer"&gt;GPT Realtime Assistant on the App Store&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The app is free to download; its App Store listing says a subscription is needed for use. Check the listing for current details. When using it to record conversations, ask participants first and follow the rules that apply where you are.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>ios</category>
      <category>productivity</category>
      <category>travel</category>
    </item>
    <item>
      <title>Downloaded Is Not Selected: Managing Whisper and Qwen Models in a Native Voice App</title>
      <dc:creator>mincho milev</dc:creator>
      <pubDate>Mon, 09 Nov 2026 22:10:26 +0000</pubDate>
      <link>https://dev.to/mincho_milev_c7753077d5af/downloaded-is-not-selected-managing-whisper-and-qwen-models-in-a-native-voice-app-44h3</link>
      <guid>https://dev.to/mincho_milev_c7753077d5af/downloaded-is-not-selected-managing-whisper-and-qwen-models-in-a-native-voice-app-44h3</guid>
      <description>&lt;p&gt;An “offline AI” switch hides several different questions: is a model present, are its companion files present, and is the runtime actually using it? Treating those as one boolean produces confusing settings and difficult support reports.&lt;/p&gt;

&lt;p&gt;The local-model catalog in &lt;a href="https://realtime-assistant.arte-soft.com/" rel="noopener noreferrer"&gt;GPT Realtime Assistant&lt;/a&gt; makes those distinctions explicit. This article focuses on the inspected download service rather than making a latency claim about every device or language.&lt;/p&gt;

&lt;h2&gt;
  
  
  Model identity is more than a display name
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;RealtimeDownloadableModel&lt;/code&gt; entries identify a repository, a remote filename, a destination filename, and an installation kind. The catalog includes Whisper Large v3 Turbo variants and Qwen 3 8B variants with different quantizations.&lt;/p&gt;

&lt;p&gt;That metadata is operational configuration. “Qwen” is not enough information to select a compatible file or explain its storage cost. The precise artifact matters, and companion artifacts can matter too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installed and selected answer different questions
&lt;/h2&gt;

&lt;p&gt;The status builder resolves the runtime’s chosen Whisper, Qwen, and Qwen-ASR paths separately. For each catalog entry it inspects the local file size and checks that required companion files exist. It reports &lt;code&gt;isInstalled&lt;/code&gt; separately from &lt;code&gt;isSelected&lt;/code&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;State&lt;/th&gt;
&lt;th&gt;Evidence used by the status builder&lt;/th&gt;
&lt;th&gt;Limitation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;File present&lt;/td&gt;
&lt;td&gt;Filesystem metadata&lt;/td&gt;
&lt;td&gt;Presence does not prove valid model contents&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Companions present&lt;/td&gt;
&lt;td&gt;Each required companion has metadata&lt;/td&gt;
&lt;td&gt;Still not an inference test&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Selected&lt;/td&gt;
&lt;td&gt;Runtime path equals model path&lt;/td&gt;
&lt;td&gt;Does not prove the runtime has loaded successfully&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ready for a conversation&lt;/td&gt;
&lt;td&gt;Requires runtime/session checks beyond this catalog&lt;/td&gt;
&lt;td&gt;Cannot be concluded from a download progress bar&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This avoids a common UI trap: showing a model as active simply because a download finished.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stage large downloads separately
&lt;/h2&gt;

&lt;p&gt;The downloader is an actor. It creates the model destination directory and uses a &lt;code&gt;.part&lt;/code&gt; path while transferring a file. It reports downloaded bytes, expected bytes when known, speed, and an estimated remaining duration.&lt;/p&gt;

&lt;p&gt;Progress remains below completion while transfer work is still in progress. When expected size is unavailable, the UI must tolerate uncertainty rather than inventing an accurate-looking completion time.&lt;/p&gt;

&lt;p&gt;The downloader processes companion files after the primary model. That ordering reinforces why “main file finished” cannot be the only readiness signal.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do not confuse a local pipeline with the cloud voice path
&lt;/h2&gt;

&lt;p&gt;A local speech-recognition model and a local language model are distinct dependencies. Cloud live voice and local inference also have different startup and failure behavior. The useful interface makes the selected path and missing assets visible rather than silently switching providers.&lt;/p&gt;

&lt;p&gt;For regression testing, start with a missing companion, an interrupted &lt;code&gt;.part&lt;/code&gt; download, a selected file that has been moved, and two installed quantizations. Assert the displayed state, then separately run a synthetic inference check. File length checks are not cryptographic integrity checks; the code inspected here should not be described as providing such verification.&lt;/p&gt;

&lt;h2&gt;
  
  
  Product demos: train timetable photo Q&amp;amp;A and live voice context
&lt;/h2&gt;

&lt;p&gt;These short demos show the app's photo-question and live voice workflows in action. They are not tests or benchmarks of the local Mac model pipeline described above.&lt;/p&gt;

&lt;h3&gt;
  
  
  Asking about an illustrative train timetable (connections, departure times, and platforms)
&lt;/h3&gt;

&lt;p&gt;When a station departure board or timetable has multiple connections and platform changes, attaching a photo and asking a direct route question is often faster than scanning rows manually:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/p8f-OksdV5k" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Live translation, lecture tasks, and interview preparation
&lt;/h3&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/wOWFlpuPaZk" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The scenes and presenter voices are AI-generated. The timetable is illustrative; the route answer (connections, departure times, and platforms) comes from a real app test with an attached sample timetable image and is edited for time. Some on-screen text in the first demo was adapted.&lt;/p&gt;

&lt;p&gt;For shorter cuts, watch the &lt;a href="https://www.youtube.com/shorts/cPGV5TFoZuI" rel="noopener noreferrer"&gt;13-second train timetable edit&lt;/a&gt;, the &lt;a href="https://www.youtube.com/shorts/4Zec352CkPo" rel="noopener noreferrer"&gt;family translation Short&lt;/a&gt;, or the &lt;a href="https://www.youtube.com/shorts/SjVWbIQCGe8" rel="noopener noreferrer"&gt;technical interview Short&lt;/a&gt;, and see our guide on &lt;a href="https://realtime-assistant.arte-soft.com/articles/ask-ai-about-a-screenshot/" rel="noopener noreferrer"&gt;asking AI about a photo or screenshot&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The model lifecycle is a first-class part of a native AI product. It determines whether “offline” is an understandable capability or an ambiguous toggle. &lt;a href="https://realtime-assistant.arte-soft.com/compare/" rel="noopener noreferrer"&gt;GPT Realtime Assistant’s comparison pages&lt;/a&gt; describe the product-level choices around that architecture.&lt;/p&gt;

&lt;p&gt;Available on &lt;a href="https://apps.apple.com/us/app/gpt-realtime-assistant/id6770536523?pt=127093297&amp;amp;ct=article_realtime_ai&amp;amp;mt=8" rel="noopener noreferrer"&gt;GPT Realtime Assistant on the App Store&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>swift</category>
      <category>macos</category>
      <category>ai</category>
      <category>architecture</category>
    </item>
    <item>
      <title>A Mute Button Must Fail Closed: Recording App and Microphone Audio with ReplayKit</title>
      <dc:creator>mincho milev</dc:creator>
      <pubDate>Mon, 09 Nov 2026 00:40:14 +0000</pubDate>
      <link>https://dev.to/mincho_milev_c7753077d5af/a-mute-button-must-fail-closed-recording-app-and-microphone-audio-with-replaykit-382d</link>
      <guid>https://dev.to/mincho_milev_c7753077d5af/a-mute-button-must-fail-closed-recording-app-and-microphone-audio-with-replaykit-382d</guid>
      <description>&lt;p&gt;A screen recording can look correct while sounding completely wrong. A tutorial needs narration above the application’s audio; a demonstration may need only system sound. Treating both inputs as one volume control makes those two jobs unnecessarily difficult.&lt;/p&gt;

&lt;p&gt;In &lt;a href="https://reel-screen-recorder.arte-soft.com/" rel="noopener noreferrer"&gt;Reel Screen Recorder&lt;/a&gt;, the broadcast extension receives ReplayKit buffers and keeps their source identity until the writer dispatches them. The useful engineering detail is not the slider itself. It is what happens when transforming a buffer fails.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep source identity through the pipeline
&lt;/h2&gt;

&lt;p&gt;The current &lt;code&gt;SampleHandler.handleAudio&lt;/code&gt; distinguishes &lt;code&gt;.audioMic&lt;/code&gt; from &lt;code&gt;.audioApp&lt;/code&gt; and asks the shared settings for &lt;code&gt;recordingGain(forMicrophone:)&lt;/code&gt;. It then passes the processed buffer, &lt;strong&gt;with its original source type&lt;/strong&gt;, to &lt;code&gt;BroadcastWriter&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The writer routes video, app audio, and microphone audio to separate capture functions. Its asset writer uses the MP4 container. This division keeps capture policy out of the file-writing dispatch code and makes it possible to reason about each source independently.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Boundary&lt;/th&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;th&gt;What must remain intact&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ReplayKit callback&lt;/td&gt;
&lt;td&gt;Identify source&lt;/td&gt;
&lt;td&gt;Video versus app versus mic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gain adjustment&lt;/td&gt;
&lt;td&gt;Apply that source’s setting&lt;/td&gt;
&lt;td&gt;Timing and sample format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Writer dispatch&lt;/td&gt;
&lt;td&gt;Choose capture function&lt;/td&gt;
&lt;td&gt;Original buffer type&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Finalization&lt;/td&gt;
&lt;td&gt;Finish the local asset&lt;/td&gt;
&lt;td&gt;A playable file, not merely a path&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Zero gain is different from a small gain
&lt;/h2&gt;

&lt;p&gt;The handler tries a volume-adjusted copy when gain is not one. If that transformation fails and the requested volume is zero, it tries to create a silent buffer. If silence creation also fails, it returns without writing the buffer.&lt;/p&gt;

&lt;p&gt;Here is the policy in condensed pseudocode, not a drop-in ReplayKit implementation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if transformation succeeds:
    write transformed buffer
else if requested gain is zero:
    if silent copy succeeds: write silence
    else: discard buffer
else:
    write original buffer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That last nonzero case is a fidelity compromise: requested gain may not be honored. The zero case is a privacy boundary. Writing the original buffer after the user muted it would violate the user’s explicit choice. The implementation treats those failures differently.&lt;/p&gt;

&lt;h2&gt;
  
  
  A floating camera is a separate concern
&lt;/h2&gt;

&lt;p&gt;Reel also offers a picture-in-picture camera workflow. A camera preview, a system PiP surface, and an encoded recording are different objects with different lifetimes. A visible camera window alone is not proof that the exported clip contains the intended image and audio.&lt;/p&gt;

&lt;p&gt;For verification, use a short recording with identifiable synthetic app sound and a spoken microphone marker. Inspect the exported MP4, then repeat with each source muted individually. Include interruption and failed-transform cases in tests. These are suggested checks, not performance results claimed from this code review.&lt;/p&gt;

&lt;p&gt;The broader lesson is to preserve source identity until the last component that needs it. Mixing early makes later controls harder to explain and harder to verify. For the product workflow and alternatives, see &lt;a href="https://reel-screen-recorder.arte-soft.com/compare/" rel="noopener noreferrer"&gt;Reel’s recording comparisons&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Available on &lt;a href="https://apps.apple.com/us/app/id6758941990?pt=127093297&amp;amp;ct=article_reel&amp;amp;mt=8" rel="noopener noreferrer"&gt;Reel Screen Recorder on the App Store&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>swift</category>
      <category>ios</category>
      <category>video</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
