heed-wakeword 0.1.0__tar.gz
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.
- heed_wakeword-0.1.0/LICENSE +201 -0
- heed_wakeword-0.1.0/NOTICE +8 -0
- heed_wakeword-0.1.0/PKG-INFO +251 -0
- heed_wakeword-0.1.0/README.md +203 -0
- heed_wakeword-0.1.0/heed/__init__.py +14 -0
- heed_wakeword-0.1.0/heed/audio.py +457 -0
- heed_wakeword-0.1.0/heed/augment.py +428 -0
- heed_wakeword-0.1.0/heed/cli.py +963 -0
- heed_wakeword-0.1.0/heed/eval.py +102 -0
- heed_wakeword-0.1.0/heed/export.py +550 -0
- heed_wakeword-0.1.0/heed/gate.py +77 -0
- heed_wakeword-0.1.0/heed/infer.py +204 -0
- heed_wakeword-0.1.0/heed/model.py +77 -0
- heed_wakeword-0.1.0/heed/trainer.py +1014 -0
- heed_wakeword-0.1.0/heed/tts.py +564 -0
- heed_wakeword-0.1.0/heed/tts_kokoro.py +430 -0
- heed_wakeword-0.1.0/heed/web.py +3483 -0
- heed_wakeword-0.1.0/heed_wakeword.egg-info/PKG-INFO +251 -0
- heed_wakeword-0.1.0/heed_wakeword.egg-info/SOURCES.txt +26 -0
- heed_wakeword-0.1.0/heed_wakeword.egg-info/dependency_links.txt +1 -0
- heed_wakeword-0.1.0/heed_wakeword.egg-info/entry_points.txt +2 -0
- heed_wakeword-0.1.0/heed_wakeword.egg-info/requires.txt +32 -0
- heed_wakeword-0.1.0/heed_wakeword.egg-info/top_level.txt +1 -0
- heed_wakeword-0.1.0/pyproject.toml +57 -0
- heed_wakeword-0.1.0/setup.cfg +4 -0
- heed_wakeword-0.1.0/tests/test_audio.py +53 -0
- heed_wakeword-0.1.0/tests/test_export.py +32 -0
- heed_wakeword-0.1.0/tests/test_model.py +17 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may accept and charge a
|
|
167
|
+
fee for, acceptance of support, warranty, indemnity, or other
|
|
168
|
+
liability obligations and/or rights consistent with this License.
|
|
169
|
+
However, in accepting such obligations, You may act only on Your
|
|
170
|
+
own behalf and on Your sole responsibility, not on behalf of any
|
|
171
|
+
other Contributor, and only if You agree to indemnify, defend,
|
|
172
|
+
and hold each Contributor harmless for any liability incurred by,
|
|
173
|
+
or claims asserted against, such Contributor by reason of your
|
|
174
|
+
accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Andrei Bulzan
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Heed Wake Word
|
|
2
|
+
Copyright 2026 Andrei Bulzan
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0 (the "License").
|
|
5
|
+
You may obtain a copy of the License in the accompanying LICENSE file or at
|
|
6
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
|
|
8
|
+
Project home: https://github.com/AndreiBulzan/heed-wakeword
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: heed-wakeword
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Tiny, custom, on-device wake-word detection. Train your own in seconds, deploy anywhere (Python / browser / mobile).
|
|
5
|
+
Author: Andrei Bulzan
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/AndreiBulzan/heed-wakeword
|
|
8
|
+
Project-URL: Repository, https://github.com/AndreiBulzan/heed-wakeword
|
|
9
|
+
Project-URL: Issues, https://github.com/AndreiBulzan/heed-wakeword/issues
|
|
10
|
+
Keywords: wake-word,keyword-spotting,voice-activity,speech,on-device,edge-ai,tts,onnx,tflite
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
License-File: NOTICE
|
|
22
|
+
Requires-Dist: torch>=2.0
|
|
23
|
+
Requires-Dist: numpy>=1.20
|
|
24
|
+
Requires-Dist: scipy>=1.10
|
|
25
|
+
Requires-Dist: soundfile>=0.12
|
|
26
|
+
Requires-Dist: click>=8.0
|
|
27
|
+
Provides-Extra: mic
|
|
28
|
+
Requires-Dist: sounddevice>=0.4; extra == "mic"
|
|
29
|
+
Provides-Extra: tts
|
|
30
|
+
Requires-Dist: piper-tts>=1.2; extra == "tts"
|
|
31
|
+
Provides-Extra: kokoro
|
|
32
|
+
Requires-Dist: kokoro-onnx>=0.4; extra == "kokoro"
|
|
33
|
+
Provides-Extra: ui
|
|
34
|
+
Requires-Dist: flask>=3.0; extra == "ui"
|
|
35
|
+
Provides-Extra: export
|
|
36
|
+
Requires-Dist: onnx>=1.15; extra == "export"
|
|
37
|
+
Requires-Dist: onnxruntime>=1.16; extra == "export"
|
|
38
|
+
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
40
|
+
Provides-Extra: all
|
|
41
|
+
Requires-Dist: sounddevice>=0.4; extra == "all"
|
|
42
|
+
Requires-Dist: piper-tts>=1.2; extra == "all"
|
|
43
|
+
Requires-Dist: kokoro-onnx>=0.4; extra == "all"
|
|
44
|
+
Requires-Dist: flask>=3.0; extra == "all"
|
|
45
|
+
Requires-Dist: onnx>=1.15; extra == "all"
|
|
46
|
+
Requires-Dist: onnxruntime>=1.16; extra == "all"
|
|
47
|
+
Dynamic: license-file
|
|
48
|
+
|
|
49
|
+
# Heed Wake Word
|
|
50
|
+
|
|
51
|
+
Train your own wake word in seconds, or grab a ready-made one, then run it
|
|
52
|
+
fully on-device. No cloud, no telemetry, no per-call fees. A wake word here is a
|
|
53
|
+
40 to 235 KB model that runs in Python, in the browser, and on iOS and Android.
|
|
54
|
+
|
|
55
|
+
Heed is Apache-2.0 licensed, so commercial and closed-source use are fine, with no
|
|
56
|
+
copyleft.
|
|
57
|
+
|
|
58
|
+
Try it with no install: [train your own in Colab](https://colab.research.google.com/github/AndreiBulzan/heed-wakeword/blob/main/notebooks/heed_train_colab.ipynb), or run the static [browser demo](examples/inference_browser/).
|
|
59
|
+
|
|
60
|
+
## Two ways to use it
|
|
61
|
+
|
|
62
|
+
1. **Train a custom word.** Record a phrase a few times, or let TTS synthesize
|
|
63
|
+
it across hundreds of voices, then train on CPU or GPU in seconds and export.
|
|
64
|
+
2. **Use a pretrained word.** The mobile demo bundles four example words (hey
|
|
65
|
+
doc, activate x, hey jarvis, hey fetch) and an open "custom" slot for a model
|
|
66
|
+
you train and push from the studio. hey doc and activate x are the solid
|
|
67
|
+
ones. hey jarvis and hey fetch are quick placeholders that show off live
|
|
68
|
+
multi-word switching. Slightly better pretrained defaults are planned.
|
|
69
|
+
|
|
70
|
+
Both paths produce the same artifact. You get an ONNX or TFLite model plus a
|
|
71
|
+
`wake.json` preprocessing contract, and it runs the same way on every platform.
|
|
72
|
+
|
|
73
|
+
## Where Heed fits
|
|
74
|
+
|
|
75
|
+
Tools like Picovoice (Porcupine), openWakeWord, and LiveKit are the established
|
|
76
|
+
options today, and they are all good. Heed is for a specific gap: a fully
|
|
77
|
+
permissive (Apache-2.0), train-your-own wake word that also runs client-side in
|
|
78
|
+
the browser.
|
|
79
|
+
|
|
80
|
+
In practice that means you train a custom word in seconds from the studio or the
|
|
81
|
+
CLI, with multi-speaker TTS and a cross-speaker evaluation so the model works for
|
|
82
|
+
people other than you. The result is a sub-250 KB model that runs the same way in
|
|
83
|
+
Python, in the browser, and on iOS and Android, as ONNX (float32 or int8) or
|
|
84
|
+
TFLite. You can self-host the studio in Docker or train in Colab with no setup at
|
|
85
|
+
all, and commercial and closed-source use carry no per-call fees.
|
|
86
|
+
|
|
87
|
+
## Quickstart (about a minute)
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pip install "heed-wakeword[ui]" # base plus the browser studio
|
|
91
|
+
heed ui # opens http://127.0.0.1:7777
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Record a few positives and negatives in the browser, press Train, then
|
|
95
|
+
Live-test. A GPU is optional and gets used when present. If you prefer the
|
|
96
|
+
terminal:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
heed init my_phrase --phrase "hey computer"
|
|
100
|
+
heed train my_phrase # quick, tuned to your voice
|
|
101
|
+
heed train my_phrase --tts-pos 400 --kokoro-pos 200 # cross-speaker, works for anyone
|
|
102
|
+
heed export my_phrase # wake.onnx, wake.int8.onnx, wake.tflite, wake.json
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The package is `heed-wakeword` on PyPI. You import it as `heed`, and the command
|
|
106
|
+
is `heed`.
|
|
107
|
+
|
|
108
|
+
## What you get
|
|
109
|
+
|
|
110
|
+
- **Tiny and fast.** small is about 10K params (41 KB), medium about 27K
|
|
111
|
+
(108 KB), large about 60K (235 KB). INT8 is roughly 40% of that. Model
|
|
112
|
+
inference takes 1 to 15 ms on a phone CPU.
|
|
113
|
+
- **Many runtimes, every platform.** ONNX (fp32 and INT8) and TFLite, on
|
|
114
|
+
Python, the browser (onnxruntime-web), and React Native iOS and Android.
|
|
115
|
+
- **A streaming preprocessor we wrote ourselves.** A causal high-pass with
|
|
116
|
+
50/60 Hz notches feeds a 25 ms Hann window, a 512-point FFT (a power of two,
|
|
117
|
+
so it stays fast in any language), a 40-bin log-mel, and CMN. It runs
|
|
118
|
+
incrementally, recomputing only the frames that new audio touched, and it
|
|
119
|
+
agrees with Python bit-for-bit in JS (CI checks this). On a phone, prep is
|
|
120
|
+
about 15 to 20 ms per 100 ms of audio, and an energy gate skips the model
|
|
121
|
+
during silence.
|
|
122
|
+
- **Quality you can measure.** A cross-speaker held-out eval and a
|
|
123
|
+
cross-TTS-family eval tell you whether a model works beyond the trainer's own
|
|
124
|
+
voice, before you ship it.
|
|
125
|
+
- **A permissive stack.** torch, numpy, scipy, soundfile, click, with optional
|
|
126
|
+
piper-tts, kokoro-onnx, flask, and onnxruntime, all under MIT, BSD, or
|
|
127
|
+
Apache-2.0. The models you train are yours to ship.
|
|
128
|
+
|
|
129
|
+
## Deploy anywhere
|
|
130
|
+
|
|
131
|
+
The model consumes log-mel features, so any runtime reproduces the same
|
|
132
|
+
preprocessing chain. `wake.json` specifies it in full, and there are reference
|
|
133
|
+
implementations in Python (`heed/audio.py`) and JS
|
|
134
|
+
(`examples/*/preprocessing.js`) that agree bit-for-bit.
|
|
135
|
+
|
|
136
|
+
| Target | How |
|
|
137
|
+
|---|---|
|
|
138
|
+
| Python | `onnxruntime` on CPU. See `export/README.md`. |
|
|
139
|
+
| Browser | `onnxruntime-web` with `examples/inference_browser/`. Fully client-side and static-hostable on Vercel, Netlify, or GitHub Pages; ships a `vercel.json`. |
|
|
140
|
+
| iOS and Android | `examples/inference_react_native/`, with ONNX fp32/INT8 and TFLite, plus live word and runtime switching. |
|
|
141
|
+
| Other native (Flutter, Swift, Kotlin) | Run the ONNX or TFLite model, then port the preprocessing from the Python or JS reference (about 250 lines). |
|
|
142
|
+
|
|
143
|
+
Deployment needs none of the training dependencies. A 3 MB runtime and your
|
|
144
|
+
sub-250 KB model cover it.
|
|
145
|
+
|
|
146
|
+
## Install
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
pip install heed-wakeword # core: train and the model
|
|
150
|
+
pip install "heed-wakeword[ui]" # plus the browser studio (Flask)
|
|
151
|
+
pip install "heed-wakeword[tts]" # plus piper-tts, then: heed download-tts
|
|
152
|
+
pip install "heed-wakeword[kokoro]" # plus kokoro-onnx, then: heed download-kokoro
|
|
153
|
+
pip install "heed-wakeword[export]" # plus onnx and onnxruntime (export, verify)
|
|
154
|
+
pip install "heed-wakeword[all]" # everything
|
|
155
|
+
heed doctor # check torch, onnxruntime, and TTS
|
|
156
|
+
heed smoke # synthetic end-to-end self-test, no mic
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Self-host the studio (Docker)
|
|
160
|
+
|
|
161
|
+
Run the browser studio in a container, with no local Python setup:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
docker compose up # builds the image, then serves http://127.0.0.1:7777
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Recordings and trained models persist in `./workspace`. The image is CPU-only,
|
|
168
|
+
which is fine for training a tiny model; for GPU training, run heed natively. See
|
|
169
|
+
`Dockerfile`.
|
|
170
|
+
|
|
171
|
+
## Recording good data
|
|
172
|
+
|
|
173
|
+
This is the biggest lever on quality.
|
|
174
|
+
|
|
175
|
+
- **Positives.** 8 to 30 recordings of the phrase. Vary your prosody, distance
|
|
176
|
+
from the mic, and room. Variety beats raw count.
|
|
177
|
+
- **Negatives.** Distractor phrases in your own voice ("good morning", "the
|
|
178
|
+
weather is nice") make precious hard negatives. Add similar-sounding phrases
|
|
179
|
+
(for "hey doc", add "hey John") so the model learns the boundary.
|
|
180
|
+
- **Cross-speaker.** Turn on TTS (`--tts-pos`, `--kokoro-pos`) to synthesize the
|
|
181
|
+
phrase across hundreds of voices, so the model is not tied to you. Confirm
|
|
182
|
+
with the cross-speaker eval before you ship.
|
|
183
|
+
|
|
184
|
+
## CLI reference
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
heed ui [--host 127.0.0.1] [--port 7777] [--workspace DIR]
|
|
188
|
+
heed init <name> --phrase "..."
|
|
189
|
+
heed record <name> --kind {positive|negative} --count N
|
|
190
|
+
heed download-tts / download-kokoro
|
|
191
|
+
heed train <name> [--epochs N] [--tts-pos N] [--kokoro-pos N]
|
|
192
|
+
[--target-fpr X] [--model-size {small|medium|large}] ...
|
|
193
|
+
heed test <name> <audio.wav>
|
|
194
|
+
heed listen <name>
|
|
195
|
+
heed eval <name> [--positive-dir P] [--negative-dir N]
|
|
196
|
+
heed cross-tts-test <name>
|
|
197
|
+
heed export <name>
|
|
198
|
+
heed smoke / doctor
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Run `heed <cmd> --help` for the full options.
|
|
202
|
+
|
|
203
|
+
## Design, in one paragraph
|
|
204
|
+
|
|
205
|
+
Log-mel spectrograms (40 bins, a 25 ms window, a 10 ms hop, a 512-point FFT)
|
|
206
|
+
feed a small depthwise-separable 1D CNN over time, with a stride-2 stem, a few
|
|
207
|
+
DS-conv blocks, a global average pool, and a linear head. Training builds a
|
|
208
|
+
per-user set from a handful of real positives, signal-processing augmentation (a
|
|
209
|
+
VTLP-style speaker warp, reverb, noise, gain), and optional multi-speaker TTS,
|
|
210
|
+
with a speaker-prototype regularizer that discourages sensitivity to the
|
|
211
|
+
trainer's own voice. The high-pass is causal and state-retaining, so the exact
|
|
212
|
+
same filtering streams chunk by chunk on-device, and the STFT is computed
|
|
213
|
+
incrementally so only the frames that new audio touched get recomputed. The
|
|
214
|
+
threshold is calibrated to a target false-positive rate, and inference is a
|
|
215
|
+
sliding window with an RMS and voice-band energy gate in front of the model.
|
|
216
|
+
See `notes/` for the design rationale and a comparison with prior work.
|
|
217
|
+
|
|
218
|
+
## GPU and CPU
|
|
219
|
+
|
|
220
|
+
Training auto-detects CUDA and uses it when present, otherwise it runs on CPU.
|
|
221
|
+
The model is small, so CPU training works fine and is only a little slower.
|
|
222
|
+
Model inference is CPU-only by design, because the model is far too small for
|
|
223
|
+
GPU offload to beat the data-transfer cost. The one place a GPU pays off is TTS
|
|
224
|
+
synthesis during training. See the install notes for the optional
|
|
225
|
+
`onnxruntime-gpu` swap.
|
|
226
|
+
|
|
227
|
+
## Documentation
|
|
228
|
+
|
|
229
|
+
Deeper guides for each tool live in [`docs/`](docs/): the
|
|
230
|
+
[studio UI](docs/studio.md), [export and deploy](docs/export-and-deploy.md),
|
|
231
|
+
[Colab](docs/colab.md), [Docker](docs/docker.md), [mobile](docs/mobile.md), and
|
|
232
|
+
[browser and JS](docs/browser-and-js.md).
|
|
233
|
+
|
|
234
|
+
## Roadmap
|
|
235
|
+
|
|
236
|
+
Everything below works today: custom training from the studio or the CLI, on GPU
|
|
237
|
+
or CPU; multi-speaker TTS augmentation and a cross-speaker evaluation; ONNX and
|
|
238
|
+
TFLite export with verified numerical equivalence; inference in the browser and on
|
|
239
|
+
iOS and Android, with live multi-word switching; a zero-install Colab trainer; a
|
|
240
|
+
static client-side browser demo; and a Docker image for the studio.
|
|
241
|
+
|
|
242
|
+
A few directions are interesting for later: a curated pack of speaker-independent
|
|
243
|
+
phrases, more reference preprocessing ports, folding the preprocessing into the
|
|
244
|
+
model graph so raw audio goes straight in, or embedded targets like TFLite-Micro.
|
|
245
|
+
None of these are promised. This is a v0.1, and what runs today is the real scope.
|
|
246
|
+
|
|
247
|
+
## License
|
|
248
|
+
|
|
249
|
+
Apache-2.0. You can use Heed commercially, in closed-source products, with no
|
|
250
|
+
obligation to open your own code. Keep the license and NOTICE file. The license
|
|
251
|
+
includes a patent grant. Every dependency is MIT, BSD, or Apache-2.0.
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# Heed Wake Word
|
|
2
|
+
|
|
3
|
+
Train your own wake word in seconds, or grab a ready-made one, then run it
|
|
4
|
+
fully on-device. No cloud, no telemetry, no per-call fees. A wake word here is a
|
|
5
|
+
40 to 235 KB model that runs in Python, in the browser, and on iOS and Android.
|
|
6
|
+
|
|
7
|
+
Heed is Apache-2.0 licensed, so commercial and closed-source use are fine, with no
|
|
8
|
+
copyleft.
|
|
9
|
+
|
|
10
|
+
Try it with no install: [train your own in Colab](https://colab.research.google.com/github/AndreiBulzan/heed-wakeword/blob/main/notebooks/heed_train_colab.ipynb), or run the static [browser demo](examples/inference_browser/).
|
|
11
|
+
|
|
12
|
+
## Two ways to use it
|
|
13
|
+
|
|
14
|
+
1. **Train a custom word.** Record a phrase a few times, or let TTS synthesize
|
|
15
|
+
it across hundreds of voices, then train on CPU or GPU in seconds and export.
|
|
16
|
+
2. **Use a pretrained word.** The mobile demo bundles four example words (hey
|
|
17
|
+
doc, activate x, hey jarvis, hey fetch) and an open "custom" slot for a model
|
|
18
|
+
you train and push from the studio. hey doc and activate x are the solid
|
|
19
|
+
ones. hey jarvis and hey fetch are quick placeholders that show off live
|
|
20
|
+
multi-word switching. Slightly better pretrained defaults are planned.
|
|
21
|
+
|
|
22
|
+
Both paths produce the same artifact. You get an ONNX or TFLite model plus a
|
|
23
|
+
`wake.json` preprocessing contract, and it runs the same way on every platform.
|
|
24
|
+
|
|
25
|
+
## Where Heed fits
|
|
26
|
+
|
|
27
|
+
Tools like Picovoice (Porcupine), openWakeWord, and LiveKit are the established
|
|
28
|
+
options today, and they are all good. Heed is for a specific gap: a fully
|
|
29
|
+
permissive (Apache-2.0), train-your-own wake word that also runs client-side in
|
|
30
|
+
the browser.
|
|
31
|
+
|
|
32
|
+
In practice that means you train a custom word in seconds from the studio or the
|
|
33
|
+
CLI, with multi-speaker TTS and a cross-speaker evaluation so the model works for
|
|
34
|
+
people other than you. The result is a sub-250 KB model that runs the same way in
|
|
35
|
+
Python, in the browser, and on iOS and Android, as ONNX (float32 or int8) or
|
|
36
|
+
TFLite. You can self-host the studio in Docker or train in Colab with no setup at
|
|
37
|
+
all, and commercial and closed-source use carry no per-call fees.
|
|
38
|
+
|
|
39
|
+
## Quickstart (about a minute)
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install "heed-wakeword[ui]" # base plus the browser studio
|
|
43
|
+
heed ui # opens http://127.0.0.1:7777
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Record a few positives and negatives in the browser, press Train, then
|
|
47
|
+
Live-test. A GPU is optional and gets used when present. If you prefer the
|
|
48
|
+
terminal:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
heed init my_phrase --phrase "hey computer"
|
|
52
|
+
heed train my_phrase # quick, tuned to your voice
|
|
53
|
+
heed train my_phrase --tts-pos 400 --kokoro-pos 200 # cross-speaker, works for anyone
|
|
54
|
+
heed export my_phrase # wake.onnx, wake.int8.onnx, wake.tflite, wake.json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
The package is `heed-wakeword` on PyPI. You import it as `heed`, and the command
|
|
58
|
+
is `heed`.
|
|
59
|
+
|
|
60
|
+
## What you get
|
|
61
|
+
|
|
62
|
+
- **Tiny and fast.** small is about 10K params (41 KB), medium about 27K
|
|
63
|
+
(108 KB), large about 60K (235 KB). INT8 is roughly 40% of that. Model
|
|
64
|
+
inference takes 1 to 15 ms on a phone CPU.
|
|
65
|
+
- **Many runtimes, every platform.** ONNX (fp32 and INT8) and TFLite, on
|
|
66
|
+
Python, the browser (onnxruntime-web), and React Native iOS and Android.
|
|
67
|
+
- **A streaming preprocessor we wrote ourselves.** A causal high-pass with
|
|
68
|
+
50/60 Hz notches feeds a 25 ms Hann window, a 512-point FFT (a power of two,
|
|
69
|
+
so it stays fast in any language), a 40-bin log-mel, and CMN. It runs
|
|
70
|
+
incrementally, recomputing only the frames that new audio touched, and it
|
|
71
|
+
agrees with Python bit-for-bit in JS (CI checks this). On a phone, prep is
|
|
72
|
+
about 15 to 20 ms per 100 ms of audio, and an energy gate skips the model
|
|
73
|
+
during silence.
|
|
74
|
+
- **Quality you can measure.** A cross-speaker held-out eval and a
|
|
75
|
+
cross-TTS-family eval tell you whether a model works beyond the trainer's own
|
|
76
|
+
voice, before you ship it.
|
|
77
|
+
- **A permissive stack.** torch, numpy, scipy, soundfile, click, with optional
|
|
78
|
+
piper-tts, kokoro-onnx, flask, and onnxruntime, all under MIT, BSD, or
|
|
79
|
+
Apache-2.0. The models you train are yours to ship.
|
|
80
|
+
|
|
81
|
+
## Deploy anywhere
|
|
82
|
+
|
|
83
|
+
The model consumes log-mel features, so any runtime reproduces the same
|
|
84
|
+
preprocessing chain. `wake.json` specifies it in full, and there are reference
|
|
85
|
+
implementations in Python (`heed/audio.py`) and JS
|
|
86
|
+
(`examples/*/preprocessing.js`) that agree bit-for-bit.
|
|
87
|
+
|
|
88
|
+
| Target | How |
|
|
89
|
+
|---|---|
|
|
90
|
+
| Python | `onnxruntime` on CPU. See `export/README.md`. |
|
|
91
|
+
| Browser | `onnxruntime-web` with `examples/inference_browser/`. Fully client-side and static-hostable on Vercel, Netlify, or GitHub Pages; ships a `vercel.json`. |
|
|
92
|
+
| iOS and Android | `examples/inference_react_native/`, with ONNX fp32/INT8 and TFLite, plus live word and runtime switching. |
|
|
93
|
+
| Other native (Flutter, Swift, Kotlin) | Run the ONNX or TFLite model, then port the preprocessing from the Python or JS reference (about 250 lines). |
|
|
94
|
+
|
|
95
|
+
Deployment needs none of the training dependencies. A 3 MB runtime and your
|
|
96
|
+
sub-250 KB model cover it.
|
|
97
|
+
|
|
98
|
+
## Install
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pip install heed-wakeword # core: train and the model
|
|
102
|
+
pip install "heed-wakeword[ui]" # plus the browser studio (Flask)
|
|
103
|
+
pip install "heed-wakeword[tts]" # plus piper-tts, then: heed download-tts
|
|
104
|
+
pip install "heed-wakeword[kokoro]" # plus kokoro-onnx, then: heed download-kokoro
|
|
105
|
+
pip install "heed-wakeword[export]" # plus onnx and onnxruntime (export, verify)
|
|
106
|
+
pip install "heed-wakeword[all]" # everything
|
|
107
|
+
heed doctor # check torch, onnxruntime, and TTS
|
|
108
|
+
heed smoke # synthetic end-to-end self-test, no mic
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Self-host the studio (Docker)
|
|
112
|
+
|
|
113
|
+
Run the browser studio in a container, with no local Python setup:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
docker compose up # builds the image, then serves http://127.0.0.1:7777
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Recordings and trained models persist in `./workspace`. The image is CPU-only,
|
|
120
|
+
which is fine for training a tiny model; for GPU training, run heed natively. See
|
|
121
|
+
`Dockerfile`.
|
|
122
|
+
|
|
123
|
+
## Recording good data
|
|
124
|
+
|
|
125
|
+
This is the biggest lever on quality.
|
|
126
|
+
|
|
127
|
+
- **Positives.** 8 to 30 recordings of the phrase. Vary your prosody, distance
|
|
128
|
+
from the mic, and room. Variety beats raw count.
|
|
129
|
+
- **Negatives.** Distractor phrases in your own voice ("good morning", "the
|
|
130
|
+
weather is nice") make precious hard negatives. Add similar-sounding phrases
|
|
131
|
+
(for "hey doc", add "hey John") so the model learns the boundary.
|
|
132
|
+
- **Cross-speaker.** Turn on TTS (`--tts-pos`, `--kokoro-pos`) to synthesize the
|
|
133
|
+
phrase across hundreds of voices, so the model is not tied to you. Confirm
|
|
134
|
+
with the cross-speaker eval before you ship.
|
|
135
|
+
|
|
136
|
+
## CLI reference
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
heed ui [--host 127.0.0.1] [--port 7777] [--workspace DIR]
|
|
140
|
+
heed init <name> --phrase "..."
|
|
141
|
+
heed record <name> --kind {positive|negative} --count N
|
|
142
|
+
heed download-tts / download-kokoro
|
|
143
|
+
heed train <name> [--epochs N] [--tts-pos N] [--kokoro-pos N]
|
|
144
|
+
[--target-fpr X] [--model-size {small|medium|large}] ...
|
|
145
|
+
heed test <name> <audio.wav>
|
|
146
|
+
heed listen <name>
|
|
147
|
+
heed eval <name> [--positive-dir P] [--negative-dir N]
|
|
148
|
+
heed cross-tts-test <name>
|
|
149
|
+
heed export <name>
|
|
150
|
+
heed smoke / doctor
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Run `heed <cmd> --help` for the full options.
|
|
154
|
+
|
|
155
|
+
## Design, in one paragraph
|
|
156
|
+
|
|
157
|
+
Log-mel spectrograms (40 bins, a 25 ms window, a 10 ms hop, a 512-point FFT)
|
|
158
|
+
feed a small depthwise-separable 1D CNN over time, with a stride-2 stem, a few
|
|
159
|
+
DS-conv blocks, a global average pool, and a linear head. Training builds a
|
|
160
|
+
per-user set from a handful of real positives, signal-processing augmentation (a
|
|
161
|
+
VTLP-style speaker warp, reverb, noise, gain), and optional multi-speaker TTS,
|
|
162
|
+
with a speaker-prototype regularizer that discourages sensitivity to the
|
|
163
|
+
trainer's own voice. The high-pass is causal and state-retaining, so the exact
|
|
164
|
+
same filtering streams chunk by chunk on-device, and the STFT is computed
|
|
165
|
+
incrementally so only the frames that new audio touched get recomputed. The
|
|
166
|
+
threshold is calibrated to a target false-positive rate, and inference is a
|
|
167
|
+
sliding window with an RMS and voice-band energy gate in front of the model.
|
|
168
|
+
See `notes/` for the design rationale and a comparison with prior work.
|
|
169
|
+
|
|
170
|
+
## GPU and CPU
|
|
171
|
+
|
|
172
|
+
Training auto-detects CUDA and uses it when present, otherwise it runs on CPU.
|
|
173
|
+
The model is small, so CPU training works fine and is only a little slower.
|
|
174
|
+
Model inference is CPU-only by design, because the model is far too small for
|
|
175
|
+
GPU offload to beat the data-transfer cost. The one place a GPU pays off is TTS
|
|
176
|
+
synthesis during training. See the install notes for the optional
|
|
177
|
+
`onnxruntime-gpu` swap.
|
|
178
|
+
|
|
179
|
+
## Documentation
|
|
180
|
+
|
|
181
|
+
Deeper guides for each tool live in [`docs/`](docs/): the
|
|
182
|
+
[studio UI](docs/studio.md), [export and deploy](docs/export-and-deploy.md),
|
|
183
|
+
[Colab](docs/colab.md), [Docker](docs/docker.md), [mobile](docs/mobile.md), and
|
|
184
|
+
[browser and JS](docs/browser-and-js.md).
|
|
185
|
+
|
|
186
|
+
## Roadmap
|
|
187
|
+
|
|
188
|
+
Everything below works today: custom training from the studio or the CLI, on GPU
|
|
189
|
+
or CPU; multi-speaker TTS augmentation and a cross-speaker evaluation; ONNX and
|
|
190
|
+
TFLite export with verified numerical equivalence; inference in the browser and on
|
|
191
|
+
iOS and Android, with live multi-word switching; a zero-install Colab trainer; a
|
|
192
|
+
static client-side browser demo; and a Docker image for the studio.
|
|
193
|
+
|
|
194
|
+
A few directions are interesting for later: a curated pack of speaker-independent
|
|
195
|
+
phrases, more reference preprocessing ports, folding the preprocessing into the
|
|
196
|
+
model graph so raw audio goes straight in, or embedded targets like TFLite-Micro.
|
|
197
|
+
None of these are promised. This is a v0.1, and what runs today is the real scope.
|
|
198
|
+
|
|
199
|
+
## License
|
|
200
|
+
|
|
201
|
+
Apache-2.0. You can use Heed commercially, in closed-source products, with no
|
|
202
|
+
obligation to open your own code. Keep the license and NOTICE file. The license
|
|
203
|
+
includes a patent grant. Every dependency is MIT, BSD, or Apache-2.0.
|