Instructions to use litert-community/tiny-voca with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LiteRT
How to use litert-community/tiny-voca with LiteRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Add n4ze3m/tiny-voca as one LiteRT file for the CPU
Browse files- tiny-voca_fp32.tflite: the whole model as one float32 graph, one utterance of up to 16.4 s per call
- speak_tiny_voca.py, which speaks English text to a WAV file with Python
- the publisher's LICENSE (Apache License 2.0), unchanged
- the model card: CPU speeds on a Snapdragon Galaxy S26 and a Pixel 11 Pro, the audio compared with the publisher's model, the commands, and the GPU, which did not run this file on either phone with LiteRT 2.3.0
- LICENSE +202 -0
- README.md +125 -0
- speak_tiny_voca.py +202 -0
- tiny-voca_fp32.tflite +3 -0
LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
Apache License
|
| 3 |
+
Version 2.0, January 2004
|
| 4 |
+
http://www.apache.org/licenses/
|
| 5 |
+
|
| 6 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 7 |
+
|
| 8 |
+
1. Definitions.
|
| 9 |
+
|
| 10 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 11 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 12 |
+
|
| 13 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 14 |
+
the copyright owner that is granting the License.
|
| 15 |
+
|
| 16 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 17 |
+
other entities that control, are controlled by, or are under common
|
| 18 |
+
control with that entity. For the purposes of this definition,
|
| 19 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 20 |
+
direction or management of such entity, whether by contract or
|
| 21 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 22 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 23 |
+
|
| 24 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 25 |
+
exercising permissions granted by this License.
|
| 26 |
+
|
| 27 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 28 |
+
including but not limited to software source code, documentation
|
| 29 |
+
source, and configuration files.
|
| 30 |
+
|
| 31 |
+
"Object" form shall mean any form resulting from mechanical
|
| 32 |
+
transformation or translation of a Source form, including but
|
| 33 |
+
not limited to compiled object code, generated documentation,
|
| 34 |
+
and conversions to other media types.
|
| 35 |
+
|
| 36 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 37 |
+
Object form, made available under the License, as indicated by a
|
| 38 |
+
copyright notice that is included in or attached to the work
|
| 39 |
+
(an example is provided in the Appendix below).
|
| 40 |
+
|
| 41 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 42 |
+
form, that is based on (or derived from) the Work and for which the
|
| 43 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 44 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 45 |
+
of this License, Derivative Works shall not include works that remain
|
| 46 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 47 |
+
the Work and Derivative Works thereof.
|
| 48 |
+
|
| 49 |
+
"Contribution" shall mean any work of authorship, including
|
| 50 |
+
the original version of the Work and any modifications or additions
|
| 51 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 52 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 53 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 54 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 55 |
+
means any form of electronic, verbal, or written communication sent
|
| 56 |
+
to the Licensor or its representatives, including but not limited to
|
| 57 |
+
communication on electronic mailing lists, source code control systems,
|
| 58 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 59 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 60 |
+
excluding communication that is conspicuously marked or otherwise
|
| 61 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 62 |
+
|
| 63 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 64 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 65 |
+
subsequently incorporated within the Work.
|
| 66 |
+
|
| 67 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 68 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 69 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 70 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 71 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 72 |
+
Work and such Derivative Works in Source or Object form.
|
| 73 |
+
|
| 74 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 75 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 76 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 77 |
+
(except as stated in this section) patent license to make, have made,
|
| 78 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 79 |
+
where such license applies only to those patent claims licensable
|
| 80 |
+
by such Contributor that are necessarily infringed by their
|
| 81 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 82 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 83 |
+
institute patent litigation against any entity (including a
|
| 84 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 85 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 86 |
+
or contributory patent infringement, then any patent licenses
|
| 87 |
+
granted to You under this License for that Work shall terminate
|
| 88 |
+
as of the date such litigation is filed.
|
| 89 |
+
|
| 90 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 91 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 92 |
+
modifications, and in Source or Object form, provided that You
|
| 93 |
+
meet the following conditions:
|
| 94 |
+
|
| 95 |
+
(a) You must give any other recipients of the Work or
|
| 96 |
+
Derivative Works a copy of this License; and
|
| 97 |
+
|
| 98 |
+
(b) You must cause any modified files to carry prominent notices
|
| 99 |
+
stating that You changed the files; and
|
| 100 |
+
|
| 101 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 102 |
+
that You distribute, all copyright, patent, trademark, and
|
| 103 |
+
attribution notices from the Source form of the Work,
|
| 104 |
+
excluding those notices that do not pertain to any part of
|
| 105 |
+
the Derivative Works; and
|
| 106 |
+
|
| 107 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 108 |
+
distribution, then any Derivative Works that You distribute must
|
| 109 |
+
include a readable copy of the attribution notices contained
|
| 110 |
+
within such NOTICE file, excluding those notices that do not
|
| 111 |
+
pertain to any part of the Derivative Works, in at least one
|
| 112 |
+
of the following places: within a NOTICE text file distributed
|
| 113 |
+
as part of the Derivative Works; within the Source form or
|
| 114 |
+
documentation, if provided along with the Derivative Works; or,
|
| 115 |
+
within a display generated by the Derivative Works, if and
|
| 116 |
+
wherever such third-party notices normally appear. The contents
|
| 117 |
+
of the NOTICE file are for informational purposes only and
|
| 118 |
+
do not modify the License. You may add Your own attribution
|
| 119 |
+
notices within Derivative Works that You distribute, alongside
|
| 120 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 121 |
+
that such additional attribution notices cannot be construed
|
| 122 |
+
as modifying the License.
|
| 123 |
+
|
| 124 |
+
You may add Your own copyright statement to Your modifications and
|
| 125 |
+
may provide additional or different license terms and conditions
|
| 126 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 127 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 128 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 129 |
+
the conditions stated in this License.
|
| 130 |
+
|
| 131 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 132 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 133 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 134 |
+
this License, without any additional terms or conditions.
|
| 135 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 136 |
+
the terms of any separate license agreement you may have executed
|
| 137 |
+
with Licensor regarding such Contributions.
|
| 138 |
+
|
| 139 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 140 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 141 |
+
except as required for reasonable and customary use in describing the
|
| 142 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 143 |
+
|
| 144 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 145 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 146 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 147 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 148 |
+
implied, including, without limitation, any warranties or conditions
|
| 149 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 150 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 151 |
+
appropriateness of using or redistributing the Work and assume any
|
| 152 |
+
risks associated with Your exercise of permissions under this License.
|
| 153 |
+
|
| 154 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 155 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 156 |
+
unless required by applicable law (such as deliberate and grossly
|
| 157 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 158 |
+
liable to You for damages, including any direct, indirect, special,
|
| 159 |
+
incidental, or consequential damages of any character arising as a
|
| 160 |
+
result of this License or out of the use or inability to use the
|
| 161 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 162 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 163 |
+
other commercial damages or losses), even if such Contributor
|
| 164 |
+
has been advised of the possibility of such damages.
|
| 165 |
+
|
| 166 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 167 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 168 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 169 |
+
or other liability obligations and/or rights consistent with this
|
| 170 |
+
License. However, in accepting such obligations, You may act only
|
| 171 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 172 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 173 |
+
defend, and hold each Contributor harmless for any liability
|
| 174 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 175 |
+
of your accepting any such warranty or additional liability.
|
| 176 |
+
|
| 177 |
+
END OF TERMS AND CONDITIONS
|
| 178 |
+
|
| 179 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 180 |
+
|
| 181 |
+
To apply the Apache License to your work, attach the following
|
| 182 |
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
| 183 |
+
replaced with your own identifying information. (Don't include
|
| 184 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 185 |
+
comment syntax for the file format. We also recommend that a
|
| 186 |
+
file or class name and description of purpose be included on the
|
| 187 |
+
same "printed page" as the copyright notice for easier
|
| 188 |
+
identification within third-party archives.
|
| 189 |
+
|
| 190 |
+
Copyright [yyyy] [name of copyright owner]
|
| 191 |
+
|
| 192 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 193 |
+
you may not use this file except in compliance with the License.
|
| 194 |
+
You may obtain a copy of the License at
|
| 195 |
+
|
| 196 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 197 |
+
|
| 198 |
+
Unless required by applicable law or agreed to in writing, software
|
| 199 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 200 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 201 |
+
See the License for the specific language governing permissions and
|
| 202 |
+
limitations under the License.
|
README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language: [en]
|
| 4 |
+
pipeline_tag: text-to-speech
|
| 5 |
+
base_model: n4ze3m/tiny-voca
|
| 6 |
+
base_model_relation: quantized
|
| 7 |
+
library_name: litert
|
| 8 |
+
tags: [litert, tflite, android, text-to-speech, tiny-voca]
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# tiny-voca for LiteRT
|
| 12 |
+
|
| 13 |
+
This repository holds [n4ze3m/tiny-voca](https://huggingface.co/n4ze3m/tiny-voca), an English text-to-speech model with 4.5 million parameters, two voices and 24 kHz audio, as one LiteRT `.tflite` file for the CPU, tested on two Android phones and a Mac. One call of the file speaks one utterance of up to 16.4 s. For an utterance of 10.9 s, the median call took 173.5–181.5 ms in three processes on a Snapdragon Galaxy S26 with 4 threads (60–63× faster than real time) and 447.9 ms on a Pixel 11 Pro with 1 thread (24×), measured on 2026-11-30. Speed still being tuned (updates follow).
|
| 14 |
+
|
| 15 |
+
On 32 test utterances, the audio from both phones matches the publisher's PyTorch model given the same noise input: every phoneme has the same duration, and the signal-to-noise ratio against the publisher's audio is at least 50.8 dB ([Accuracy](#accuracy)).
|
| 16 |
+
|
| 17 |
+
With Python, `speak_tiny_voca.py` turns English text into a WAV file with one command, after the downloads and installs in [Use it](#use-it) (we ran it on a Mac). In an Android app, call the file with the inputs and outputs listed under [How it works](#how-it-works). The text-to-phoneme step (dizione, a Python package) is not in the file. For the phone runs, the phoneme ids were made beforehand on a Mac. With LiteRT 2.3.0, the GPU did not run this file on either phone: creating the `CompiledModel` with LiteRT's GPU accelerator failed ([Notes](#notes)). Run the file on the CPU.
|
| 18 |
+
|
| 19 |
+
## Files
|
| 20 |
+
|
| 21 |
+
| file | bytes | what |
|
| 22 |
+
|---|---|---|
|
| 23 |
+
| `tiny-voca_fp32.tflite` | 23,375,628 | the whole model, waveform generator included, as one float32 graph with builtin LiteRT operators only |
|
| 24 |
+
| `speak_tiny_voca.py` | 8,273 | speaks English text to a WAV file with Python: dizione makes the phoneme ids, then the graph runs once per utterance with ai-edge-litert |
|
| 25 |
+
| `LICENSE` | 11,358 | the publisher's license file (Apache License 2.0), unchanged |
|
| 26 |
+
|
| 27 |
+
## How it works
|
| 28 |
+
|
| 29 |
+
English text → sentences → dizione: phoneme ids and stress → `tiny-voca_fp32.tflite`, one call per utterance → 24 kHz audio, joined → WAV
|
| 30 |
+
|
| 31 |
+
- **Front end** (on the host, outside the file). [dizione](https://github.com/n4ze3m/dizione/tree/8cd889e4de7be6bd1dd2e6891344a0729fa14dd4), the publisher's English front end, turns a sentence into phoneme ids, with start and end tokens, and one stress value per id. The ids are the values of `vocab` in the publisher's [`config.json`](https://huggingface.co/n4ze3m/tiny-voca/blob/5fe06641d0afecb3c04bc9faca2cf64d9b2b1600/config.json). dizione reads its data from the folder that the `DIZIONE_DATA` variable names: the publisher's `phonemizer/` folder.
|
| 32 |
+
- **Graph** (signature `serving_default`). Each call takes one utterance at fixed sizes: 256 phoneme ids and 1,536 frames of 256 samples.
|
| 33 |
+
|
| 34 |
+
| input | type | size | meaning |
|
| 35 |
+
|---|---|---|---|
|
| 36 |
+
| `tokens` | int32 | [1, 256] | phoneme ids, start and end tokens included, then 0 |
|
| 37 |
+
| `stress` | int32 | [1, 256] | 0 none, 1 primary, 2 secondary; 0 after the ids |
|
| 38 |
+
| `voice` | int32 | [1] | 0 = F2 (female), 1 = M2 (male) |
|
| 39 |
+
| `speed` | float32 | [1] | 1.0 as predicted; larger is faster |
|
| 40 |
+
| `pitch_shift` | float32 | [1] | added to log F0; 0.058 is about one semitone |
|
| 41 |
+
| `pitch_range` | float32 | [1] | scales the movement of log F0 around its mean over the utterance's voiced frames |
|
| 42 |
+
| `noise` | float32 | [1, 393216] | standard-normal noise for the waveform generator |
|
| 43 |
+
|
| 44 |
+
| output | type | size | meaning |
|
| 45 |
+
|---|---|---|---|
|
| 46 |
+
| `audio` | float32 | [1, 393216] | 24 kHz waveform: when `total_frames` is at most 1,536, the first `total_frames` × 256 samples are the utterance and the rest is 0 |
|
| 47 |
+
| `durations` | int32 | [1, 256] | frames per phoneme id; 0 after the ids |
|
| 48 |
+
| `total_frames` | int32 | [1] | the sum of `durations`; above 1,536, the utterance did not fit in the call |
|
| 49 |
+
|
| 50 |
+
- **Longer text.** `speak_tiny_voca.py` reads text the way the publisher's `speak_text` does: it splits the text into sentences and speaks each sentence in one call when it fits. A sentence of more than 244 phoneme ids (256 minus 12, as the publisher's code takes 12 from its own 512), or one longer than 1,536 frames, is split at each comma, semicolon, colon or dash (—) that a space follows, else into two halves by words, and each part is read the same way; a single word that is still too long stops the script with an error. The publisher's code allows 500 ids and 3,000 frames (32 s) per call, so this script can split a sentence that the publisher's code speaks in one call.
|
| 51 |
+
- **Noise and peak.** The script draws the noise with NumPy (`numpy.random.default_rng(seed).standard_normal`), with seed + n for utterance n, counting from 0. It joins the utterances and, as the publisher's code does, scales the audio down to a peak of 0.99 if it goes above that.
|
| 52 |
+
|
| 53 |
+
## Use it
|
| 54 |
+
|
| 55 |
+
### 1. Download
|
| 56 |
+
|
| 57 |
+
<!-- usage:download -->
|
| 58 |
+
```bash
|
| 59 |
+
pip install -U huggingface_hub
|
| 60 |
+
hf download litert-community/tiny-voca --local-dir tiny-voca
|
| 61 |
+
hf download n4ze3m/tiny-voca --revision 5fe06641d0afecb3c04bc9faca2cf64d9b2b1600 --include "phonemizer/*" --local-dir tiny-voca
|
| 62 |
+
cd tiny-voca
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
The second `hf download` adds dizione's data files from the publisher's repository, in `phonemizer/`.
|
| 66 |
+
|
| 67 |
+
### 2. Install
|
| 68 |
+
|
| 69 |
+
<!-- usage:install -->
|
| 70 |
+
```bash
|
| 71 |
+
pip install ai-edge-litert==2.3.0 numpy soundfile git+https://github.com/n4ze3m/dizione@8cd889e4de7be6bd1dd2e6891344a0729fa14dd4
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
### 3. Speak
|
| 75 |
+
|
| 76 |
+
<!-- usage:speak -->
|
| 77 |
+
```bash
|
| 78 |
+
DIZIONE_DATA=phonemizer python speak_tiny_voca.py --model tiny-voca_fp32.tflite --voice F2 --text "Hello! This is tiny voca." --output hello.wav
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
The script writes `hello.wav` (mono, 24 kHz, 32-bit float samples) and prints one JSON line with the output file, the voice, the sample rate, the number of samples, the peak before and after scaling, and each utterance's text, durations and number of samples. `--voice M2` picks the male voice, `--text-file` reads the text from a file, and `--speed`, `--pitch-shift` and `--pitch-range` set the graph inputs `speed`, `pitch_shift` and `pitch_range`. `--seed` (0 by default) sets the noise.
|
| 82 |
+
|
| 83 |
+
Run as written on 2026-11-30 on a Mac (Apple silicon, macOS 27.0), in a new Python 3.12.13 venv (pip installed huggingface_hub 2.5.0, numpy 2.5.5 and soundfile 0.14.0): it wrote `hello.wav`, 56,320 samples (2.35 s) of mono 24 kHz 32-bit float audio, and printed the JSON line for its two utterances.
|
| 84 |
+
|
| 85 |
+
## Accuracy
|
| 86 |
+
|
| 87 |
+
The reference is the publisher's model: `tiny-voca.pt` in float32 on a Mac's CPU (PyTorch 2.13.0, the model's own `synthesize` call), with the graph's noise input fed to its waveform generator. The 32 test utterances are the four sample texts of the publisher's card and the ten texts of the publisher's [`js/test/sentences.json`](https://github.com/n4ze3m/tiny-voca/blob/b4603fc4e2baf08b1f91ea3d6ce8591e8eacffe7/js/test/sentences.json), each in both voices, and four more runs of the first card text in F2: at speed 1.3 and 0.8, and at pitch shift 0.058 and −0.058.
|
| 88 |
+
|
| 89 |
+
| where the file ran | same durations as the reference | lowest SNR against the reference |
|
| 90 |
+
|---|---|---|
|
| 91 |
+
| Mac CPU (ai-edge-litert 2.3.0) | 32 of 32 utterances | 53.14 dB |
|
| 92 |
+
| Snapdragon Galaxy S26 CPU, 4 threads | 32 of 32 utterances | 51.86 dB |
|
| 93 |
+
| Pixel 11 Pro CPU, 4 threads | 32 of 32 utterances | 50.81 dB |
|
| 94 |
+
|
| 95 |
+
SNR = 20 · log10(‖reference‖ / ‖the file's audio − reference‖), over the utterance's samples (`total_frames` × 256). Before the phone runs we set the bar: the same durations and at least 40 dB on every utterance.
|
| 96 |
+
|
| 97 |
+
## Speed
|
| 98 |
+
|
| 99 |
+
One call of the file on the longest test utterance (F2, "After a long and difficult journey across the mountains, …"; 169 phoneme ids, 1,022 frames = 10.9 s of audio), on the CPU:
|
| 100 |
+
|
| 101 |
+
| phone | threads | one call, median (ms) | range of the 3 calls (ms) | × real time |
|
| 102 |
+
|---|---|---|---|---|
|
| 103 |
+
| Snapdragon Galaxy S26 | 4 | 173.5 | 161.6–184.4 | 63× |
|
| 104 |
+
| Snapdragon Galaxy S26 | 4 | 179.4 | 175.1–183.6 | 61× |
|
| 105 |
+
| Snapdragon Galaxy S26 | 4 | 181.5 | 181.2–184.7 | 60× |
|
| 106 |
+
| Snapdragon Galaxy S26 | 1 | 225.7 | 223.9–226.9 | 48× |
|
| 107 |
+
| Pixel 11 Pro | 4 | 1,074.6 | 611.9–1,187.3 | 10× |
|
| 108 |
+
| Pixel 11 Pro | 4 | 756.2 | 675.1–1,062.6 | 14× |
|
| 109 |
+
| Pixel 11 Pro | 4 | 1,210.9 | 879.4–1,403.3 | 9× |
|
| 110 |
+
| Pixel 11 Pro | 1 | 447.9 | 447.5–448.7 | 24× |
|
| 111 |
+
|
| 112 |
+
- **One call**: writing the inputs, running the graph and reading back the audio output. Each row is a new process, in the order run on each phone: three calls that are not counted, then three timed calls. × real time = 10.9 s / the median.
|
| 113 |
+
- **Threads.** On the Pixel 11 Pro, the 1-thread process was faster than each 4-thread process, and its three calls were within 1.2 ms of each other. On the Snapdragon Galaxy S26, 4 threads were faster than 1. These runs used only 1 and 4 threads.
|
| 114 |
+
- **Clocks.** Each process started at Android thermal status 0 with no CPU clock ceiling lowered, with the phone plugged in and its screen on. Right after each process, the ceiling of the Snapdragon Galaxy S26's fastest CPU cores was at 95–98 % of its maximum. On the Pixel 11 Pro, every ceiling was at its maximum in each reading before, during and after a process.
|
| 115 |
+
- **Memory.** In the 32-utterance runs (4 threads), the highest peak resident memory (VmHWM) read during the process was 316 MB on the Snapdragon Galaxy S26 and 274 MB on the Pixel 11 Pro (308,356 and 267,416 kB; MB = kB × 1024 / 10⁶). The lowest available memory (MemAvailable) read during those runs was 7.74 GB on the Snapdragon Galaxy S26 and 9.45 GB on the Pixel 11 Pro.
|
| 116 |
+
- Galaxy S26 (Snapdragon, SM8850; model SM-S942Q, Android 16) and Pixel 11 Pro (Tensor G6, Android 17); LiteRT 2.3.0 (`com.google.ai.edge.litert:litert:2.3.0`, Google Maven) through its C API; 2026-11-30.
|
| 117 |
+
|
| 118 |
+
## Notes
|
| 119 |
+
|
| 120 |
+
- **GPU.** On a Pixel 11 Pro (PowerVR GPU; four processes) and a Snapdragon Galaxy S26 (Adreno GPU; one process), LiteRT 2.3.0's GPU accelerator at its default precision listed `BROADCAST_TO` (`Operation is not supported.`) and `CONCATENATION` (`Tensor dimensions must be less than 5.`) among the operations it does not support (the log cuts the list off after these two), took 248 of the graph's 1,804 operations in 3 partitions, and then `LiteRtCreateCompiledModel` returned status 504. The log does not name the operation behind the 504.
|
| 121 |
+
- **How the file was made.** The graph is built on the publisher's ONNX export module ([`src/tiny_voca/export.py`](https://github.com/n4ze3m/tiny-voca/blob/b4603fc4e2baf08b1f91ea3d6ce8591e8eacffe7/src/tiny_voca/export.py)), with fixed sizes, padding masks and a reworked phase for the pulse oscillator. It was exported in float32 with litert-torch 0.9.4 and PyTorch 2.13.0 from the publisher's `tiny-voca.pt` at commit 5fe06641 of n4ze3m/tiny-voca.
|
| 122 |
+
|
| 123 |
+
## License
|
| 124 |
+
|
| 125 |
+
The model file is under the Apache License 2.0, as [n4ze3m/tiny-voca](https://huggingface.co/n4ze3m/tiny-voca) is, and the publisher's [LICENSE](https://huggingface.co/litert-community/tiny-voca/blob/main/LICENSE) is included unchanged. `speak_tiny_voca.py` is under the same license; its header names the publisher's code it adapts ([`src/tiny_voca/infer.py`](https://github.com/n4ze3m/tiny-voca/blob/b4603fc4e2baf08b1f91ea3d6ce8591e8eacffe7/src/tiny_voca/infer.py) at commit b4603fc4). The `phonemizer/` files that the download step fetches from n4ze3m/tiny-voca come with two license files: `phonemizer/LICENSE.cmudict`, Carnegie Mellon University's license for the CMU Pronouncing Dictionary, and `phonemizer/LICENSE.homograph-data`, the same Apache License 2.0 text as `LICENSE`.
|
speak_tiny_voca.py
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Speak text with a fixed-shape tiny-voca LiteRT model at 24 kHz."""
|
| 2 |
+
|
| 3 |
+
# Sentence handling is adapted from src/tiny_voca/infer.py of
|
| 4 |
+
# https://github.com/n4ze3m/tiny-voca at commit b4603fc4e2baf08b1f91ea3d6ce8591e8eacffe7
|
| 5 |
+
# (Apache-2.0).
|
| 6 |
+
|
| 7 |
+
import argparse
|
| 8 |
+
import json
|
| 9 |
+
import math
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
import re
|
| 12 |
+
|
| 13 |
+
from ai_edge_litert.compiled_model import CompiledModel
|
| 14 |
+
from ai_edge_litert.hardware_accelerator import HardwareAccelerator
|
| 15 |
+
import dizione
|
| 16 |
+
import numpy as np
|
| 17 |
+
import soundfile as sf
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
VOICES = ("F2", "M2")
|
| 21 |
+
HOP = 256
|
| 22 |
+
SAMPLE_RATE = 24000
|
| 23 |
+
PEAK = 0.99
|
| 24 |
+
SPACE = re.compile("[\\s" + chr(0xFEFF) + "]+")
|
| 25 |
+
SENTENCE_END = re.compile(r"""(?:(?<=[.!?…])|(?<=[.!?…]["')\]]))\s+(?=["'(\[]?[A-Z0-9])""")
|
| 26 |
+
NOT_AN_END = re.compile(
|
| 27 |
+
r"(?:\b(?:mr|mrs|ms|dr|prof|sr|jr|st|vs|etc|no|inc|ltd|co|e\.g|i\.e|a\.m|p\.m)|\b[A-Z])\.$",
|
| 28 |
+
re.IGNORECASE | re.ASCII,
|
| 29 |
+
)
|
| 30 |
+
CLAUSE_END = re.compile(r"(?<=[,;:—])\s+")
|
| 31 |
+
TEXT_END = re.compile("[\\s" + chr(0xFEFF) + "]+$")
|
| 32 |
+
CLOSING = "\"'”’)]»"
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class UtteranceTooLong(ValueError):
|
| 36 |
+
pass
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def sentences(text):
|
| 40 |
+
parts, current = [], ""
|
| 41 |
+
for piece in SENTENCE_END.split(SPACE.sub(" ", text).strip()):
|
| 42 |
+
current = f"{current} {piece}" if current else piece
|
| 43 |
+
if not NOT_AN_END.search(current):
|
| 44 |
+
parts.append(current)
|
| 45 |
+
current = ""
|
| 46 |
+
if current:
|
| 47 |
+
parts.append(current)
|
| 48 |
+
return [part for part in parts if any(char.isalnum() for char in part)]
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def finished(text):
|
| 52 |
+
body = TEXT_END.sub("", text)
|
| 53 |
+
if not body:
|
| 54 |
+
return text
|
| 55 |
+
last = SPACE.split(body)[-1]
|
| 56 |
+
if any(char.isalnum() for char in last):
|
| 57 |
+
marked = last.rstrip(CLOSING)[-1:] in tuple(".!?…,;:")
|
| 58 |
+
else:
|
| 59 |
+
marked = any(char in ".!?…" for char in last) or last in (",", ";", ":")
|
| 60 |
+
return text if marked else body + "."
|
| 61 |
+
|
| 62 |
+
|
| 63 |
+
def shorter(text):
|
| 64 |
+
pieces = CLAUSE_END.split(text)
|
| 65 |
+
if len(pieces) > 1:
|
| 66 |
+
return pieces
|
| 67 |
+
words = text.split(" ")
|
| 68 |
+
if len(words) < 2:
|
| 69 |
+
return []
|
| 70 |
+
half = (len(words) + 1) // 2
|
| 71 |
+
return [" ".join(words[:half]), " ".join(words[half:])]
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
def case_noise(seed):
|
| 75 |
+
return np.random.default_rng(seed).standard_normal(3000 * HOP).astype(np.float32)
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
class Speaker:
|
| 79 |
+
def __init__(self, path):
|
| 80 |
+
self.model = CompiledModel.from_file(str(path), hardware_accel=HardwareAccelerator.CPU)
|
| 81 |
+
self.signature = "serving_default"
|
| 82 |
+
inputs = self.model.get_input_tensor_details(self.signature)
|
| 83 |
+
self.max_tokens = int(inputs["tokens"]["shape"][-1])
|
| 84 |
+
self.max_samples = int(inputs["noise"]["shape"][-1])
|
| 85 |
+
if self.max_samples % HOP:
|
| 86 |
+
raise ValueError("Noise input size must be a multiple of 256 samples.")
|
| 87 |
+
outputs = self.model.get_output_tensor_details(self.signature)
|
| 88 |
+
self.inputs = {
|
| 89 |
+
name: self.model.create_input_buffer_by_name(self.signature, name) for name in inputs
|
| 90 |
+
}
|
| 91 |
+
self.outputs = {
|
| 92 |
+
name: self.model.create_output_buffer_by_name(self.signature, name) for name in outputs
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
def speak_ids(self, ids, stress, voice, speed, pitch_shift, pitch_range, noise):
|
| 96 |
+
if len(ids) != len(stress) or not len(ids):
|
| 97 |
+
raise ValueError("Expected matching nonempty ids and stress.")
|
| 98 |
+
if len(ids) > self.max_tokens:
|
| 99 |
+
raise UtteranceTooLong("Utterance exceeds the graph token limit.")
|
| 100 |
+
if not (0.25 <= speed <= 4 and math.isfinite(pitch_shift) and 0 <= pitch_range <= 3):
|
| 101 |
+
raise ValueError("Speed must be 0.25 to 4, pitch shift finite and pitch range 0 to 3.")
|
| 102 |
+
if noise.shape != (self.max_samples,) or noise.dtype != np.float32:
|
| 103 |
+
raise ValueError(f"Expected {self.max_samples} noise samples in float32.")
|
| 104 |
+
pad = (0, self.max_tokens - len(ids))
|
| 105 |
+
feed = {
|
| 106 |
+
"tokens": np.pad(np.asarray(ids, dtype=np.int32), pad)[None],
|
| 107 |
+
"stress": np.pad(np.asarray(stress, dtype=np.int32), pad)[None],
|
| 108 |
+
"voice": np.array([VOICES.index(voice)], dtype=np.int32),
|
| 109 |
+
"speed": np.array([speed], dtype=np.float32),
|
| 110 |
+
"pitch_shift": np.array([pitch_shift], dtype=np.float32),
|
| 111 |
+
"pitch_range": np.array([pitch_range], dtype=np.float32),
|
| 112 |
+
"noise": noise[None],
|
| 113 |
+
}
|
| 114 |
+
for name, value in feed.items():
|
| 115 |
+
self.inputs[name].write(value)
|
| 116 |
+
self.model.run_by_name(self.signature, self.inputs, self.outputs)
|
| 117 |
+
total = int(self.outputs["total_frames"].read(1, np.int32)[0])
|
| 118 |
+
durations = self.outputs["durations"].read(self.max_tokens, np.int32)
|
| 119 |
+
if (durations < 0).any() or durations[len(ids):].any() or int(durations.sum()) != total:
|
| 120 |
+
raise RuntimeError("The graph returned inconsistent durations.")
|
| 121 |
+
samples = total * HOP
|
| 122 |
+
if samples > self.max_samples:
|
| 123 |
+
raise UtteranceTooLong("Utterance exceeds the graph frame limit.")
|
| 124 |
+
if samples == 0:
|
| 125 |
+
raise RuntimeError("The graph produced no frames.")
|
| 126 |
+
audio = self.outputs["audio"].read(self.max_samples, np.float32)[:samples].copy()
|
| 127 |
+
if not np.isfinite(audio).all():
|
| 128 |
+
raise RuntimeError("The graph produced non-finite audio.")
|
| 129 |
+
return audio, durations[:len(ids)].copy()
|
| 130 |
+
|
| 131 |
+
def speak_text(self, text, voice, speed, pitch_shift, pitch_range, seed):
|
| 132 |
+
waves, utterances = [], []
|
| 133 |
+
|
| 134 |
+
def read(piece):
|
| 135 |
+
try:
|
| 136 |
+
phones = dizione.phonemize(piece)
|
| 137 |
+
except ValueError as exc:
|
| 138 |
+
if str(exc) == "the text has nothing to pronounce":
|
| 139 |
+
return
|
| 140 |
+
raise
|
| 141 |
+
if len(phones.ids) <= self.max_tokens - 12:
|
| 142 |
+
try:
|
| 143 |
+
wave, durations = self.speak_ids(
|
| 144 |
+
phones.ids, phones.stress, voice, speed, pitch_shift, pitch_range,
|
| 145 |
+
case_noise(seed + len(waves))[:self.max_samples],
|
| 146 |
+
)
|
| 147 |
+
except UtteranceTooLong:
|
| 148 |
+
pass
|
| 149 |
+
else:
|
| 150 |
+
waves.append(wave)
|
| 151 |
+
utterances.append({"text": piece, "durations": durations.tolist(), "samples": wave.size})
|
| 152 |
+
return
|
| 153 |
+
parts = shorter(piece)
|
| 154 |
+
if not parts:
|
| 155 |
+
raise UtteranceTooLong(f"One word is too long to speak: {piece[:40]!r}")
|
| 156 |
+
for part in parts:
|
| 157 |
+
read(part)
|
| 158 |
+
|
| 159 |
+
for piece in sentences(finished(text)):
|
| 160 |
+
read(piece)
|
| 161 |
+
if not waves:
|
| 162 |
+
raise ValueError("Nothing in the text could be read. Tiny-voca only reads English for now.")
|
| 163 |
+
raw = np.concatenate(waves)
|
| 164 |
+
raw_peak = float(np.abs(raw).max())
|
| 165 |
+
limited = raw * (PEAK / raw_peak) if raw_peak > PEAK else raw
|
| 166 |
+
return limited, utterances, raw_peak
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
def main():
|
| 170 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 171 |
+
parser.add_argument("--model", required=True, type=Path)
|
| 172 |
+
parser.add_argument("--output", required=True, type=Path)
|
| 173 |
+
source = parser.add_mutually_exclusive_group(required=True)
|
| 174 |
+
source.add_argument("--text")
|
| 175 |
+
source.add_argument("--text-file", type=Path)
|
| 176 |
+
parser.add_argument("--voice", choices=VOICES, default="F2")
|
| 177 |
+
parser.add_argument("--speed", type=float, default=1.0)
|
| 178 |
+
parser.add_argument("--pitch-shift", type=float, default=0.0)
|
| 179 |
+
parser.add_argument("--pitch-range", type=float, default=1.0)
|
| 180 |
+
parser.add_argument("--seed", type=int, default=0)
|
| 181 |
+
args = parser.parse_args()
|
| 182 |
+
if args.seed < 0:
|
| 183 |
+
parser.error("Seed must be nonnegative.")
|
| 184 |
+
text = args.text if args.text is not None else args.text_file.read_text(encoding="utf-8")
|
| 185 |
+
try:
|
| 186 |
+
speaker = Speaker(args.model)
|
| 187 |
+
audio, utterances, raw_peak = speaker.speak_text(
|
| 188 |
+
text, args.voice, args.speed, args.pitch_shift, args.pitch_range, args.seed
|
| 189 |
+
)
|
| 190 |
+
except ValueError as exc:
|
| 191 |
+
parser.exit(1, f"{exc}\n")
|
| 192 |
+
args.output.parent.mkdir(parents=True, exist_ok=True)
|
| 193 |
+
sf.write(args.output, audio, SAMPLE_RATE, subtype="FLOAT")
|
| 194 |
+
print(json.dumps({
|
| 195 |
+
"file": str(args.output), "voice": args.voice, "sample_rate_hz": SAMPLE_RATE,
|
| 196 |
+
"samples": audio.size, "raw_peak": raw_peak, "written_peak": float(np.abs(audio).max()),
|
| 197 |
+
"utterances": utterances,
|
| 198 |
+
}))
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
if __name__ == "__main__":
|
| 202 |
+
main()
|
tiny-voca_fp32.tflite
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bdbd712175aa707f5d12b1fc45e11dccbbcc5811497250988cb7135c7d15f4ae
|
| 3 |
+
size 23375628
|