webmp3 commited on
Commit
db5e7eb
·
verified ·
1 Parent(s): c135cd1

Update documentation, clean LICENSE/NOTICE, add root config.json manifest, and sanitize quantization notes

Browse files
Files changed (7) hide show
  1. LICENSE +0 -17
  2. NOTICE.md +9 -0
  3. README.md +294 -219
  4. SHA256SUMS +6 -4
  5. config.json +19 -0
  6. docs/QUALITY.md +28 -29
  7. runtime/sanotts_onnx.py +13 -0
LICENSE CHANGED
@@ -1,20 +1,3 @@
1
- Sakura-sanoTTS-ONNX is licensed under the GNU General Public License v3.0 (GPL-3.0).
2
-
3
- Upstream sanoTTS project:
4
- Author: Ampixa
5
- Repository: https://huggingface.co/ampixa/sanoTTS
6
- License: GNU General Public License v3.0 (GPL-3.0)
7
- Copyright (C) 2026 Ampixa
8
-
9
- ONNX Export & Quantization:
10
- Sakura / webmp3
11
- Repository: https://huggingface.co/webmp3/Sakura-sanoTTS-ONNX
12
- Copyright (C) 2026 webmp3
13
-
14
- ==============================================================================
15
- GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
16
- ==============================================================================
17
-
18
  GNU GENERAL PUBLIC LICENSE
19
  Version 3, 29 June 2007
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  GNU GENERAL PUBLIC LICENSE
2
  Version 3, 29 June 2007
3
 
NOTICE.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # Attribution & Notice
2
+
3
+ Sakura-sanoTTS-ONNX is an independent ONNX/ONNX Runtime conversion and quantized derivative of ampixa/sanoTTS.
4
+
5
+ - **Original project**: https://huggingface.co/ampixa/sanoTTS
6
+ - **Original authors**: Ampixa
7
+ - **Derivative conversion and release**: webmp3 / Sakura
8
+
9
+ This project is not an official Ampixa release.
README.md CHANGED
@@ -1,219 +1,294 @@
1
- ---
2
- license: gpl-3.0
3
- language:
4
- - en
5
- - de
6
- - es
7
- - fr
8
- - it
9
- - pt
10
- - ru
11
- - vi
12
- - id
13
- pipeline_tag: text-to-speech
14
- tags:
15
- - text-to-speech
16
- - tts
17
- - speech
18
- - onnx
19
- - onnxruntime
20
- - cpu
21
- - quantization
22
- - int8
23
- - fp32
24
- - audio
25
- - piper
26
- - voice
27
- base_model: ampixa/sanoTTS
28
- base_model_relation: quantized
29
- library_name: onnxruntime
30
- ---
31
-
32
- # Sakura-sanoTTS-ONNX (CPU-Optimized)
33
-
34
- [![Hugging Face Model](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Sakura--sanoTTS--ONNX-orange)](https://huggingface.co/webmp3/Sakura-sanoTTS-ONNX)
35
- [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](LICENSE)
36
- [![ONNX Runtime](https://img.shields.io/badge/Runtime-ONNX%20Runtime%20CPU-green)](https://onnxruntime.ai)
37
-
38
- High-fidelity, CPU-optimized, and reproducible ONNX and INT8 release of **sanoTTS** ([ampixa/sanoTTS](https://huggingface.co/ampixa/sanoTTS)).
39
-
40
- Target platform: **Windows / Linux x86-64 CPU & ARM64**, running via the standard **ONNX Runtime CPU Execution Provider**. No GPU or CUDA required.
41
-
42
- ---
43
-
44
- ## 1. Voice Matrix (All 15 Voices)
45
-
46
- All 15 official sanoTTS voices have been successfully exported to **FP32** and quantized to **INT8-HQ**, verified against native test sentences:
47
-
48
- | Voice | Language | Sample Rate | Model Size (FP32) | Model Size (INT8-HQ) | FP32 Status | INT8-HQ Status | Note |
49
- |---|---|---:|---:|---:|---|---|---|
50
- | **`amy`** | `en_US` | 22,050 Hz | 5.59 MB | **3.84 MB** | ✅ Verified | ✅ Verified | English default voice, warm female timbre |
51
- | **`amy-1p1m`** | `en_US` | 22,050 Hz | 4.18 MB | **2.87 MB** | ✅ Verified | ✅ Verified | Ultra-compact English voice (1.1M params) |
52
- | **`amy-1p8m`** | `en_US` | 22,050 Hz | 7.04 MB | **5.29 MB** | ✅ Verified | ✅ Verified | High-capacity English voice (1.8M params) |
53
- | **`kristin`** | `en_US` | 22,050 Hz | 5.36 MB | **3.62 MB** | ✅ Verified | ✅ Verified | Expressive American English voice |
54
- | **`hfc`** | `en_US` | 22,050 Hz | 7.04 MB | **5.29 MB** | ✅ Verified | ✅ Verified | Clear studio-recorded English voice |
55
- | **`vi`** | `vi_VN` | 22,050 Hz | 6.01 MB | **4.70 MB** | ✅ Verified | ✅ Verified | Native Vietnamese tonal phonemization |
56
- | **`id`** | `id_ID` | 22,050 Hz | 6.00 MB | **4.69 MB** | ✅ Verified | ✅ Verified | Native Indonesian voice |
57
- | **`heart-nano`** | `en_US` | 24,000 Hz | 0.91 MB | **0.36 MB** | ✅ Verified | ✅ Verified | Ultra-tiny MCU nano model (294k params) |
58
- | **`heart`** | `en_US` | 24,000 Hz | 8.72 MB | **4.60 MB** | ✅ Verified | ✅ Verified | ConvNeXt1D neural vocoder model (2.27M params) |
59
- | **`de-thorsten`** | `de_DE` | 22,050 Hz | 1.99 MB | **1.39 MB** | ✅ Verified | ✅ Verified | High-quality German voice (Thorsten corpus) |
60
- | **`es-davefx`** | `es_ES` | 22,050 Hz | 1.98 MB | **1.39 MB** | ✅ Verified | ✅ Verified | Castilian Spanish voice |
61
- | **`fr-siwis`** | `fr_FR` | 22,050 Hz | 6.01 MB | **4.70 MB** | ✅ Verified | ✅ Verified | French female voice (Siwis corpus) |
62
- | **`it-serena`** | `it_IT` | 22,050 Hz | 1.99 MB | **1.39 MB** | ✅ Verified | ✅ Verified | Italian voice |
63
- | **`pt-cadu`** | `pt_BR` | 22,050 Hz | 1.99 MB | **1.39 MB** | ✅ Verified | ✅ Verified | Brazilian Portuguese voice |
64
- | **`ru-irina`** | `ru_RU` | 22,050 Hz | 1.99 MB | **1.39 MB** | ✅ Verified | ✅ Verified | Russian voice |
65
-
66
- ---
67
-
68
- ## 2. Architecture & Design
69
-
70
- The sanoTTS neural synthesis pipeline is partitioned into clean ONNX components:
71
-
72
- ```text
73
- [Text Input]
74
- │
75
- ▼ (Python Text Frontend / G2P)
76
- [Phoneme IDs]
77
- │
78
- ├───► duration.onnx (Duration prediction per phoneme token)
79
- │ │
80
- │ ▼
81
- │ [durations]
82
- └───┬────────┘
83
- ▼
84
- acoustic_token.onnx (Token-level context embedding)
85
- │
86
- ▼
87
- Context Expansion (Repeat according to token durations + positional feats)
88
- │
89
- ▼
90
- acoustic_frame.onnx (Frame-level convolutional blocks -> [1, 192, Frames])
91
- │
92
- ▼
93
- decoder.onnx (256x ConvTranspose1D upsampling + Multi-Branch Residual Banks)
94
- │
95
- ▼
96
- [Waveform PCM Audio] (22,050 Hz / 24,000 Hz float32)
97
- ```
98
-
99
- ### High-Quality INT8 Quantization Strategy
100
-
101
- 1. **Duration Network in FP32**: The duration predictor is kept in FP32 (535 KB). This guarantees **zero timing drift** and 100% frame-count match with the original unquantized model.
102
- 2. **Dynamic INT8 Decoder**: The decoder accounts for >85% of total computation and parameter count. It is quantized with dynamic per-channel `QInt8`.
103
- 3. **Mixed-Precision Post-Projection Protection**: The sensitive final 7-tap synthesis convolution (`/post/Conv`, 168 weights) remains in FP32. This prevents spectral distortion and reduced Mel-L1 error significantly from 0.761 down to **0.673**.
104
-
105
- ---
106
-
107
- ## 3. Audio Quality Evaluation
108
-
109
- Measured against the official unquantized sanoTTS NumPy reference across standardized test sentences:
110
-
111
- | Model Variant | Format | Cosine Similarity | RMS Error | Mel L1 Spectral Diff | Status |
112
- |---|---|---:|---:|---:|---|
113
- | **Original Baseline** | NumPy Reference | 1.000000 | 0.000000 | 0.0000 | Ground Truth |
114
- | **ONNX FP32** | ONNX | **1.000000** | **0.000018** | **0.0057** | Exact Parity |
115
- | **ONNX INT8 (HQ)** | ONNX INT8 | **0.995135** | **0.006614** | **0.6730** | High Fidelity |
116
-
117
- - Waveform cosine similarity of **0.9951** confirms near-perfect waveform reconstruction.
118
- - Zero audible artifacts, clicks, or phoneme cuts.
119
-
120
- ---
121
-
122
- ## 4. CPU Performance & Speed
123
-
124
- > [!NOTE]
125
- > Speed benchmarks were measured on standard x86-64 CPU. Absolute RTF numbers are labeled as preliminary due to background CPU tasks during profiling.
126
-
127
- | Variant | Decoder Params | Model Size | Typical RTF | Speedup Factor |
128
- |---|---:|---:|---:|---:|
129
- | **ONNX FP32** | 1.05M | 5.59 MB | ~0.030 | **~33x Real-Time** |
130
- | **ONNX INT8 (HQ)** | 1.05M (QInt8) | 3.84 MB | ~0.260 | **~3.8x Real-Time** |
131
-
132
- Both FP32 and INT8 comfortably achieve real-time speech synthesis on CPU without requiring any GPU acceleration.
133
-
134
- ---
135
-
136
- ## 5. Quickstart & Usage
137
-
138
- ### Installation
139
-
140
- ```bash
141
- pip install onnxruntime numpy scipy soundfile sanotts huggingface_hub
142
-
143
- # Optional: For non-English European languages (de, es, fr, it, pt, ru)
144
- pip install espeakng-loader
145
- ```
146
-
147
- ### CLI Synthesis
148
-
149
- ```bash
150
- # Synthesize with Amy (English, INT8-HQ)
151
- python synthesize.py --model voices/amy/int8-hq --text "Hello world! This is sanoTTS running on CPU." --output hello.wav
152
-
153
- # Synthesize with Thorsten (German, INT8-HQ)
154
- python synthesize.py --model voices/de-thorsten/int8-hq --text "Guten Tag, das ist ein Test der Sprachsynthese." --output thorsten.wav
155
-
156
- # Synthesize with Heart-Nano (MCU 294k params)
157
- python synthesize.py --model voices/heart-nano/int8-hq --text "Ultra compact TTS running locally." --output nano.wav
158
- ```
159
-
160
- ### Python API
161
-
162
- ```python
163
- from runtime.sanotts_onnx import SanoTTSOnnx
164
-
165
- # Load model (supports any voice in fp32 or int8-hq)
166
- tts = SanoTTSOnnx("voices/amy/int8-hq")
167
-
168
- # Synthesize speech
169
- audio = tts.synthesize("Hello! This is a CPU-optimized text to speech model.")
170
-
171
- # Save output WAV
172
- tts.save_wav("output.wav", audio)
173
- print(f"Synthesized {len(audio)} samples at {tts.sample_rate} Hz.")
174
- ```
175
-
176
- ---
177
-
178
- ## 6. Directory Structure
179
-
180
- ```text
181
- Sakura-sanoTTS-ONNX/
182
- ├── README.md
183
- ├── LICENSE
184
- ├── SHA256SUMS
185
- ├── requirements.txt
186
- ├── synthesize.py
187
- ├── runtime/
188
- │ ├── __init__.py
189
- │ └── sanotts_onnx.py
190
- ├── docs/
191
- │ ├── VOICE_RELEASE_MATRIX.md
192
- │ ├── QUALITY.md
193
- │ └── SPEED.md
194
- └── voices/
195
- ├── amy/ (fp32/ & int8-hq/)
196
- ├── amy-1p1m/ (fp32/ & int8-hq/)
197
- ├── amy-1p8m/ (fp32/ & int8-hq/)
198
- ├── kristin/ (fp32/ & int8-hq/)
199
- ├── hfc/ (fp32/ & int8-hq/)
200
- ├── vi/ (fp32/ & int8-hq/)
201
- ├── id/ (fp32/ & int8-hq/)
202
- ├── heart-nano/ (fp32/ & int8-hq/)
203
- ├── heart/ (fp32/ & int8-hq/)
204
- ├── de-thorsten/ (fp32/ & int8-hq/)
205
- ├── es-davefx/ (fp32/ & int8-hq/)
206
- ├── fr-siwis/ (fp32/ & int8-hq/)
207
- ├── it-serena/ (fp32/ & int8-hq/)
208
- ├── pt-cadu/ (fp32/ & int8-hq/)
209
- └── ru-irina/ (fp32/ & int8-hq/)
210
- ```
211
-
212
- ---
213
-
214
- ## 7. License & Attribution
215
-
216
- - **Base Model**: [ampixa/sanoTTS](https://huggingface.co/ampixa/sanoTTS)
217
- - **Copyright**: (C) 2026 Ampixa
218
- - **License**: **GNU General Public License v3.0 (GPL-3.0)**
219
- - **Release & Quantization**: Sakura / webmp3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: gpl-3.0
3
+ language:
4
+ - en
5
+ - de
6
+ - es
7
+ - fr
8
+ - it
9
+ - pt
10
+ - ru
11
+ - vi
12
+ - id
13
+ pipeline_tag: text-to-speech
14
+ tags:
15
+ - text-to-speech
16
+ - tts
17
+ - speech
18
+ - onnx
19
+ - onnxruntime
20
+ - cpu
21
+ - quantization
22
+ - int8
23
+ - fp32
24
+ - audio
25
+ - piper
26
+ - voice
27
+ base_model: ampixa/sanoTTS
28
+ base_model_relation: quantized
29
+ library_name: onnxruntime
30
+ ---
31
+
32
+ # Sakura-sanoTTS-ONNX (CPU-Optimized)
33
+
34
+ [![Hugging Face Model](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Sakura--sanoTTS--ONNX-orange)](https://huggingface.co/webmp3/Sakura-sanoTTS-ONNX)
35
+ [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](LICENSE)
36
+ [![ONNX Runtime](https://img.shields.io/badge/Runtime-ONNX%20Runtime%20CPU-green)](https://onnxruntime.ai)
37
+
38
+ High-fidelity, CPU-optimized, and reproducible ONNX and INT8 release of **sanoTTS** ([ampixa/sanoTTS](https://huggingface.co/ampixa/sanoTTS)).
39
+
40
+ Target platform: **Windows / Linux x86-64 CPU & ARM64**, running via the standard **ONNX Runtime CPU Execution Provider**. No GPU or CUDA required.
41
+
42
+ ---
43
+
44
+ ## 1. Which Variant to Choose?
45
+
46
+ Each of the 15 voices is available in two validated formats:
47
+
48
+ ### Choose FP32 if:
49
+ - Storage and download size are not critical.
50
+ - Maximum reference fidelity is the priority.
51
+ - x86-64 CPU performance is the main goal (measured as the fastest execution on x86 CPU).
52
+
53
+ ### Choose INT8-HQ if:
54
+ - Smaller model and download size matters (up to 60% smaller).
55
+ - Bandwidth, disk footprint, or memory is constrained.
56
+ - Compact edge or embedded deployment is targeted.
57
+
58
+ > [!NOTE]
59
+ > Current speed and RTF measurements are preliminary because the benchmarking system was running under parallel background CPU workloads.
60
+
61
+ ---
62
+
63
+ ## 2. Download a Single Voice
64
+
65
+ You **do not need to download the full repository** (which contains all 15 voices). Using the official Hugging Face CLI (`hf`), you can download only the specific voice and runtime files needed:
66
+
67
+ ### Example: German Thorsten INT8-HQ (~1.5 MB download)
68
+
69
+ **Linux / macOS:**
70
+ ```bash
71
+ hf download webmp3/Sakura-sanoTTS-ONNX \
72
+ --include "config.json" \
73
+ --include "voices/de-thorsten/int8-hq/*" \
74
+ --include "runtime/*" \
75
+ --include "synthesize.py" \
76
+ --include "requirements.txt" \
77
+ --local-dir Sakura-sanoTTS
78
+ ```
79
+
80
+ **Windows PowerShell:**
81
+ ```powershell
82
+ hf download webmp3/Sakura-sanoTTS-ONNX `
83
+ --include "config.json" `
84
+ --include "voices/de-thorsten/int8-hq/*" `
85
+ --include "runtime/*" `
86
+ --include "synthesize.py" `
87
+ --include "requirements.txt" `
88
+ --local-dir Sakura-sanoTTS
89
+ ```
90
+
91
+ **Run synthesis:**
92
+ ```powershell
93
+ cd Sakura-sanoTTS
94
+ pip install -r requirements.txt
95
+
96
+ python synthesize.py `
97
+ --model voices/de-thorsten/int8-hq `
98
+ --text "Guten Tag, dies ist ein Test." `
99
+ --output output.wav
100
+ ```
101
+
102
+ ---
103
+
104
+ ### Example: English Amy INT8-HQ (~4.0 MB download)
105
+
106
+ **Linux / macOS:**
107
+ ```bash
108
+ hf download webmp3/Sakura-sanoTTS-ONNX \
109
+ --include "config.json" \
110
+ --include "voices/amy/int8-hq/*" \
111
+ --include "runtime/*" \
112
+ --include "synthesize.py" \
113
+ --include "requirements.txt" \
114
+ --local-dir Sakura-sanoTTS
115
+ ```
116
+
117
+ **Windows PowerShell:**
118
+ ```powershell
119
+ hf download webmp3/Sakura-sanoTTS-ONNX `
120
+ --include "config.json" `
121
+ --include "voices/amy/int8-hq/*" `
122
+ --include "runtime/*" `
123
+ --include "synthesize.py" `
124
+ --include "requirements.txt" `
125
+ --local-dir Sakura-sanoTTS
126
+ ```
127
+
128
+ > **Tip:** Replace `de-thorsten` or `amy` with any voice name from the voice table below. To download an unquantized FP32 voice, replace `int8-hq` with `fp32` (e.g. `--include "voices/amy/fp32/*"`).
129
+
130
+ ---
131
+
132
+ ### Optional: Download Entire Repository (~114 MB)
133
+
134
+ To download all 15 voices across both FP32 and INT8-HQ:
135
+
136
+ ```bash
137
+ hf download webmp3/Sakura-sanoTTS-ONNX --local-dir Sakura-sanoTTS-ONNX
138
+ ```
139
+
140
+ ---
141
+
142
+ ## 3. Voice Matrix (All 15 Voices)
143
+
144
+ All 15 official sanoTTS voices have been successfully exported and verified:
145
+
146
+ | Voice | Language | Sample Rate | FP32 Size | INT8-HQ Size | Recommended Variant | Description |
147
+ |---|---|---:|---:|---:|---|---|
148
+ | **`amy`** | `en_US` | 22,050 Hz | 5.59 MB | **3.84 MB** | `FP32` (speed) / `INT8-HQ` (compact) | Default English female voice |
149
+ | **`amy-1p1m`** | `en_US` | 22,050 Hz | 4.18 MB | **2.87 MB** | `INT8-HQ` (compact) | Ultra-compact English model (1.1M params) |
150
+ | **`amy-1p8m`** | `en_US` | 22,050 Hz | 7.04 MB | **5.29 MB** | `FP32` (speed) / `INT8-HQ` (compact) | High-capacity English voice (1.8M params) |
151
+ | **`kristin`** | `en_US` | 22,050 Hz | 5.36 MB | **3.62 MB** | `FP32` (speed) / `INT8-HQ` (compact) | Expressive American English voice |
152
+ | **`hfc`** | `en_US` | 22,050 Hz | 7.04 MB | **5.29 MB** | `FP32` (speed) / `INT8-HQ` (compact) | Studio-recorded English voice |
153
+ | **`vi`** | `vi_VN` | 22,050 Hz | 6.01 MB | **4.70 MB** | `FP32` (speed) / `INT8-HQ` (compact) | Native Vietnamese tonal voice |
154
+ | **`id`** | `id_ID` | 22,050 Hz | 6.00 MB | **4.69 MB** | `FP32` (speed) / `INT8-HQ` (compact) | Native Indonesian voice |
155
+ | **`heart-nano`** | `en_US` | 24,000 Hz | 0.91 MB | **0.36 MB** | `INT8-HQ` (ultra-compact) | Ultra-tiny MCU nano model (294k params) |
156
+ | **`heart`** | `en_US` | 24,000 Hz | 8.72 MB | **4.60 MB** | `FP32` (speed) / `INT8-HQ` (compact) | ConvNeXt neural vocoder model (2.27M params) |
157
+ | **`de-thorsten`** | `de_DE` | 22,050 Hz | 1.99 MB | **1.39 MB** | `FP32` (speed) / `INT8-HQ` (compact) | German voice (Thorsten corpus) |
158
+ | **`es-davefx`** | `es_ES` | 22,050 Hz | 1.98 MB | **1.39 MB** | `FP32` (speed) / `INT8-HQ` (compact) | Castilian Spanish voice |
159
+ | **`fr-siwis`** | `fr_FR` | 22,050 Hz | 6.01 MB | **4.70 MB** | `FP32` (speed) / `INT8-HQ` (compact) | French female voice (Siwis corpus) |
160
+ | **`it-serena`** | `it_IT` | 22,050 Hz | 1.99 MB | **1.39 MB** | `FP32` (speed) / `INT8-HQ` (compact) | Italian voice |
161
+ | **`pt-cadu`** | `pt_BR` | 22,050 Hz | 1.99 MB | **1.39 MB** | `FP32` (speed) / `INT8-HQ` (compact) | Brazilian Portuguese voice |
162
+ | **`ru-irina`** | `ru_RU` | 22,050 Hz | 1.99 MB | **1.39 MB** | `FP32` (speed) / `INT8-HQ` (compact) | Russian voice |
163
+
164
+ ---
165
+
166
+ ## 4. Python API Usage
167
+
168
+ ```python
169
+ from runtime.sanotts_onnx import SanoTTSOnnx
170
+
171
+ # Load any voice directory (supports FP32 and INT8-HQ)
172
+ tts = SanoTTSOnnx("voices/amy/int8-hq")
173
+
174
+ # Synthesize audio waveform
175
+ audio = tts.synthesize("Hello world! This is sanoTTS running locally on ONNX Runtime.")
176
+
177
+ # Save as standard WAV file
178
+ tts.save_wav("output.wav", audio)
179
+ print(f"Synthesized {len(audio)} samples ({len(audio)/tts.sample_rate:.2f} s) at {tts.sample_rate} Hz.")
180
+ ```
181
+
182
+ ---
183
+
184
+ ## 5. Architecture & Quantization
185
+
186
+ The sanoTTS neural synthesis pipeline is modularly partitioned:
187
+
188
+ ```text
189
+ [Text Input]
190
+ │
191
+ ▼ (Python Text Frontend / G2P)
192
+ [Phoneme IDs]
193
+ │
194
+ ├───► duration.onnx (Phoneme duration prediction)
195
+ │ │
196
+ │ ▼
197
+ │ [durations]
198
+ └───┬────────┘
199
+ ▼
200
+ acoustic_token.onnx (Token-level context embedding)
201
+ │
202
+ ▼
203
+ Context Expansion (Repeat per token duration + positional features)
204
+ │
205
+ ▼
206
+ acoustic_frame.onnx (Frame-level convolutional blocks)
207
+ │
208
+ ▼
209
+ decoder.onnx (Convolutional upsampling + Residual Banks)
210
+ │
211
+ ▼
212
+ [Waveform PCM Audio] (22,050 Hz / 24,000 Hz float32)
213
+ ```
214
+
215
+ ### Quantization Methodology
216
+
217
+ - **Selective Mixed-Precision**: `INT8-HQ` uses selective mixed-precision quantization to preserve sensitive components while reducing overall model size.
218
+ - **Quality-Preserving Precision**: Sensitive operations are retained at higher precision where required by quality validation.
219
+ - **Deterministic Temporal Alignment**: The duration modeling preserves exact timing alignment relative to the unquantized reference.
220
+
221
+ ---
222
+
223
+ ## 6. Audio Quality Evaluation
224
+
225
+ Evaluated against the official unquantized sanoTTS reference across standardized test sentences:
226
+
227
+ | Model Variant | Format | Cosine Similarity | RMS Error | Mel L1 Spectral Diff | Status |
228
+ |---|---|---:|---:|---:|---|
229
+ | **Original Baseline** | NumPy Reference | 1.000000 | 0.000000 | 0.0000 | Ground Truth Reference |
230
+ | **ONNX FP32** | ONNX FP32 | **1.000000** | **0.000018** | **0.0057** | Reference Parity |
231
+ | **ONNX INT8-HQ** | ONNX INT8 | **0.995135** | **0.006614** | **0.6730** | High Fidelity |
232
+
233
+ - **Listening Evaluation**: No obvious audible degradation was observed in the current listening tests.
234
+ - **Timing Parity**: Identical sample count and zero timing drift relative to the unquantized baseline.
235
+
236
+ ---
237
+
238
+ ## 7. Preliminary CPU Performance
239
+
240
+ > [!NOTE]
241
+ > Measurements were performed on standard x86-64 CPU under parallel background system load. Absolute values are preliminary.
242
+
243
+ | Variant | Model Size | Typical RTF (Preliminary) | Compute Factor | Peak RAM |
244
+ |---|---:|---:|---:|---:|
245
+ | **ONNX FP32** | 5.59 MB | ~0.030 | **~33x Real-Time** | 222.8 MB |
246
+ | **ONNX INT8-HQ** | 3.84 MB | ~0.260 | **~3.8x Real-Time** | 222.2 MB |
247
+
248
+ Both FP32 and INT8 comfortably achieve real-time speech synthesis on CPU without requiring GPU acceleration.
249
+
250
+ ---
251
+
252
+ ## 8. Directory Structure
253
+
254
+ ```text
255
+ Sakura-sanoTTS-ONNX/
256
+ ├── README.md
257
+ ├── LICENSE
258
+ ├── NOTICE.md
259
+ ├── SHA256SUMS
260
+ ├── requirements.txt
261
+ ├── synthesize.py
262
+ ├── runtime/
263
+ │ ├── __init__.py
264
+ │ └── sanotts_onnx.py
265
+ ├── docs/
266
+ │ ├── VOICE_RELEASE_MATRIX.md
267
+ │ ├── QUALITY.md
268
+ │ └── SPEED.md
269
+ └── voices/
270
+ ├── amy/ (fp32/ & int8-hq/)
271
+ ├── amy-1p1m/ (fp32/ & int8-hq/)
272
+ ├── amy-1p8m/ (fp32/ & int8-hq/)
273
+ ├── kristin/ (fp32/ & int8-hq/)
274
+ ├── hfc/ (fp32/ & int8-hq/)
275
+ ├── vi/ (fp32/ & int8-hq/)
276
+ ├── id/ (fp32/ & int8-hq/)
277
+ ├── heart-nano/ (fp32/ & int8-hq/)
278
+ ├── heart/ (fp32/ & int8-hq/)
279
+ ├── de-thorsten/ (fp32/ & int8-hq/)
280
+ ├── es-davefx/ (fp32/ & int8-hq/)
281
+ ├── fr-siwis/ (fp32/ & int8-hq/)
282
+ ├── it-serena/ (fp32/ & int8-hq/)
283
+ ├── pt-cadu/ (fp32/ & int8-hq/)
284
+ └── ru-irina/ (fp32/ & int8-hq/)
285
+ ```
286
+
287
+ ---
288
+
289
+ ## 9. License & Attribution
290
+
291
+ - **Base Model**: [ampixa/sanoTTS](https://huggingface.co/ampixa/sanoTTS)
292
+ - **Original Authors**: Ampixa
293
+ - **License**: **GNU General Public License v3.0 (GPL-3.0)** (see [LICENSE](LICENSE))
294
+ - **Notice & Attribution**: Derivative conversion by Sakura / webmp3 (see [NOTICE.md](NOTICE.md)). This project is not an official Ampixa release.
SHA256SUMS CHANGED
@@ -1,11 +1,13 @@
1
- 098e799d76c348aa7e739228eb4943d29d16f77dd0568b2438634c099e0231be LICENSE
2
- f7c19137397ae2406f99b992fc8e12adfebcec9e122cd7ed46477a30ec164b8e README.md
3
- b16f4ad053dc2bff77b92fad85e8827d190befe012ed9fe579174c2093b1b7c5 docs/QUALITY.md
 
 
4
  3eaf621abd4797bc39cad459a6d6926272ec2b82e6917b892324239ebba9918b docs/SPEED.md
5
  e9bda1df73ef3b7a50da8165e15ccf60f985197744c7d3fec169aad3be90aac2 docs/VOICE_RELEASE_MATRIX.md
6
  a8276719837f3759442669070f2fab3cb11f6b01bcca1058538a7dce1ae8bb5b requirements.txt
7
  4cbacc2d2110ab63a194367af9b8cfc70bbc73ecb99f84b11eabda560ba1cd19 runtime/__init__.py
8
- 57f5fbc4a8d7811a3a9cf1a0e6d3d12e9a9c36a882c8d5a9eb762d905eebfaa5 runtime/sanotts_onnx.py
9
  3fd8a48b505e708b20d83f22c89e4540e657453b2dcffba793abb37b1ea8b1ac synthesize.py
10
  37b702f8b235242b0af6879bd061bc66085c5bfbcb82f10f31ef8ba9600435eb voices/amy-1p1m/fp32/acoustic_frame.onnx
11
  4f1402c7a7741835b441ffc72652d03aeb7c9f8cca1c9a0e080fa0b8dc40e632 voices/amy-1p1m/fp32/acoustic_token.onnx
 
1
+ 0b383d5a63da644f628d99c33976ea6487ed89aaa59f0b3257992deac1171e6b LICENSE
2
+ 180216ded255a6b5989ceae86866f4a720da84eb3ebd124587723497fc6e6c48 NOTICE.md
3
+ 2c165d89b3928a1535ba3d7614ebed51b8ce85b733c3a397d965a11336171d8f README.md
4
+ e77f6d1aeda3c5415fc146de8819d30d4e504279cdb611a1a2ca85fbca8ec7cd config.json
5
+ dc94f59dc445304bad85e7c46e1c4d45cbbdf4988864928ccdb66010ee5a7ae5 docs/QUALITY.md
6
  3eaf621abd4797bc39cad459a6d6926272ec2b82e6917b892324239ebba9918b docs/SPEED.md
7
  e9bda1df73ef3b7a50da8165e15ccf60f985197744c7d3fec169aad3be90aac2 docs/VOICE_RELEASE_MATRIX.md
8
  a8276719837f3759442669070f2fab3cb11f6b01bcca1058538a7dce1ae8bb5b requirements.txt
9
  4cbacc2d2110ab63a194367af9b8cfc70bbc73ecb99f84b11eabda560ba1cd19 runtime/__init__.py
10
+ f2af96b8f4abdb3653d5cfa67e11e12ccb344c640f5a97aaf901ff71802b720c runtime/sanotts_onnx.py
11
  3fd8a48b505e708b20d83f22c89e4540e657453b2dcffba793abb37b1ea8b1ac synthesize.py
12
  37b702f8b235242b0af6879bd061bc66085c5bfbcb82f10f31ef8ba9600435eb voices/amy-1p1m/fp32/acoustic_frame.onnx
13
  4f1402c7a7741835b441ffc72652d03aeb7c9f8cca1c9a0e080fa0b8dc40e632 voices/amy-1p1m/fp32/acoustic_token.onnx
config.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model_type": "sanotts",
3
+ "format": "onnx",
4
+ "runtime": "onnxruntime",
5
+ "default_precision": "int8-hq",
6
+ "base_model": "ampixa/sanoTTS",
7
+ "voices_root": "voices",
8
+ "languages": [
9
+ "en",
10
+ "de",
11
+ "es",
12
+ "fr",
13
+ "it",
14
+ "pt",
15
+ "ru",
16
+ "vi",
17
+ "id"
18
+ ]
19
+ }
docs/QUALITY.md CHANGED
@@ -1,29 +1,28 @@
1
- # sanoTTS ONNX: Audioqualitäts-Benchmark
2
-
3
- Evaluation der Audioqualität über alle 5 standardisierten Testsätze im direkten Vergleich zur originalen NumPy-Referenz (`ampixa/sanoTTS`).
4
-
5
- ## 1. Zusammenfassung (Durchschnitt über alle Testsätze)
6
-
7
- | Modellvariante | Format | Cosine Similarity | RMS Error | Mel L1 Diff | STFT L1 Diff | Peak Diff | Status |
8
- |---|---|---:|---:|---:|---:|---:|---|
9
- | **Original Baseline** | NumPy Reference | 1.000000 | 0.000000 | 0.0000 | 0.0000 | 0.0000 | Ground Truth |
10
- | **ONNX FP32** | ONNX | 1.000000 | 0.000018 | 0.0057 | 0.0000 | 0.000016 | Exakt (>0.9999) |
11
- | **ONNX INT8 (HQ)** | ONNX | 0.995135 | 0.006614 | 0.6730 | 0.0001 | 0.006641 | Exzellent (>0.99) |
12
- | **ONNX INT8 (Compact)** | ONNX | 0.984938 | 0.011408 | 0.6729 | 0.0001 | 0.005670 | Sehr gut (>0.98) |
13
-
14
- ## 2. Einzelergebnisse pro Testsatz (ONNX INT8 High-Quality)
15
-
16
- | ID | Testsatz | Cosine Similarity | RMS Error | Mel L1 Diff |
17
- |---|---|---:|---:|---:|
18
- | `sentence_01` | "Hello, this is a test of the sano TTS model." | 0.994923 | 0.006901 | 0.5931 |
19
- | `sentence_02` | "The quick brown fox jumps over the lazy dog." | 0.996201 | 0.006260 | 0.6329 |
20
- | `sentence_03` | "Today is October sixth, twenty twenty-six." | 0.994155 | 0.007006 | 0.5746 |
21
- | `sentence_04` | "Numbers: one, two, three, forty-two, one hundred and twenty." | 0.996363 | 0.005854 | 0.9146 |
22
- | `sentence_05` | "This sentence contains punctuation, commas, pauses, and a question?" | 0.994033 | 0.007046 | 0.6498 |
23
-
24
- ## 3. Bewertung der Sprachqualität & Fazit
25
-
26
- - **ONNX FP32 Parität**: Erreicht eine durchschnittliche Cosine Similarity von **1.000000** und einen RMS-Fehler von **0.000018**, was reines 32-Bit-Gleitkommarunden darstellt. Die Audioausgabe ist numerisch und akustisch identisch zum Original.
27
- - **ONNX INT8 (HQ)**: Erreicht eine außergewöhnlich hohe Cosine Similarity von **0.9951** auf den Rohdaten der Audiosignale bei einem Mel-L1-Fehler von lediglich **0.673**. Keine hörbare Degradation, Knackser, Artefakte oder Timing-Verschiebungen.
28
- - **Timing & Prosodie**: Da das Duration-Netzwerk im INT8-HQ-Build in FP32 belassen wird (535 KB), stimmen alle Phonem-Längen exakt 1:1 mit dem Original überein (0 Samples Drift).
29
- - **Quantisierungs-Sensitivität**: Das Ausschließen der 7-Tap Ausgangsprojektionsschicht (`/post/Conv`, 168 Parameter) bewahrte den Mel-Spektralfehler auf niedrigstem Niveau.
 
1
+ # sanoTTS ONNX: Audioqualitäts-Benchmark
2
+
3
+ Evaluation der Audioqualität über alle 5 standardisierten Testsätze im direkten Vergleich zur originalen NumPy-Referenz (`ampixa/sanoTTS`).
4
+
5
+ ## 1. Zusammenfassung (Durchschnitt über alle Testsätze)
6
+
7
+ | Modellvariante | Format | Cosine Similarity | RMS Error | Mel L1 Diff | STFT L1 Diff | Peak Diff | Status |
8
+ |---|---|---:|---:|---:|---:|---:|---|
9
+ | **Original Baseline** | NumPy Reference | 1.000000 | 0.000000 | 0.0000 | 0.0000 | 0.0000 | Ground Truth Referenz |
10
+ | **ONNX FP32** | ONNX FP32 | 1.000000 | 0.000018 | 0.0057 | 0.0000 | 0.000016 | Hohe Parität (>0.9999) |
11
+ | **ONNX INT8-HQ** | ONNX INT8 | 0.995135 | 0.006614 | 0.6730 | 0.0001 | 0.006641 | Hohe Wiedergabetreue (>0.99) |
12
+
13
+ ## 2. Einzelergebnisse pro Testsatz (ONNX INT8-HQ)
14
+
15
+ | ID | Testsatz | Cosine Similarity | RMS Error | Mel L1 Diff |
16
+ |---|---|---:|---:|---:|
17
+ | `sentence_01` | "Hello, this is a test of the sano TTS model." | 0.994923 | 0.006901 | 0.5931 |
18
+ | `sentence_02` | "The quick brown fox jumps over the lazy dog." | 0.996201 | 0.006260 | 0.6329 |
19
+ | `sentence_03` | "Today is October sixth, twenty twenty-six." | 0.994155 | 0.007006 | 0.5746 |
20
+ | `sentence_04` | "Numbers: one, two, three, forty-two, one hundred and twenty." | 0.996363 | 0.005854 | 0.9146 |
21
+ | `sentence_05` | "This sentence contains punctuation, commas, pauses, and a question?" | 0.994033 | 0.007046 | 0.6498 |
22
+
23
+ ## 3. Bewertung der Sprachqualität
24
+
25
+ - **ONNX FP32**: Erreicht eine durchschnittliche Cosine Similarity von **1.000000** und einen RMS-Fehler von **0.000018**. Die Waveform-Rekonstruktion stimmt innerhalb üblicher 32-Bit-Gleitkommatoleranzen mit der Referenz überein.
26
+ - **ONNX INT8-HQ**: Erreicht eine Cosine Similarity von **0.9951** auf den Rohdaten der Audiosignale bei einer geringen Mel-L1-Differenz von **0.673**. In den durchgeführten Hörtests wurde keine auffällige hörbare Degradation beobachtet.
27
+ - **Timing & Prosodie**: Die Dauerbestimmung pro Phonem-Token zeigt keinen Timing-Drift im Vergleich zur unquantisierten Referenz (identische Sample-Anzahl).
28
+ - **Selektive Mixed-Precision**: INT8-HQ nutzt gezielte Mixed-Precision-Quantisierung, um sensitive Komponenten zu schützen und gleichzeitig die Modellgröße signifikant zu reduzieren. Sensitivere Operationen verbleiben dort in höherer Präzision, wo dies durch die Qualitätsvalidierung gefordert ist.
 
runtime/sanotts_onnx.py CHANGED
@@ -44,6 +44,19 @@ class SanoTTSOnnx:
44
 
45
  self.is_nano = (self.model_dir / "meta.json").is_file() and not (self.model_dir / "piper-phoneme-config.json").is_file()
46
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  if self.is_nano:
48
  self._init_nano()
49
  else:
 
44
 
45
  self.is_nano = (self.model_dir / "meta.json").is_file() and not (self.model_dir / "piper-phoneme-config.json").is_file()
46
 
47
+ # Optional root release manifest detection
48
+ self.root_manifest = None
49
+ for candidate in [self.model_dir.parent.parent / "config.json", Path("config.json")]:
50
+ if candidate.is_file():
51
+ try:
52
+ with open(candidate, "r", encoding="utf-8") as f:
53
+ meta = json.load(f)
54
+ if meta.get("model_type") == "sanotts":
55
+ self.root_manifest = meta
56
+ break
57
+ except Exception:
58
+ pass
59
+
60
  if self.is_nano:
61
  self._init_nano()
62
  else: