{"slug": "shipping-25-offline-neural-tts-voices-on-a-180-android-phone-in-flutter-3-piper", "title": "Shipping 25 Offline Neural TTS Voices on a $180 Android Phone in Flutter (Supertonic 3 + Piper Benchmarks)", "summary": "A developer building Lector, an offline Flutter e-book and audiobook reader for Android, shipped 25 downloadable neural TTS voices across 11 languages in v1.2.5 by running Supertonic 3 INT8 (44.1 kHz) and Piper VITS (22.05 kHz) side by side through sherpa-onnx. Hardware-in-the-loop testing on a $180 Redmi Note 13 (Snapdragon 685) measured Piper at RTF 0.29-0.33 and Supertonic 3 at RTF 1.06-1.20, leading the developer to lock Supertonic at numSteps=5 after lower step counts produced metallic artifacts, and to enforce strict mutual engine eviction to keep peak native RAM in check on 4 GB devices.", "body_md": "Most modern text-to-speech audiobook apps rely on cloud APIs. They stream audio from remote servers, require accounts, upload private EPUBs and study PDFs to third-party infrastructure, cap monthly hours, and stop working the second you board a flight or enter a subway.\n\nWhile building **Lector** (`app.lectorreader.audiobook`), an offline Android e-book and audiobook reader in Flutter, I set one strict architectural constraint from day one: **zero cloud TTS or LLM calls, ever.** Every voice, translation, and text-cleanup pass has to run 100% locally on everyday Android hardware.\n\nIn our `v1.2.5` release, we shipped **25 downloadable neural voices across 11 languages** by running two complementary `sherpa-onnx` backends side by side: **Supertonic 3 INT8** (`44.1 kHz`) and **Piper VITS** (` 22.05 kHz`).\n\nAlong the way, physical Hardware-in-the-Loop (HIL) testing on a mid-range **$180 Redmi Note 13 (Snapdragon 685, 8-core ARMv8, Android 14)** caught real-world bottlenecks that unit tests and emulators completely missed. Here are the exact benchmarks and four engineering lessons we learned.\n\nInstead of forcing one neural TTS architecture onto every phone, we pair two local engines through `sherpa-onnx`:\n\n| Engine | Model Architecture | Sample Rate | Pack Size | Voices / Languages | Snapdragon 685 RTF | Sweet Spot | \n|---|---|---|---|---|---|---|\n| **Fast Offline AI** | `Piper` VITS (`csukuangfj/vits-piper-*` ) | `22.05 kHz` | `~18-65 MB` / voice | 15 voices / 7 languages ( `EN, ES, DE, FR, PT, RU, KK` ) | **`0.29 - 0.33`** (` 3x` faster than real-time) | Budget CPUs, long commutes, E-ink battery life | \n| **Studio HD** | `Supertonic 3 INT8` (`numSteps = 5` ) | `44.1 kHz` | `~123 MB` shared pack | 10 multilingual voices / 10 languages ( `EN, ES, DE, FR, PT, IT, PL, TR, UK, RU` ) | **`1.06 - 1.20`** on budget SD685;**`< 0.50`** on mid/flagship SoCs | Expressive audiobook narration, multi-voice dialogue duets, offline `44.1 kHz``.m4a` /`.wav` export | \n| **System Fallback** | Android Local TTS | System | `0 MB` | 11 languages | `< 0.10` | Instant zero-download fallback | \n\n*RTF (Real-Time Factor) = synthesis time / audio duration. Values below `1.0` run faster than real-time playback.*\n\nOn a flagship Snapdragon 8 Gen 2/3, `Supertonic 3 INT8` at `numSteps = 5` flies well below `RTF 0.50`. On our budget Snapdragon 685 test phone, however, sustained synthesis hovered around `RTF 1.06 - 1.20`.\n\nOur first instinct was clever-on-paper: build an adaptive RTF governor that automatically steps diffusion down (`5 -> 3 -> 2` steps) whenever a slow CPU falls behind real-time playback.\n\nThen we actually recorded the device audio and listened to it on headphones.\n\nBelow `5` steps, `Supertonic 3` immediately picked up noticeable metallic artifacts and flattened prosody. Users would not think \"my CPU is slow\", they would think \"these Studio HD voices sound robotic.\"\n\nSo we reverted step-down permanently and locked **`numSteps = 5` as a hard quality floor** for live playback (`8` steps for Max Quality `.m4a` / `.wav` offline export). To make playback feel snappy without ruining voice fidelity, we combined three things:\n\n`RTF > 1.02` across two consecutive chunks (`>= 1.2s`), it surfaces a single polite hint recommending our Fast (` Piper`) voices (` RTF ~0.30`) instead of silently degrading audio.`-157 MB` Peak RSS)\nAndroid's Low Memory Killer (LMK) is unforgiving on `4 GB` devices when an app plays background audio with the screen locked.\n\nHolding both a warm `Supertonic 3` ONNX session and a warm `Piper` ONNX session in native RAM at the same time pushed peak RSS dangerously close to background eviction when users switched voices mid-book.\n\nThe fix was straightforward and measurable: enforce **strict mutual engine eviction** in our native worker coordinator. Whenever the user activates a `Supertonic 3` voice, any resident `Piper` session is cleanly torn down and freed (and vice versa). That single architectural invariant cut peak native RAM overhead by **`~157 MB`**, stabilizing background playback across `4 GB` phones.\n\n`37.3s` System ANR on Long Justified Chapters\nUnit tests usually feed parsers 200-character mock strings. Real books are different.\n\nWhen we tested a full `40,000+`-character chapter (*The Adventures of Sherlock Holmes*) on physical hardware with three popular typography features turned on simultaneously:\n\n`TextAlign.justify`)`-`)\n...the eager paragraph pre-pass blocked the UI isolate for **`37.3 seconds`**, triggering a hard Android System ANR.\n\nWe replaced the eager layout pass with an incremental frame-budgeted controller (`IncrementalVisibleHyphenController`):\n\n`12 ms`` 6 ms`\nMeasured on the exact same Redmi Note 13 with `Justify=ON` + `Bionic=ON`:\n\n`3.86s`` 0` ANR)`1.31s`` 120 FPS` word-by-word karaoke highlighting with zero dropped frames.`O(N)` PDF Cleanup & 1:1 Offline Bilingual Subtitles\nTwo smaller production lessons that made a huge UX difference:\n\n`88%`. Refactoring `PdfTextCleaner` to single-pass linear `3. Section Title`) and honest two-phase progress (` 0-85%` extraction, `85-100%` cleanup & save) eliminated stalls.`highlightedSentenceSpanListenable` that drives the text spotlight gave locked 1:1 parity.\nIf you are building offline mobile AI or Flutter audio apps and want to inspect the full benchmark notes or test the app directly:\n\nHappy to answer any questions in the comments about Flutter + `sherpa_onnx` isolate pools, acoustic boundary timing for word-level highlighting, or Android `MediaCodec` `.m4a` batch export!", "url": "https://wpnews.pro/news/shipping-25-offline-neural-tts-voices-on-a-180-android-phone-in-flutter-3-piper", "canonical_source": "https://dev.to/fromych1/shipping-25-offline-neural-tts-voices-on-a-180-android-phone-in-flutter-supertonic-3-piper-cik", "published_at": "2026-12-04 17:08:33+00:00", "updated_at": "2026-12-04 17:14:34.276695+00:00", "lang": "en", "topics": ["large-language-models", "ai-tools", "natural-language-processing", "ai-infrastructure", "developer-tools"], "entities": ["Lector", "Supertonic 3", "Piper", "sherpa-onnx", "Flutter", "Redmi Note 13", "Snapdragon 685", "Android"], "also_reported_by": [], "takeaway": "On a Snapdragon 685, Piper VITS runs at RTF 0.29-0.33 while Supertonic 3 INT8 at numSteps=5 runs at RTF 1.06-1.20, and dropping below 5 steps introduces audible metallic artifacts, so keep 5 as a quality floor and evict the inactive engine to cap native RAM.", "recommendation": {"advice": "Keep diffusion step counts at a quality floor of 5 for live playback and evict the inactive TTS engine's ONNX session when switching voices to avoid low-memory eviction on 4 GB devices.", "playbook": "inference-serving", "playbook_url": "https://wpnews.pro/playbooks/inference-serving"}, "alternates": {"html": "https://wpnews.pro/news/shipping-25-offline-neural-tts-voices-on-a-180-android-phone-in-flutter-3-piper", "markdown": "https://wpnews.pro/news/shipping-25-offline-neural-tts-voices-on-a-180-android-phone-in-flutter-3-piper.md", "text": "https://wpnews.pro/news/shipping-25-offline-neural-tts-voices-on-a-180-android-phone-in-flutter-3-piper.txt", "jsonld": "https://wpnews.pro/news/shipping-25-offline-neural-tts-voices-on-a-180-android-phone-in-flutter-3-piper.jsonld"}}