termux-tts 1.4.0 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,114 +1,438 @@
1
- # Termux-TTS
2
-
3
- [![PyPI](https://img.shields.io/pypi/v/termux-tts.svg?style=flat-square&color=0369a1)](https://pypi.org/project/termux-tts/)
4
- [![Python](https://img.shields.io/pypi/pyversions/termux-tts.svg?style=flat-square)](https://pypi.org/project/termux-tts/)
5
- [![npm](https://img.shields.io/npm/v/termux-tts.svg?style=flat-square&color=b91c1c)](https://www.npmjs.com/package/termux-tts)
6
- [![License](https://img.shields.io/badge/License-Apache_2.0-004499.svg?style=flat-square)](https://github.com/uno-km/termux-tts)
7
-
8
- > Production-Grade 4-Tier On-Device Speech Synthesis Framework (Zero-Dependency DSP Formant, C++ Vulkan GPU Neural Engine & Android Native Voice Bridge)
9
-
10
- ---
11
-
12
- ## Architecture & Overview
13
-
14
- Termux-TTS is an enterprise-grade, on-device text-to-speech framework optimized for mobile edge hardware and Android Termux environments. Built to eliminate heavy dependency stacks and fragile driver behaviors, it features a resilient 4-Tier architecture:
15
-
16
- - **Tier 1: Zero-Dependency Parametric DSP Formant Vocoder**: 0MB disk footprint, Rosenberg glottal pulse formulation, and 5-band biquad formant filters providing deterministic speech synthesis in under 50 milliseconds (RTF 0.013x).
17
- - **Tier 2: Android System Native Voice Bridge**: Direct IPC integration to physical Samsung and Google speech engines via the Termux-API service layer.
18
- - **Tier 3: Subprocess-Isolated Sherpa C++ CPU Engine**: Subprocess-isolated VITS acoustic modeling on ARM64 NEON with memory leak protection.
19
- - **Tier 4: Pure Vulkan GPU Hardware Neural Engine**: High-performance GPU tensor synthesis via precompiled native C++ binaries (`sherpa-ncnn-offline-tts-vulkan`) running high-resolution studio models (`vits-piper-en_US-lessac-high-fp16`) with zero silent CPU fallback.
20
-
21
- ---
22
-
23
- ## Empirical Hardware Benchmarks (Physical Devices)
24
-
25
- Measurements gathered on physical Android 16 hardware running Termux ARM64:
26
-
27
- | Target Device | Hardware Architecture | Synthesis Engine | Model Profile | Audio Length | Synthesis Time | Real-Time Factor (RTF) | Status |
28
- | :--- | :--- | :--- | :--- | :---: | :---: | :---: | :---: |
29
- | **Galaxy S25** | Snapdragon 8 Elite / Adreno 830 | Vulkan GPU Neural | `lessac-high-fp16` | 6.70 s | **6.65 s** | **0.993x** | Validated |
30
- | **Galaxy S25** | Snapdragon 8 Elite / Adreno 830 | Vulkan GPU Neural | `lessac-medium` | 4.59 s | **1.21 s** | **0.264x** | Validated |
31
- | **Galaxy A35** | Exynos 1380 / Mali-G68 MP5 | Vulkan GPU Neural | `lessac-medium` | 4.52 s | **5.18 s** | **1.146x** | Validated |
32
- | **Galaxy A35** | Exynos 1380 / Mali-G68 MP5 | Vulkan GPU Neural | `lessac-high-fp16` | 6.73 s | **34.33 s** | **5.098x** | Validated |
33
- | **ARM64 CPU** | Cortex-A78 / A55 | Parametric DSP | 5-Band Biquad | 4.15 s | **0.054 s** | **0.0130x** | Validated |
34
-
35
- ---
36
-
37
- ## Installation & 1-Click Provisioning
38
-
39
- ### 1. Package Installation
40
- ```bash
41
- # Python SDK & CLI
42
- pip install termux-tts
43
-
44
- # Node.js / TypeScript
45
- npm install termux-tts
46
- ```
47
-
48
- ### 2. Automated Engine & Weights Provisioning
49
- Automate the installation of precompiled ARM64 Vulkan C++ binaries and HuggingFace weights with self-test verification:
50
- ```bash
51
- # Install Studio Tier (22.05kHz High-Fidelity)
52
- termux-tts install --tier high
53
-
54
- # Or install Medium Tier (Balanced Performance)
55
- termux-tts install --tier medium
56
- ```
57
-
58
- ---
59
-
60
- ## Quickstart
61
-
62
- ### Global Command-Line Interface (CLI)
63
- ```bash
64
- # Synthesize using Vulkan GPU with speaker playback
65
- termux-tts synth -e vulkan --tier high -t "Speech synthesis via Vulkan GPU." -o out.wav --play
66
-
67
- # Instant DSP Formant synthesis
68
- termux-tts synth -e dsp -t "Zero dependency DSP synthesis." -o dsp.wav
69
-
70
- # Direct hardware speaker broadcast
71
- termux-tts speak -t "Hardware speaker broadcast." -l en
72
-
73
- # Hardware diagnostics
74
- termux-tts doctor
75
- ```
76
-
77
- ### Python SDK
78
- ```python
79
- import termux_tts as tts
80
-
81
- # High-Resolution Vulkan GPU Neural Synthesis
82
- with tts.load(engine="vulkan", model_tier="high") as engine:
83
- result = engine.synthesize("Pure Vulkan neural execution on mobile.", output="speech.wav")
84
- print(f"Synthesized in {result.elapsed_ms:.1f}ms (RTF: {result.rtf:.4f}x)")
85
-
86
- # Zero-Dependency DSP Formant Synthesis
87
- with tts.load(engine="dsp", preset="balanced") as engine:
88
- result = engine.synthesize("Instant speech without model downloads.", output="dsp.wav")
89
- print(f"DSP Latency: {result.elapsed_ms:.1f}ms")
90
- ```
91
-
92
- ### Node.js / TypeScript
93
- ```typescript
94
- import * as tts from 'termux-tts';
95
-
96
- async function main() {
97
- const engine = tts.load({ engine: 'vulkan', tier: 'high' });
98
- const res = await engine.synthesize("High performance speech synthesis.", { output: "speech.wav" });
99
- console.log(`Synthesized in ${res.elapsedMs}ms`);
100
- }
101
- main();
102
- ```
103
-
104
- ---
105
-
106
- ## Official Documentation & Benchmarks
107
- - [Official Architecture & API Reference](https://uno-km.vercel.app/lib/tts/)
108
- - [Ecosystem Metrics & Registry Stats](https://uno-km.vercel.app/foundation/metrics)
109
- - [AMEVA Open-Source Foundation Portal](https://uno-km.vercel.app/foundation/index.html)
110
-
111
- ---
112
-
113
- ## License
114
- Licensed under the Apache-2.0 License. Copyright (c) 2026 Eunho Kim ([@uno-km](https://github.com/uno-km)).
1
+ # Termux-TTS: Enterprise 4-Tier On-Device Speech Synthesis Framework
2
+
3
+ [![PyPI](https://img.shields.io/pypi/v/termux-tts.svg?style=flat-square&color=0369a1)](https://pypi.org/project/termux-tts/)
4
+ [![Python](https://img.shields.io/pypi/pyversions/termux-tts.svg?style=flat-square)](https://pypi.org/project/termux-tts/)
5
+ [![npm](https://img.shields.io/npm/v/termux-tts.svg?style=flat-square&color=b91c1c)](https://www.npmjs.com/package/termux-tts)
6
+ [![License](https://img.shields.io/badge/License-Apache_2.0-004499.svg?style=flat-square)](https://github.com/uno-km/termux-tts)
7
+ [![Hardware Acceleration](https://img.shields.io/badge/Vulkan-1.1%2B%20Compute-orange?style=flat-square&logo=vulkan)](https://www.vulkan.org/)
8
+
9
+ > **Termux-TTS** is an industrial-grade, zero-compromise on-device Text-to-Speech (TTS) engine designed specifically for Android Termux, mobile ARM64 Linux, and resource-constrained edge environments. By harmonizing an ultra-fast zero-dependency DSP formant vocoder, native Android OS voice bridge IPC, and pure C++ Vulkan GPU NCNN neural tensor compute (VITS / Piper), Termux-TTS delivers instantaneous sub-50ms acoustic synthesis and studio-grade neural voice reproduction without cloud telemetry, subscription fees, or silent quality degradation.
10
+
11
+ ---
12
+
13
+ ## 1. Installation Guide
14
+
15
+ Termux-TTS is distributed across both Python (PyPI) and Node.js (npm) ecosystems. It operates entirely in unprivileged user-space on Android Termux (ARM64) and Linux x86_64/ARM64.
16
+
17
+ ### 1.1 Prerequisites on Android Termux
18
+ Update package repositories and install foundational build tools and system audio utilities:
19
+ ```bash
20
+ pkg update -y
21
+ pkg install -y clang python python-numpy nodejs termux-api pulseaudio
22
+ ```
23
+
24
+ ### 1.2 Python SDK & Global CLI Installation
25
+ Install the core package from PyPI via `pip`:
26
+ ```bash
27
+ pip install --upgrade pip
28
+ pip install termux-tts
29
+ ```
30
+
31
+ To install with neural execution and development extras:
32
+ ```bash
33
+ pip install "termux-tts[neural,dev]"
34
+ ```
35
+
36
+ ### 1.3 Node.js / TypeScript SDK & CLI Installation
37
+ Install globally or locally inside your Node.js application via `npm`:
38
+ ```bash
39
+ # Global CLI installation
40
+ npm install -g termux-tts
41
+
42
+ # Project dependency installation
43
+ npm install termux-tts
44
+ ```
45
+
46
+ ---
47
+
48
+ ## 2. GPU Hardware Acceleration Provisioning (`ameva-runtime`)
49
+
50
+ To unlock raw mobile GPU compute via Vulkan SPIR-V compute pipelines on Qualcomm Adreno or ARM Mali silicon, pair `termux-tts` with the unified `@ameva/runtime` hardware acceleration layer and run the automated 1-click provisioning tool.
51
+
52
+ ### 2.1 Unified Installation Command
53
+ Install both the speech engine and the hardware acceleration runtime simultaneously:
54
+
55
+ ```bash
56
+ # Python Environment
57
+ pip install termux-tts ameva-runtime
58
+
59
+ # Node.js / JavaScript Environment
60
+ npm install -g termux-tts @ameva/runtime
61
+ ```
62
+
63
+ ### 2.2 1-Click Automated Binary & Model Provisioning
64
+ Termux-TTS provides a built-in automated installer that downloads pre-compiled native ARM64 Vulkan binaries (`sherpa-ncnn-offline-tts`) and studio neural weights from Hugging Face with end-to-end self-test verification:
65
+
66
+ ```bash
67
+ # Provision Studio Tier (22.05 kHz High-Fidelity Lessac FP16 - 57MB)
68
+ termux-tts install --tier high
69
+
70
+ # Provision Balanced Low-Latency Tier (Amy Medium - 25MB)
71
+ termux-tts install --tier medium
72
+
73
+ # Force re-download and skip audio playback verification
74
+ termux-tts install --tier high --force --no-play
75
+ ```
76
+
77
+ Once installed, verify full Vulkan GPU compute availability:
78
+ ```bash
79
+ termux-tts doctor
80
+ ```
81
+
82
+ ---
83
+
84
+ ## 3. Basic Usage Guide
85
+
86
+ Termux-TTS provides intuitive interfaces across CLI, Python, and Node.js.
87
+
88
+ ### 3.1 Command-Line Interface (CLI)
89
+ ```bash
90
+ # 1. High-Fidelity Vulkan GPU Synthesis to WAV
91
+ termux-tts synth -e vulkan --tier high -t "Vulkan GPU neural inference running locally on Android." -o speech.wav
92
+
93
+ # 2. Instant Zero-Dependency DSP Formant Synthesis (0MB weights)
94
+ termux-tts synth -e dsp -t "Real-time speech generation with zero downloaded models." -o dsp_out.wav
95
+
96
+ # 3. Direct Hardware Speaker Broadcast via Android Native Voice Engine
97
+ termux-tts speak -t "Notice: System background maintenance complete." -l en --volume 12
98
+
99
+ # 4. Synthesize and Play Immediately through Device Speaker
100
+ termux-tts synth -e vulkan --tier medium -t "Hello world! This audio is played directly." -o out.wav --play
101
+ ```
102
+
103
+ ### 3.2 Python SDK
104
+ ```python
105
+ import termux_tts as tts
106
+
107
+ # High-Fidelity Neural GPU Synthesis
108
+ with tts.load(engine="vulkan", tier="high") as engine:
109
+ res = engine.synthesize(
110
+ "Edge computing speech synthesis with native Vulkan acceleration.",
111
+ output="output_vulkan.wav",
112
+ speed=1.0
113
+ )
114
+ print(f"Backend: {res.backend} | Duration: {res.duration_sec:.2f}s | RTF: {res.rtf:.4f}x")
115
+
116
+ # Zero-Dependency Parametric DSP Vocoder (<50ms latency)
117
+ with tts.load(engine="dsp", preset="balanced") as engine:
118
+ res = engine.synthesize("Instant alert generated by parametric DSP.", output="alert.wav")
119
+ print(f"DSP Latency: {res.elapsed_ms:.1f}ms")
120
+
121
+ # Native Android OS Speech Output (Samsung Voice / Google TTS)
122
+ with tts.load(engine="native", language="en") as engine:
123
+ engine.speak("System notification rendered through device speaker.")
124
+ ```
125
+
126
+ ### 3.3 Node.js / TypeScript SDK
127
+ ```typescript
128
+ import * as tts from 'termux-tts';
129
+
130
+ async function main() {
131
+ // Initialize Vulkan GPU synthesis engine
132
+ const engine = new tts.TTSEngine({
133
+ engine: 'vulkan',
134
+ tier: 'high',
135
+ language: 'en'
136
+ });
137
+
138
+ const result = await engine.synthesize(
139
+ "Synthesizing high-resolution neural speech in Node.js on Termux.",
140
+ { output: 'node_output.wav', speed: 1.0 }
141
+ );
142
+
143
+ console.log(`Synthesized in ${result.elapsedMs}ms | RTF: ${result.rtf}x`);
144
+ }
145
+
146
+ main().catch(console.error);
147
+ ```
148
+
149
+ ---
150
+
151
+ ## 4. Advanced Usage & 4-Tier Speech Architecture
152
+
153
+ Termux-TTS features a robust 4-tier synthesis architecture engineered to provide the optimal balance between acoustic fidelity, memory consumption, and compute latency.
154
+
155
+ ### 4.1 Architecture Tier Breakdown
156
+ 1. **Tier 1: Parametric DSP Formant Vocoder (`engine="dsp"`)**:
157
+ - Zero-dependency Rosenberg glottal source pulse generator paired with a 5-band second-order biquad formant resonator filter bank.
158
+ - 0MB disk footprint, deterministic latency under 50ms (RTF ~0.013x on ARM Cortex-A78).
159
+ - Ideal for embedded alerts, battery-saving modes, and fail-safe recovery.
160
+ 2. **Tier 2: Android System Native Voice Bridge (`engine="native"`)**:
161
+ - Direct IPC connection to Android `TextToSpeech` service via `termux-api` and Unix domain sockets.
162
+ - Zero CPU inference overhead; delegates synthesis and playback to Samsung Voice Engine or Google Speech Services.
163
+ 3. **Tier 3: Subprocess-Isolated Sherpa C++ Engine (`engine="neural"`)**:
164
+ - CPU-based VITS neural acoustic synthesis with multi-threaded ARM NEON SIMD vectorization.
165
+ - Subprocess process-isolation prevents memory fragmentation and native memory leaks during multi-hour continuous execution.
166
+ 4. **Tier 4: Pure Vulkan GPU Hardware Neural Engine (`engine="vulkan"`)**:
167
+ - End-to-end GPU compute shader pipeline via `sherpa-ncnn` with zero silent CPU fallback.
168
+ - Evaluates high-resolution FP16 neural models (`vits-piper-en_US-lessac-high-fp16`) natively on mobile GPU silicon.
169
+
170
+ ### 4.2 Emotional & Expressive Conversational Modulation
171
+ The Expressive Engine (`engine="expressive"`) injects natural acoustic non-verbal vocalizations directly into neural synthesis:
172
+ - `[sigh]` / `[한숨]`: Organic aspiration decay and exhalation acoustic wave.
173
+ - `[laugh]` / `[웃음]`: Rhythmic 6.5 Hz glottal laughter bursts with vocal fold resonance.
174
+ - `[breath]` / `[호흡]`: Soft physiological inhalation pause.
175
+ - `[pause]` / `[쉼]`: Contextual silence spacing.
176
+
177
+ ```python
178
+ import termux_tts as tts
179
+
180
+ with tts.load(engine="expressive", language="en") as engine:
181
+ script = (
182
+ "Good morning! [breath] We have successfully deployed the system. "
183
+ "[laugh] It took all night, [sigh] but everything is operating smoothly now."
184
+ )
185
+ res = engine.synthesize(script, output="conversational.wav")
186
+ print(f"Expressive tags processed: {res.expressive_tags_detected}")
187
+ ```
188
+
189
+ ### 4.3 Streaming & Real-Time Audio Buffer Manipulation
190
+ Inspect and manipulate raw floating-point and 16-bit PCM audio buffers directly in memory before writing to disk:
191
+ ```python
192
+ import termux_tts as tts
193
+
194
+ with tts.load(engine="dsp") as engine:
195
+ res = engine.synthesize("Buffer streaming test.")
196
+ audio_buf = res.audio_buffer
197
+
198
+ # Access raw PCM sample array
199
+ samples = audio_buf.samples # np.ndarray (float32, normalized [-1.0, 1.0])
200
+ raw_bytes = audio_buf.to_wav_bytes() # RIFF WAV binary stream
201
+ print(f"Sample count: {len(samples)}, Duration: {audio_buf.duration_seconds:.3f}s")
202
+ ```
203
+
204
+ ---
205
+
206
+ ## 5. Feature & Parameter Matrix
207
+
208
+ ### 5.1 CLI Arguments (`termux-tts synth` & `termux-tts speak`)
209
+
210
+ | Option Flag | Argument Type | Default | Description |
211
+ | :--- | :--- | :--- | :--- |
212
+ | `-t`, `--text` | `string` | *(Required)* | Input text or SSML-tagged phrase to synthesize. |
213
+ | `-o`, `--output` | `path` | `output.wav` | Destination filesystem path for generated RIFF WAV file. |
214
+ | `-l`, `--lang` | `string` | `ko` | Target language code (`en`, `ko`). |
215
+ | `-e`, `--engine` | `enum` | `auto` | Engine backend tier: `auto`, `vulkan`, `dsp`, `native`, `neural`, `expressive`. |
216
+ | `--tier` | `enum` | `high` | Model resolution profile: `high` (Studio FP16, 57MB), `medium` (Balanced, 25MB). |
217
+ | `-p`, `--preset` | `enum` | `balanced` | DSP vocoder profile: `fast`, `balanced`, `expressive`, `ultra`. |
218
+ | `-d`, `--device` | `enum` | `auto` | Compute execution device: `auto`, `gpu`, `vulkan`, `cpu`. |
219
+ | `-s`, `--speed` | `float` | `1.0` | Speech cadence multiplier (`0.5` to `2.0`). |
220
+ | `--threads` | `int` | `4` | Worker threads for CPU ARM NEON SIMD compute (1 for GPU). |
221
+ | `--volume` | `int` | `None` | Android media volume level (`1` to `15`). |
222
+ | `--play` | `flag` | `False` | Automatically dispatch audio to physical speaker upon synthesis completion. |
223
+
224
+ ### 5.2 Python SDK `load()` Parameters
225
+
226
+ | Parameter | Type | Default | Description |
227
+ | :--- | :--- | :--- | :--- |
228
+ | `engine` | `str` | `"auto"` | Selects target engine: `"vulkan"`, `"dsp"`, `"native"`, `"neural"`, `"expressive"`. |
229
+ | `tier` | `str` | `"high"` | Specifies neural weight tier (`"high"`, `"medium"`). |
230
+ | `language` | `str` | `"ko"` | Phonemizer and lexicon locale code. |
231
+ | `preset` | `str` | `"balanced"` | Parametric DSP quality level (`"fast"`, `"balanced"`, `"expressive"`, `"ultra"`). |
232
+ | `device` | `str` | `"auto"` | Compute target device (`"gpu"`, `"vulkan"`, `"cpu"`, `"auto"`). |
233
+ | `threads` | `int` | `4` | CPU concurrency worker count. |
234
+ | `model` | `str` | `None` | Optional explicit path to custom VITS or NCNN model directory. |
235
+ | `sample_rate`| `int` | `22050` | Audio sampling frequency (Hz). |
236
+
237
+ ---
238
+
239
+ ## 6. Production Code Examples & Diagnostics
240
+
241
+ ### 6.1 Enterprise Batch Speech Pipeline with Fallback Assurance
242
+ ```python
243
+ import os
244
+ import termux_tts as tts
245
+ from termux_tts.exceptions import VulkanInitializationError, TTSModelLoadError
246
+
247
+ scripts = [
248
+ "Alert: Thermal gradient within nominal thresholds.",
249
+ "System diagnostics passed all 12 validation gates.",
250
+ "Unattended background daemon active on port 8080."
251
+ ]
252
+
253
+ def synthesize_batch(items, out_dir="dist_audio"):
254
+ os.makedirs(out_dir, exist_ok=True)
255
+
256
+ # Attempt primary Tier 4 Vulkan GPU engine with Fail-Safe fallback to Tier 1 DSP
257
+ try:
258
+ engine = tts.load(engine="vulkan", tier="high")
259
+ print("[INFO] Initialized Tier 4 Vulkan GPU Neural Engine.")
260
+ except (VulkanInitializationError, TTSModelLoadError) as exc:
261
+ print(f"[WARN] Hardware acceleration unavailable ({exc}). Falling back to Tier 1 DSP.")
262
+ engine = tts.load(engine="dsp", preset="balanced")
263
+
264
+ with engine:
265
+ for idx, text in enumerate(items):
266
+ out_file = os.path.join(out_dir, f"notice_{idx:02d}.wav")
267
+ res = engine.synthesize(text, output=out_file)
268
+ print(f"[{idx+1}/{len(items)}] Generated '{out_file}' | Backend: {res.backend} | RTF: {res.rtf:.4f}x")
269
+
270
+ if __name__ == "__main__":
271
+ synthesize_batch(scripts)
272
+ ```
273
+
274
+ ### 6.2 12-Stage Hardware Diagnostic Validation
275
+ Run programmatic health audits to verify Vulkan compute queues, shared memory bindings, and driver integrity:
276
+ ```python
277
+ from termux_tts.engine import doctor
278
+
279
+ report = doctor()
280
+ print("Hardware Diagnostic Status:", report["status"])
281
+ print("Passed Verification Stages:", report["passed_stages"])
282
+ print("Recommended Compute Backend:", report["recommended_backend"])
283
+ ```
284
+
285
+ ---
286
+
287
+ ## 7. Real-World Outputs & Empirical Hardware Benchmarks
288
+
289
+ ### 7.1 Empirical Physical Device Benchmarks
290
+ All metrics were gathered directly on physical mobile hardware running Android 16 / Termux ARM64:
291
+
292
+ | Device Model | Processor Architecture | Synthesis Engine | Model Profile | Audio Length | Inference Time | Real-Time Factor (RTF) | Memory Footprint |
293
+ | :--- | :--- | :--- | :--- | :---: | :---: | :---: | :---: |
294
+ | **Galaxy S25** | Snapdragon 8 Elite / Adreno 830 | Vulkan GPU Neural | `lessac-high-fp16` | 6.70 s | **6.65 s** | **0.993x** | 68 MB |
295
+ | **Galaxy S25** | Snapdragon 8 Elite / Adreno 830 | Vulkan GPU Neural | `amy-medium` | 4.59 s | **1.21 s** | **0.264x** | 38 MB |
296
+ | **Galaxy A35** | Exynos 1380 / Mali-G68 MP5 | Vulkan GPU Neural | `amy-medium` | 4.52 s | **5.18 s** | **1.146x** | 42 MB |
297
+ | **Galaxy A35** | Exynos 1380 / Mali-G68 MP5 | Vulkan GPU Neural | `lessac-high-fp16` | 6.73 s | **34.33 s** | **5.098x** | 72 MB |
298
+ | **ARM64 CPU** | Cortex-A78 / A55 (Quad-Core) | Parametric DSP Vocoder | 5-Band Biquad | 4.15 s | **0.054 s** | **0.0130x** | **0 MB** |
299
+
300
+ > **Real-Time Factor (RTF) Definition**: $\text{RTF} = \frac{\text{Synthesis Latency (Seconds)}}{\text{Generated Audio Duration (Seconds)}}$.
301
+ > An RTF under `1.0x` indicates faster-than-realtime synthesis suitable for live interactive voice applications.
302
+
303
+ ### 7.2 Verified Audio Samples
304
+ Reference audio samples generated directly on-device are included in the repository:
305
+ - **Expressive Emotional Output**: [`docs/assets/samples/expressive_demo.wav`](https://github.com/uno-km/termux-tts/blob/main/docs/assets/samples/expressive_demo.wav) — Demonstrates natural aspiration sighs and laughter tags.
306
+ - **Parametric DSP Output**: [`docs/assets/samples/dsp_test.wav`](https://github.com/uno-km/termux-tts/blob/main/docs/assets/samples/dsp_test.wav) — Demonstrates 0MB instant formant synthesis.
307
+
308
+ ---
309
+
310
+ ## 8. GPU Interconnect Architecture & Compatibility
311
+
312
+ ```mermaid
313
+ flowchart LR
314
+ A["Termux-TTS Application Layer"] --> B["AMEVA Hardware Gateway"]
315
+ B --> C["/system/lib64/libvulkan.so"]
316
+ C --> D{"SoC GPU Silicon"}
317
+ D -->|"Adreno 7xx / 8xx (Full SPIR-V FP16)"| E["Qualcomm Snapdragon"]
318
+ D -->|"Mali Bifrost / Valhall (Driver Pipelined)"| F["ARM Mali / Exynos"]
319
+ E --> G["High-Throughput Shader Core (RTF < 0.3x)"]
320
+ F --> H["Balanced Execution (Medium Tier Recommended)"]
321
+ ```
322
+
323
+ ### 8.1 Vulkan Compute Shader Pipeline
324
+ Termux-TTS interfaces directly with `/system/lib64/libvulkan.so` via SPIR-V compute shaders compiled in `sherpa-ncnn`. Tensor matrix multiplications for VITS encoder, duration predictor, and inverse coupling flows execute directly on GPU compute units.
325
+
326
+ ### 8.2 Silicon Compatibility Matrix
327
+ - **Qualcomm Snapdragon (Adreno 6xx, 7xx, 8xx)**:
328
+ - **Status: Tier-1 Full Support**. Hardware FP16 arithmetic instructions, high sub-group sizes, and low dispatch latency deliver real-time factor performance as low as `0.264x`.
329
+ - **Samsung Exynos / MediaTek Dimensity (ARM Mali-Gxx / Immortalis)**:
330
+ - **Status: Supported (Medium Tier Recommended)**. Works out of the box. Due to Mali driver SPIR-V shader compilation overhead, `--tier medium` (`amy-medium`) is recommended for real-time responsiveness.
331
+ - **Strict Zero-Silent-Fallback**:
332
+ - If `--engine vulkan` or `--gpu` is specified and no Vulkan driver or compatible hardware is available, Termux-TTS raises `VulkanInitializationError` immediately rather than secretly degrading to CPU execution.
333
+
334
+ ---
335
+
336
+ ## 8-1. CPU vs. GPU Performance & Thermal Trade-offs
337
+
338
+ | Evaluation Metric | CPU Synthesis (ARM Cortex-A78) | Vulkan GPU Neural (Adreno 830) | Parametric DSP (0MB) |
339
+ | :--- | :--- | :--- | :--- |
340
+ | **Real-Time Factor (Medium)** | ~0.85x – 1.10x | **0.264x** (3.5x Faster) | **0.013x** (70x Faster) |
341
+ | **Real-Time Factor (Studio High)** | ~3.80x – 5.20x | **0.993x** (Sub-realtime) | N/A (Formant Only) |
342
+ | **First-Token Latency (TTFA)** | ~450 ms | ~180 ms | **< 15 ms** |
343
+ | **CPU Big-Core Utilization** | 100% across 4 cores | < 15% (Driver Dispatch) | Single Core ~8% |
344
+ | **Thermal Dissipation** | High (Thermal Throttling at ~3min) | Low to Moderate | Negligible |
345
+ | **Memory Allocation** | ~85 MB Heap | ~38 MB (GPU VRAM Mapped) | **0 MB Disk / < 2MB RAM** |
346
+
347
+ Offloading neural acoustic calculations to the Vulkan GPU protects CPU big cores from thermal throttling during prolonged text reading, maintaining consistent interactive responsiveness across Android background services.
348
+
349
+ ---
350
+
351
+ ## 9. Hardware Requirements & Operational Limits
352
+
353
+ ### 9.1 Hardware Specifications
354
+
355
+ | Specification Metric | Minimum Requirements | Recommended Production Spec |
356
+ | :--- | :--- | :--- |
357
+ | **Operating System** | Android 9.0+ (API level 28+) / Linux 5.4+ | Android 12.0+ (API level 31+) |
358
+ | **Architecture** | ARM64 (aarch64) or x86_64 | ARM64-v8a / v9a |
359
+ | **System RAM** | 2 GB Total (DSP Tier: 512 MB) | 4 GB+ Unified RAM |
360
+ | **Storage Footprint** | 10 MB (DSP Only) / 80 MB (Neural) | 250 MB Free Flash Storage |
361
+ | **GPU Subsystem** | Vulkan 1.1 Conforming Mobile Driver | Qualcomm Adreno 660 / 730 / 830 or Mali-G78+ |
362
+
363
+ ### 9.2 Known Operational Limits
364
+ - **32-Bit ARM (armeabi-v7a)**: Not supported for Vulkan GPU neural compute. Use Tier 1 DSP vocoder for legacy 32-bit hardware.
365
+ - **Headless SSH Environments**: Audio playback (`--play`) requires Termux-API or PulseAudio daemon running. To output directly without audio hardware, synthesize to `.wav` file.
366
+
367
+ ---
368
+
369
+ ## 10. 24/7 Unattended Background Execution Guide
370
+
371
+ Android aggressively kills background user-space processes running inside Termux unless battery and process monitor policies are explicitly configured. Follow these three stages to ensure uninterrupted 24/7 autonomous speech services:
372
+
373
+ ### 10.1 Stage 1: Termux Wake-Lock
374
+ Prevent the Android kernel from entering deep CPU sleep states:
375
+ ```bash
376
+ # Acquire persistent CPU wake-lock
377
+ termux-wake-lock
378
+ ```
379
+
380
+ ### 10.2 Stage 2: Android OS GUI Settings
381
+ 1. Navigate to **Android Settings > Apps > Termux > Battery**.
382
+ 2. Select **Unrestricted** (Disable battery optimization).
383
+ 3. Under **Permissions**, grant **Notifications** and **Display over other apps** (if applicable).
384
+
385
+ ### 10.3 Stage 3: ADB Phantom Process Killer Mitigation (Android 12+)
386
+ Android 12 introduced the Phantom Process Killer, which terminates child processes exceeding 32 instances or high CPU thresholds. Execute the following commands via PC ADB or wireless debugging:
387
+
388
+ ```bash
389
+ # Disable Android Phantom Process Killer
390
+ adb shell device_config put activity_manager max_phantom_processes 2147483647
391
+ adb shell settings put global settings_enable_monitor_phantom_procs false
392
+
393
+ # Verify configuration
394
+ adb shell settings get global settings_enable_monitor_phantom_procs
395
+ # Expected output: false
396
+ ```
397
+
398
+ ---
399
+
400
+ ## 11. Open Source License
401
+
402
+ Termux-TTS is open-sourced under the **Apache License, Version 2.0**.
403
+
404
+ ```text
405
+ Copyright 2026 Eunho Kim (@uno-km) & AMEVA Open-Source Foundation.
406
+
407
+ Licensed under the Apache License, Version 2.0 (the "License");
408
+ you may not use this file except in compliance with the License.
409
+ You may obtain a copy of the License at
410
+
411
+ http://www.apache.org/licenses/LICENSE-2.0
412
+
413
+ Unless required by applicable law or agreed to in writing, software
414
+ distributed under the License is distributed on an "AS IS" BASIS,
415
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
416
+ See the License for the specific language governing permissions and
417
+ limitations under the License.
418
+ ```
419
+
420
+ ### Key Licensing Permissions & Terms:
421
+ - **Commercial Use**: Permitted without royalty or proprietary source disclosure.
422
+ - **Modification & Distribution**: Permitted provided that modified files carry prominent notices.
423
+ - **Patent Grant**: Express grant of patent rights from contributors.
424
+ - **Trademark**: Does not grant permission to use project trademark names without prior written consent.
425
+ - **No Warranty & Limitation of Liability**: Software is provided strictly on an "AS IS" basis.
426
+
427
+ ---
428
+
429
+ ## 12. SEO Technical Keywords & Metadata
430
+
431
+ `tts`, `text-to-speech`, `vulkan`, `vulkan-compute`, `vits`, `piper-tts`, `sherpa-onnx`, `sherpa-ncnn`, `termux`, `android`, `on-device-ai`, `speech-synthesis`, `edge-ai`, `formant-synthesis`, `vocoder`, `mobile-ai`, `adreno`, `mali-gpu`, `dsp`, `rosenberg-glottal`, `biquad-filter`, `expressive-speech`, `voice-cloning`, `audio-generation`, `ncnn`, `arm64`, `snapdragon`, `exynos`, `real-time-factor`, `low-latency`, `zero-dependency`, `voice-assistant`, `headless-audio`, `embedded-systems`
432
+
433
+ ---
434
+
435
+ ## Official Documentation & Foundation Ecosystem
436
+ - **Official Documentation Portal**: [https://uno-km.vercel.app/lib/tts/](https://uno-km.vercel.app/lib/tts/)
437
+ - **GitHub Repository**: [https://github.com/uno-km/termux-tts](https://github.com/uno-km/termux-tts)
438
+ - **AMEVA Foundation Portal**: [https://uno-km.vercel.app/foundation/index.html](https://uno-km.vercel.app/foundation/index.html)