voxedge 0.0.2a0__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.
- voxedge-0.0.2a0/LICENSE +191 -0
- voxedge-0.0.2a0/PKG-INFO +198 -0
- voxedge-0.0.2a0/README.md +166 -0
- voxedge-0.0.2a0/pyproject.toml +144 -0
- voxedge-0.0.2a0/setup.cfg +4 -0
- voxedge-0.0.2a0/voxedge/__init__.py +10 -0
- voxedge-0.0.2a0/voxedge/artifacts/__init__.py +48 -0
- voxedge-0.0.2a0/voxedge/artifacts/download.py +213 -0
- voxedge-0.0.2a0/voxedge/artifacts/manifest.json +58 -0
- voxedge-0.0.2a0/voxedge/artifacts/manifest.py +209 -0
- voxedge-0.0.2a0/voxedge/backends/__init__.py +36 -0
- voxedge-0.0.2a0/voxedge/backends/_deps.py +100 -0
- voxedge-0.0.2a0/voxedge/backends/base.py +719 -0
- voxedge-0.0.2a0/voxedge/backends/jetson/__init__.py +41 -0
- voxedge-0.0.2a0/voxedge/backends/jetson/_deploy_paths.py +388 -0
- voxedge-0.0.2a0/voxedge/backends/jetson/_trt_edge_llm_util.py +220 -0
- voxedge-0.0.2a0/voxedge/backends/jetson/_util.py +276 -0
- voxedge-0.0.2a0/voxedge/backends/jetson/kokoro_trt.py +1389 -0
- voxedge-0.0.2a0/voxedge/backends/jetson/matcha_trt.py +856 -0
- voxedge-0.0.2a0/voxedge/backends/jetson/moss_tts_nano.py +570 -0
- voxedge-0.0.2a0/voxedge/backends/jetson/paraformer_trt.py +1210 -0
- voxedge-0.0.2a0/voxedge/backends/jetson/sensevoice_trt.py +302 -0
- voxedge-0.0.2a0/voxedge/backends/jetson/trt_edge_llm_asr.py +1447 -0
- voxedge-0.0.2a0/voxedge/backends/jetson/trt_edge_llm_ipc.py +295 -0
- voxedge-0.0.2a0/voxedge/backends/jetson/trt_edge_llm_tts.py +1606 -0
- voxedge-0.0.2a0/voxedge/backends/jetson/worker_io.py +307 -0
- voxedge-0.0.2a0/voxedge/backends/llm/__init__.py +21 -0
- voxedge-0.0.2a0/voxedge/backends/llm/openai_compat.py +194 -0
- voxedge-0.0.2a0/voxedge/backends/llm_base.py +29 -0
- voxedge-0.0.2a0/voxedge/backends/llm_translator.py +224 -0
- voxedge-0.0.2a0/voxedge/backends/mock.py +344 -0
- voxedge-0.0.2a0/voxedge/backends/nllb_translator.py +179 -0
- voxedge-0.0.2a0/voxedge/backends/rk/__init__.py +30 -0
- voxedge-0.0.2a0/voxedge/backends/rk/_util.py +100 -0
- voxedge-0.0.2a0/voxedge/backends/rk/artifacts.py +221 -0
- voxedge-0.0.2a0/voxedge/backends/rk/asr.py +602 -0
- voxedge-0.0.2a0/voxedge/backends/rk/runtime.py +170 -0
- voxedge-0.0.2a0/voxedge/backends/rk/tts.py +285 -0
- voxedge-0.0.2a0/voxedge/backends/sherpa/__init__.py +22 -0
- voxedge-0.0.2a0/voxedge/backends/sherpa/_util.py +98 -0
- voxedge-0.0.2a0/voxedge/backends/sherpa/asr.py +419 -0
- voxedge-0.0.2a0/voxedge/backends/sherpa/tts.py +330 -0
- voxedge-0.0.2a0/voxedge/capabilities/__init__.py +36 -0
- voxedge-0.0.2a0/voxedge/capabilities/punctuation.py +107 -0
- voxedge-0.0.2a0/voxedge/capabilities/speaker_embedding.py +175 -0
- voxedge-0.0.2a0/voxedge/engine/__init__.py +25 -0
- voxedge-0.0.2a0/voxedge/engine/asr_loop.py +251 -0
- voxedge-0.0.2a0/voxedge/engine/asr_session_manager.py +490 -0
- voxedge-0.0.2a0/voxedge/engine/audio_dispatcher.py +121 -0
- voxedge-0.0.2a0/voxedge/engine/builtin_tools.py +32 -0
- voxedge-0.0.2a0/voxedge/engine/capability_resolver.py +238 -0
- voxedge-0.0.2a0/voxedge/engine/client_events.py +90 -0
- voxedge-0.0.2a0/voxedge/engine/concurrency_capability.py +60 -0
- voxedge-0.0.2a0/voxedge/engine/conversation.py +817 -0
- voxedge-0.0.2a0/voxedge/engine/coordinator.py +138 -0
- voxedge-0.0.2a0/voxedge/engine/llm_turn.py +153 -0
- voxedge-0.0.2a0/voxedge/engine/protocol.py +60 -0
- voxedge-0.0.2a0/voxedge/engine/session_state.py +102 -0
- voxedge-0.0.2a0/voxedge/engine/tool_registry.py +452 -0
- voxedge-0.0.2a0/voxedge/engine/tts_buffer.py +167 -0
- voxedge-0.0.2a0/voxedge/engine/tts_sequencer.py +252 -0
- voxedge-0.0.2a0/voxedge/engine/turn_driver.py +469 -0
- voxedge-0.0.2a0/voxedge/transport/__init__.py +10 -0
- voxedge-0.0.2a0/voxedge/transport/base.py +286 -0
- voxedge-0.0.2a0/voxedge.egg-info/PKG-INFO +198 -0
- voxedge-0.0.2a0/voxedge.egg-info/SOURCES.txt +67 -0
- voxedge-0.0.2a0/voxedge.egg-info/dependency_links.txt +1 -0
- voxedge-0.0.2a0/voxedge.egg-info/requires.txt +32 -0
- voxedge-0.0.2a0/voxedge.egg-info/top_level.txt +1 -0
voxedge-0.0.2a0/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
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 made available under
|
|
36
|
+
the License, as indicated by a copyright notice that is included in
|
|
37
|
+
or attached to the work (an example is provided in the Appendix below).
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
43
|
+
of this License, Derivative Works shall not include works that remain
|
|
44
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
45
|
+
the Work and Derivative Works thereof.
|
|
46
|
+
|
|
47
|
+
"Contribution" shall mean, as submitted to the Licensor for inclusion
|
|
48
|
+
in the Work by the copyright owner or by an individual or Legal Entity
|
|
49
|
+
authorized to submit on behalf of the copyright owner. For the purposes
|
|
50
|
+
of this definition, "Contribution" includes any original work of
|
|
51
|
+
authorship, including any modifications or additions to an existing
|
|
52
|
+
work, that is intentionally submitted to the Licensor for inclusion
|
|
53
|
+
in the Work. A "Contribution" is included in the Work as submitted.
|
|
54
|
+
|
|
55
|
+
"Contributor" shall mean Licensor and any Legal Entity on behalf of
|
|
56
|
+
whom a Contribution has been submitted to the Licensor.
|
|
57
|
+
|
|
58
|
+
"Licensed Patents" shall mean patent claims licensable by a Contributor
|
|
59
|
+
that are necessarily infringed by their Contribution(s) alone or by
|
|
60
|
+
combination of their Contribution(s) with the Work to which such
|
|
61
|
+
Contribution(s) was submitted.
|
|
62
|
+
|
|
63
|
+
"Work" shall also mean the Contribution.
|
|
64
|
+
|
|
65
|
+
"Contributor Version" shall mean the combination of the Contributions
|
|
66
|
+
of others (if any) used by a Contributor and that Contributor's
|
|
67
|
+
Contribution.
|
|
68
|
+
|
|
69
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
70
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
71
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
72
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
73
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
74
|
+
Work and such Derivative Works in Source or Object form.
|
|
75
|
+
|
|
76
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
77
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
78
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
79
|
+
(except as stated in this section) patent license to make, have made,
|
|
80
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
81
|
+
where such license applies only to those patent claims licensable
|
|
82
|
+
by such Contributor that are necessarily infringed by their
|
|
83
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
84
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
85
|
+
institute patent litigation against any entity (including a cross-claim
|
|
86
|
+
or counterclaim in a lawsuit) alleging that the Work or any
|
|
87
|
+
Contribution incorporated within the Work constitutes patent or
|
|
88
|
+
contributory patent infringement, then any patent licenses granted to
|
|
89
|
+
You under this License for that Work shall terminate as of the date
|
|
90
|
+
such litigation is filed.
|
|
91
|
+
|
|
92
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
93
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
94
|
+
modifications, and in Source or Object form, provided that You
|
|
95
|
+
meet the following conditions:
|
|
96
|
+
|
|
97
|
+
(a) You must give any other recipients of the Work or
|
|
98
|
+
Derivative Works a copy of this License; and
|
|
99
|
+
|
|
100
|
+
(b) You must cause any modified files to carry prominent notices
|
|
101
|
+
stating that You changed the files; and
|
|
102
|
+
|
|
103
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
104
|
+
that You distribute, all copyright, patent, trademark, and
|
|
105
|
+
attribution notices from the Source form of the Work,
|
|
106
|
+
excluding those notices that do not pertain to any part of
|
|
107
|
+
the Derivative Works; and
|
|
108
|
+
|
|
109
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
110
|
+
distribution, You must include a readable copy of the
|
|
111
|
+
attribution notices contained within such NOTICE file, in
|
|
112
|
+
at least one of the following places: within a NOTICE text
|
|
113
|
+
file distributed as part of the Derivative Works; within
|
|
114
|
+
the Source form or documentation, if provided along with the
|
|
115
|
+
Derivative Works; or, within a display generated by the
|
|
116
|
+
Derivative Works, if and wherever such third-party notices
|
|
117
|
+
normally appear. The contents of the NOTICE file are for
|
|
118
|
+
informational purposes only and do not modify the License.
|
|
119
|
+
You may add Your own attribution notices within Derivative
|
|
120
|
+
Works that You distribute, alongside or as an addendum to
|
|
121
|
+
the NOTICE text from the Work, provided that such additional
|
|
122
|
+
attribution notices cannot be construed as modifying the
|
|
123
|
+
License.
|
|
124
|
+
|
|
125
|
+
You may add Your own license statement for Your modifications and
|
|
126
|
+
may provide additional grant of rights to use, copy, modify, merge,
|
|
127
|
+
publish, distribute, sublicense, and/or sell copies of the Work,
|
|
128
|
+
and to permit persons to whom the Work is furnished to do so,
|
|
129
|
+
subject to the following conditions:
|
|
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 conditions of title,
|
|
149
|
+
MERCHANTIBILITY, NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE.
|
|
150
|
+
You are solely responsible for determining the appropriateness of
|
|
151
|
+
using or redistributing the Work and assume any risks associated
|
|
152
|
+
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 exemplary 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 all other
|
|
163
|
+
commercial damages or losses), even if such Contributor has been
|
|
164
|
+
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 warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
Copyright 2024 Harvest Su
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
voxedge-0.0.2a0/PKG-INFO
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: voxedge
|
|
3
|
+
Version: 0.0.2a0
|
|
4
|
+
Summary: Pipecat for the edge — edge-native, local-first real-time voice conversation library
|
|
5
|
+
Author: Harvest Su
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: numpy>=1.24
|
|
11
|
+
Provides-Extra: rk
|
|
12
|
+
Requires-Dist: rknn-toolkit-lite2>=2.0; platform_machine == "aarch64" and extra == "rk"
|
|
13
|
+
Requires-Dist: rkvoice-stream>=0.1.1; platform_machine == "aarch64" and extra == "rk"
|
|
14
|
+
Provides-Extra: sherpa
|
|
15
|
+
Requires-Dist: sherpa-onnx>=1.10; extra == "sherpa"
|
|
16
|
+
Requires-Dist: soundfile>=0.12; extra == "sherpa"
|
|
17
|
+
Provides-Extra: jetson
|
|
18
|
+
Requires-Dist: onnxruntime>=1.16; extra == "jetson"
|
|
19
|
+
Requires-Dist: soundfile>=0.12; extra == "jetson"
|
|
20
|
+
Requires-Dist: piper-phonemize>=1.1.0; platform_machine == "aarch64" and extra == "jetson"
|
|
21
|
+
Requires-Dist: tokenizers>=0.15; extra == "jetson"
|
|
22
|
+
Requires-Dist: webrtcvad>=2.0.10; extra == "jetson"
|
|
23
|
+
Provides-Extra: translator
|
|
24
|
+
Requires-Dist: ctranslate2>=4.0; extra == "translator"
|
|
25
|
+
Requires-Dist: sentencepiece>=0.1.99; extra == "translator"
|
|
26
|
+
Provides-Extra: text
|
|
27
|
+
Provides-Extra: artifacts
|
|
28
|
+
Requires-Dist: huggingface_hub>=0.20; extra == "artifacts"
|
|
29
|
+
Provides-Extra: llm
|
|
30
|
+
Requires-Dist: httpx>=0.24; extra == "llm"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# voxedge
|
|
34
|
+
|
|
35
|
+
> **English** | [中文](README.zh-CN.md)
|
|
36
|
+
|
|
37
|
+
<p align="center">
|
|
38
|
+
<img src="media/banner.png" alt="voxedge banner" width="100%">
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
[](https://pypi.org/project/voxedge)
|
|
42
|
+
[](LICENSE)
|
|
43
|
+
[](https://pypi.org/project/voxedge)
|
|
44
|
+
|
|
45
|
+
**Native TensorRT · RKNN · sherpa-onnx voice pipelines for Jetson, Rockchip, and Raspberry Pi — fully on-device, verified on real hardware, zero cloud.**
|
|
46
|
+
|
|
47
|
+
<!-- TODO: Add demo GIF — recommend a ~15s terminal recording showing ASR→TTS on Jetson Orin (place in media/demo.gif) -->
|
|
48
|
+
|
|
49
|
+
## What is voxedge?
|
|
50
|
+
|
|
51
|
+
voxedge is an embeddable Python library that drives real-time, on-device voice conversations by calling directly into each platform's native inference runtime — TensorRT on Jetson Orin, RKNN on RK3576/RK3588, sherpa-onnx on CPU. No cloud STT/TTS APIs, no internet at runtime, no intermediate abstraction overhead. The same `ConversationEngine` API works across all three backends; you swap only the backend constructor — N=2 concurrent sessions verified on Orin Nano 8 GB, byte-identical output, zero CUDA errors.
|
|
52
|
+
|
|
53
|
+
voxedge is the open-core engine behind **[OpenVoiceStream](https://github.com/suharvest/openvoicestream)** — the deployable FastAPI/WebSocket server, device profiles, and agent gallery. Want a container? Start there. Want to embed real-time edge voice in your own app? You're in the right place.
|
|
54
|
+
|
|
55
|
+
## Key Features
|
|
56
|
+
|
|
57
|
+
- **Native runtimes, full performance** — calls directly into TensorRT (Jetson), RKNN (Rockchip), and sherpa-onnx (CPU); no wrapper overhead, no cross-platform abstraction tax
|
|
58
|
+
- **Fully on-device** — no speech API key, no per-call bill, no internet dependency at runtime
|
|
59
|
+
- **Verified on real hardware** — N=2 concurrent sessions on Orin Nano 8 GB: byte-identical output vs. single-stream, zero CUDA errors
|
|
60
|
+
- **Streaming + barge-in** — partial + final ASR while the user speaks; sentence-level TTS streaming with first-audio latency low enough for live dialogue and cooperative barge-in
|
|
61
|
+
- **Swap hardware, not code** — same `ConversationEngine` API across Jetson, Rockchip, and sherpa-onnx CPU; only the backend constructor changes
|
|
62
|
+
- **Test on any machine** — mock backends require only numpy; the whole engine runs end-to-end on a Mac with no CUDA or GPU
|
|
63
|
+
|
|
64
|
+
## Quickstart
|
|
65
|
+
|
|
66
|
+
Runs on any machine — no GPU needed. Swap the backend constructors for a real device; the engine, transport, and event contract never change.
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install voxedge
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
import asyncio
|
|
74
|
+
from voxedge.engine import ConversationEngine
|
|
75
|
+
from voxedge.transport import InProcessTransport
|
|
76
|
+
from voxedge.backends.mock import MockASR, MockTTS, MockVAD
|
|
77
|
+
|
|
78
|
+
engine = ConversationEngine(
|
|
79
|
+
backends={"asr": MockASR(transcript="hello world"), "tts": MockTTS(), "vad": MockVAD()},
|
|
80
|
+
multi_utterance=True,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
async def main():
|
|
84
|
+
t = InProcessTransport()
|
|
85
|
+
await t.feed_audio(b"\x01\x02" * 8000) # speech frames (int16 PCM)
|
|
86
|
+
await t.feed_audio(b"\x00\x00" * 8000) # silence → VAD endpoints the utterance
|
|
87
|
+
t.end_input()
|
|
88
|
+
await engine.run(t) # drives ASR → (LLM) → TTS
|
|
89
|
+
for ev in t.drain_events_nowait(): # asr_final / tts_* / ...
|
|
90
|
+
print(ev["type"], ev.get("text", ""))
|
|
91
|
+
|
|
92
|
+
asyncio.run(main())
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
On a real device, swap **only the backend constructors** — everything else is identical:
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
# Jetson Orin — pip install voxedge[jetson]
|
|
99
|
+
from voxedge.backends.jetson import (
|
|
100
|
+
TRTEdgeLLMASRBackend, TRTEdgeLLMASRConfig,
|
|
101
|
+
TRTEdgeLLMTTSBackend, TRTEdgeLLMTTSConfig,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
engine = ConversationEngine(backends={
|
|
105
|
+
"asr": TRTEdgeLLMASRBackend(TRTEdgeLLMASRConfig(...)), # Qwen3-ASR, native TRT
|
|
106
|
+
"tts": TRTEdgeLLMTTSBackend(TRTEdgeLLMTTSConfig(...)), # Qwen3-TTS, streaming
|
|
107
|
+
}, multi_utterance=True)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
> `import voxedge` is **numpy-only** — TensorRT, RKNN, and sherpa-onnx are lazy-imported by their backend adapters and pulled in via extras. The example above imports cleanly on a Mac even though the TRT engine only runs on a Jetson.
|
|
111
|
+
|
|
112
|
+
## Install
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
pip install voxedge # pure-Python core (numpy only)
|
|
116
|
+
pip install voxedge[sherpa] # sherpa-onnx CPU ASR/TTS
|
|
117
|
+
pip install voxedge[jetson] # Jetson TensorRT backends (aarch64)
|
|
118
|
+
pip install voxedge[rk] # Rockchip RK3576/RK3588 NPU (aarch64)
|
|
119
|
+
pip install voxedge[llm] # OpenAI-compatible LLM backend (httpx)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
The `jetson` / `rk` extras declare only pure-Python deps; the CUDA/TensorRT and RKNN runtime wheels ship from the platform (JetPack L4T / Rockchip NPU userspace) or the engine repos — you bring the platform runtime.
|
|
123
|
+
|
|
124
|
+
## Architecture
|
|
125
|
+
|
|
126
|
+
Four layers, all importable without CUDA.
|
|
127
|
+
|
|
128
|
+
### Backends (`voxedge/backends/`)
|
|
129
|
+
|
|
130
|
+
Clean ABCs in `backends/base.py` — every constructor takes explicit params only, no env coupling:
|
|
131
|
+
|
|
132
|
+
- `ASRBackend` / `ASRStream` — streaming recognition
|
|
133
|
+
- `TTSBackend` — `synthesize()` (batch) + `generate_streaming()` (sentence-level chunks, cooperative cancel via `cancel_token` for barge-in)
|
|
134
|
+
- `VADBackend` / `VADSession` — voice-activity detection for speech / barge-in segmentation
|
|
135
|
+
- `LLMBackend` / `LLMEvent` — token-streaming LLM for the conversation loop
|
|
136
|
+
|
|
137
|
+
Concrete adapters live under `backends/{jetson,rk,sherpa}/` and import their heavy runtimes **lazily** (inside methods), so all modules import on any machine:
|
|
138
|
+
|
|
139
|
+
| Backend | Platform | Models | Extra | Source engine |
|
|
140
|
+
|---------|----------|--------|-------|---------------|
|
|
141
|
+
| `backends/jetson/` | Jetson Orin (TensorRT) | Qwen3-ASR/TTS, Matcha, Kokoro, Paraformer, SenseVoice, MOSS-TTS-Nano | `voxedge[jetson]` aarch64 | [jetson-voice-engine](https://github.com/suharvest/qwen3-edgellm-jetson) |
|
|
142
|
+
| `backends/rk/` | Rockchip RK3576/RK3588 (RKNN) | Qwen3-ASR, Matcha, Piper, Kokoro, Paraformer, SenseVoice | `voxedge[rk]` aarch64 | [rkvoice-stream](https://github.com/suharvest/rkvoice-stream) |
|
|
143
|
+
| `backends/sherpa/` | CPU (any arch) | Paraformer, Zipformer, SenseVoice, Matcha, Kokoro ONNX | `voxedge[sherpa]` | — |
|
|
144
|
+
| `backends/llm/` | Any | OpenAI-compatible LLM over httpx | `voxedge[llm]` | — |
|
|
145
|
+
| `backends/mock.py` | Dev / CI | MockASR, MockTTS, MockVAD, MockLLM | core | — |
|
|
146
|
+
|
|
147
|
+
### Transport (`voxedge/transport/`)
|
|
148
|
+
|
|
149
|
+
`Transport` ABC + two implementations:
|
|
150
|
+
|
|
151
|
+
- `InProcessTransport` — zero-IPC asyncio queues; default, used everywhere in tests
|
|
152
|
+
- `WebSocketTransport` — duck-typed ws adapter with no FastAPI dependency; idle-watchdog timeout injected by caller, reads no env
|
|
153
|
+
|
|
154
|
+
### Conversation Engine (`voxedge/engine/`)
|
|
155
|
+
|
|
156
|
+
`ConversationEngine` + per-connection `Session` coordinator, split into focused collaborators: `audio_dispatcher` (VAD → speech / barge-in), `asr_loop`, `client_events`, `tts_sequencer` / `tts_buffer`, `session_state`, and the LLM↔tool loop — `llm_turn` over the provider-agnostic `turn_driver.run_turn` pump, with `tool_registry` (`@tool` → JSON schema) and `coordinator` / `concurrency_capability` for multi-stream concurrency.
|
|
157
|
+
|
|
158
|
+
### Capabilities (`voxedge/capabilities/`)
|
|
159
|
+
|
|
160
|
+
Optional, default-off, stateless add-ons (punctuation, speaker embedding) via sherpa-onnx. Opt in explicitly; byte-level no-op when off.
|
|
161
|
+
|
|
162
|
+
## Design Constraints
|
|
163
|
+
|
|
164
|
+
- **Pure Python core** — `import voxedge` is numpy-only. Heavy adapters live under `backends/{jetson,rk,sherpa}/` with deferred runtime imports.
|
|
165
|
+
- **No env reads in the library** — all config injected as explicit params. Profiles and deployment knobs are the product's job ([OpenVoiceStream](https://github.com/suharvest/openvoicestream)).
|
|
166
|
+
|
|
167
|
+
## Status
|
|
168
|
+
|
|
169
|
+
In production — the open-core engine behind a shipped edge voice stack. ~270 mock-based tests; the whole engine runs end-to-end on a Mac with no CUDA.
|
|
170
|
+
|
|
171
|
+
## Contributing
|
|
172
|
+
|
|
173
|
+
Issues and PRs welcome. The mock backend suite runs on any machine with no hardware:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
pip install voxedge
|
|
177
|
+
uv run pytest
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Ecosystem
|
|
181
|
+
|
|
182
|
+
voxedge is one layer in a family of repos:
|
|
183
|
+
|
|
184
|
+
| Repo | Role | When to go there |
|
|
185
|
+
|------|------|-----------------|
|
|
186
|
+
| **voxedge** *(this repo)* | Embeddable Python engine | Embedding real-time voice in your own app |
|
|
187
|
+
| [openvoicestream](https://github.com/suharvest/openvoicestream) | Deployable FastAPI/WebSocket server, Docker profiles, agent gallery | Deployed use-cases and end-to-end demos; ready-to-run containers |
|
|
188
|
+
| [rkvoice-stream](https://github.com/suharvest/rkvoice-stream) | Rockchip NPU engine (`backends/rk/` wraps this) | RK3576/RK3588 model formats, RKNN perf numbers, TTS/ASR backend internals |
|
|
189
|
+
| [jetson-voice-engine](https://github.com/suharvest/qwen3-edgellm-jetson) | Jetson TensorRT build scripts, model export, artifacts (`backends/jetson/` wraps this) | Jetson model conversion, TRT engine build, Orin-specific optimisations |
|
|
190
|
+
|
|
191
|
+
## Acknowledgements
|
|
192
|
+
|
|
193
|
+
- [sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx) — CPU ASR/TTS runtime
|
|
194
|
+
- [OpenVoiceStream](https://github.com/suharvest/openvoicestream) — the deployable server product built on this engine
|
|
195
|
+
|
|
196
|
+
## License
|
|
197
|
+
|
|
198
|
+
Apache-2.0. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# voxedge
|
|
2
|
+
|
|
3
|
+
> **English** | [中文](README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="media/banner.png" alt="voxedge banner" width="100%">
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
[](https://pypi.org/project/voxedge)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
[](https://pypi.org/project/voxedge)
|
|
12
|
+
|
|
13
|
+
**Native TensorRT · RKNN · sherpa-onnx voice pipelines for Jetson, Rockchip, and Raspberry Pi — fully on-device, verified on real hardware, zero cloud.**
|
|
14
|
+
|
|
15
|
+
<!-- TODO: Add demo GIF — recommend a ~15s terminal recording showing ASR→TTS on Jetson Orin (place in media/demo.gif) -->
|
|
16
|
+
|
|
17
|
+
## What is voxedge?
|
|
18
|
+
|
|
19
|
+
voxedge is an embeddable Python library that drives real-time, on-device voice conversations by calling directly into each platform's native inference runtime — TensorRT on Jetson Orin, RKNN on RK3576/RK3588, sherpa-onnx on CPU. No cloud STT/TTS APIs, no internet at runtime, no intermediate abstraction overhead. The same `ConversationEngine` API works across all three backends; you swap only the backend constructor — N=2 concurrent sessions verified on Orin Nano 8 GB, byte-identical output, zero CUDA errors.
|
|
20
|
+
|
|
21
|
+
voxedge is the open-core engine behind **[OpenVoiceStream](https://github.com/suharvest/openvoicestream)** — the deployable FastAPI/WebSocket server, device profiles, and agent gallery. Want a container? Start there. Want to embed real-time edge voice in your own app? You're in the right place.
|
|
22
|
+
|
|
23
|
+
## Key Features
|
|
24
|
+
|
|
25
|
+
- **Native runtimes, full performance** — calls directly into TensorRT (Jetson), RKNN (Rockchip), and sherpa-onnx (CPU); no wrapper overhead, no cross-platform abstraction tax
|
|
26
|
+
- **Fully on-device** — no speech API key, no per-call bill, no internet dependency at runtime
|
|
27
|
+
- **Verified on real hardware** — N=2 concurrent sessions on Orin Nano 8 GB: byte-identical output vs. single-stream, zero CUDA errors
|
|
28
|
+
- **Streaming + barge-in** — partial + final ASR while the user speaks; sentence-level TTS streaming with first-audio latency low enough for live dialogue and cooperative barge-in
|
|
29
|
+
- **Swap hardware, not code** — same `ConversationEngine` API across Jetson, Rockchip, and sherpa-onnx CPU; only the backend constructor changes
|
|
30
|
+
- **Test on any machine** — mock backends require only numpy; the whole engine runs end-to-end on a Mac with no CUDA or GPU
|
|
31
|
+
|
|
32
|
+
## Quickstart
|
|
33
|
+
|
|
34
|
+
Runs on any machine — no GPU needed. Swap the backend constructors for a real device; the engine, transport, and event contract never change.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install voxedge
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
import asyncio
|
|
42
|
+
from voxedge.engine import ConversationEngine
|
|
43
|
+
from voxedge.transport import InProcessTransport
|
|
44
|
+
from voxedge.backends.mock import MockASR, MockTTS, MockVAD
|
|
45
|
+
|
|
46
|
+
engine = ConversationEngine(
|
|
47
|
+
backends={"asr": MockASR(transcript="hello world"), "tts": MockTTS(), "vad": MockVAD()},
|
|
48
|
+
multi_utterance=True,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
async def main():
|
|
52
|
+
t = InProcessTransport()
|
|
53
|
+
await t.feed_audio(b"\x01\x02" * 8000) # speech frames (int16 PCM)
|
|
54
|
+
await t.feed_audio(b"\x00\x00" * 8000) # silence → VAD endpoints the utterance
|
|
55
|
+
t.end_input()
|
|
56
|
+
await engine.run(t) # drives ASR → (LLM) → TTS
|
|
57
|
+
for ev in t.drain_events_nowait(): # asr_final / tts_* / ...
|
|
58
|
+
print(ev["type"], ev.get("text", ""))
|
|
59
|
+
|
|
60
|
+
asyncio.run(main())
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
On a real device, swap **only the backend constructors** — everything else is identical:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
# Jetson Orin — pip install voxedge[jetson]
|
|
67
|
+
from voxedge.backends.jetson import (
|
|
68
|
+
TRTEdgeLLMASRBackend, TRTEdgeLLMASRConfig,
|
|
69
|
+
TRTEdgeLLMTTSBackend, TRTEdgeLLMTTSConfig,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
engine = ConversationEngine(backends={
|
|
73
|
+
"asr": TRTEdgeLLMASRBackend(TRTEdgeLLMASRConfig(...)), # Qwen3-ASR, native TRT
|
|
74
|
+
"tts": TRTEdgeLLMTTSBackend(TRTEdgeLLMTTSConfig(...)), # Qwen3-TTS, streaming
|
|
75
|
+
}, multi_utterance=True)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
> `import voxedge` is **numpy-only** — TensorRT, RKNN, and sherpa-onnx are lazy-imported by their backend adapters and pulled in via extras. The example above imports cleanly on a Mac even though the TRT engine only runs on a Jetson.
|
|
79
|
+
|
|
80
|
+
## Install
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pip install voxedge # pure-Python core (numpy only)
|
|
84
|
+
pip install voxedge[sherpa] # sherpa-onnx CPU ASR/TTS
|
|
85
|
+
pip install voxedge[jetson] # Jetson TensorRT backends (aarch64)
|
|
86
|
+
pip install voxedge[rk] # Rockchip RK3576/RK3588 NPU (aarch64)
|
|
87
|
+
pip install voxedge[llm] # OpenAI-compatible LLM backend (httpx)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The `jetson` / `rk` extras declare only pure-Python deps; the CUDA/TensorRT and RKNN runtime wheels ship from the platform (JetPack L4T / Rockchip NPU userspace) or the engine repos — you bring the platform runtime.
|
|
91
|
+
|
|
92
|
+
## Architecture
|
|
93
|
+
|
|
94
|
+
Four layers, all importable without CUDA.
|
|
95
|
+
|
|
96
|
+
### Backends (`voxedge/backends/`)
|
|
97
|
+
|
|
98
|
+
Clean ABCs in `backends/base.py` — every constructor takes explicit params only, no env coupling:
|
|
99
|
+
|
|
100
|
+
- `ASRBackend` / `ASRStream` — streaming recognition
|
|
101
|
+
- `TTSBackend` — `synthesize()` (batch) + `generate_streaming()` (sentence-level chunks, cooperative cancel via `cancel_token` for barge-in)
|
|
102
|
+
- `VADBackend` / `VADSession` — voice-activity detection for speech / barge-in segmentation
|
|
103
|
+
- `LLMBackend` / `LLMEvent` — token-streaming LLM for the conversation loop
|
|
104
|
+
|
|
105
|
+
Concrete adapters live under `backends/{jetson,rk,sherpa}/` and import their heavy runtimes **lazily** (inside methods), so all modules import on any machine:
|
|
106
|
+
|
|
107
|
+
| Backend | Platform | Models | Extra | Source engine |
|
|
108
|
+
|---------|----------|--------|-------|---------------|
|
|
109
|
+
| `backends/jetson/` | Jetson Orin (TensorRT) | Qwen3-ASR/TTS, Matcha, Kokoro, Paraformer, SenseVoice, MOSS-TTS-Nano | `voxedge[jetson]` aarch64 | [jetson-voice-engine](https://github.com/suharvest/qwen3-edgellm-jetson) |
|
|
110
|
+
| `backends/rk/` | Rockchip RK3576/RK3588 (RKNN) | Qwen3-ASR, Matcha, Piper, Kokoro, Paraformer, SenseVoice | `voxedge[rk]` aarch64 | [rkvoice-stream](https://github.com/suharvest/rkvoice-stream) |
|
|
111
|
+
| `backends/sherpa/` | CPU (any arch) | Paraformer, Zipformer, SenseVoice, Matcha, Kokoro ONNX | `voxedge[sherpa]` | — |
|
|
112
|
+
| `backends/llm/` | Any | OpenAI-compatible LLM over httpx | `voxedge[llm]` | — |
|
|
113
|
+
| `backends/mock.py` | Dev / CI | MockASR, MockTTS, MockVAD, MockLLM | core | — |
|
|
114
|
+
|
|
115
|
+
### Transport (`voxedge/transport/`)
|
|
116
|
+
|
|
117
|
+
`Transport` ABC + two implementations:
|
|
118
|
+
|
|
119
|
+
- `InProcessTransport` — zero-IPC asyncio queues; default, used everywhere in tests
|
|
120
|
+
- `WebSocketTransport` — duck-typed ws adapter with no FastAPI dependency; idle-watchdog timeout injected by caller, reads no env
|
|
121
|
+
|
|
122
|
+
### Conversation Engine (`voxedge/engine/`)
|
|
123
|
+
|
|
124
|
+
`ConversationEngine` + per-connection `Session` coordinator, split into focused collaborators: `audio_dispatcher` (VAD → speech / barge-in), `asr_loop`, `client_events`, `tts_sequencer` / `tts_buffer`, `session_state`, and the LLM↔tool loop — `llm_turn` over the provider-agnostic `turn_driver.run_turn` pump, with `tool_registry` (`@tool` → JSON schema) and `coordinator` / `concurrency_capability` for multi-stream concurrency.
|
|
125
|
+
|
|
126
|
+
### Capabilities (`voxedge/capabilities/`)
|
|
127
|
+
|
|
128
|
+
Optional, default-off, stateless add-ons (punctuation, speaker embedding) via sherpa-onnx. Opt in explicitly; byte-level no-op when off.
|
|
129
|
+
|
|
130
|
+
## Design Constraints
|
|
131
|
+
|
|
132
|
+
- **Pure Python core** — `import voxedge` is numpy-only. Heavy adapters live under `backends/{jetson,rk,sherpa}/` with deferred runtime imports.
|
|
133
|
+
- **No env reads in the library** — all config injected as explicit params. Profiles and deployment knobs are the product's job ([OpenVoiceStream](https://github.com/suharvest/openvoicestream)).
|
|
134
|
+
|
|
135
|
+
## Status
|
|
136
|
+
|
|
137
|
+
In production — the open-core engine behind a shipped edge voice stack. ~270 mock-based tests; the whole engine runs end-to-end on a Mac with no CUDA.
|
|
138
|
+
|
|
139
|
+
## Contributing
|
|
140
|
+
|
|
141
|
+
Issues and PRs welcome. The mock backend suite runs on any machine with no hardware:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
pip install voxedge
|
|
145
|
+
uv run pytest
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Ecosystem
|
|
149
|
+
|
|
150
|
+
voxedge is one layer in a family of repos:
|
|
151
|
+
|
|
152
|
+
| Repo | Role | When to go there |
|
|
153
|
+
|------|------|-----------------|
|
|
154
|
+
| **voxedge** *(this repo)* | Embeddable Python engine | Embedding real-time voice in your own app |
|
|
155
|
+
| [openvoicestream](https://github.com/suharvest/openvoicestream) | Deployable FastAPI/WebSocket server, Docker profiles, agent gallery | Deployed use-cases and end-to-end demos; ready-to-run containers |
|
|
156
|
+
| [rkvoice-stream](https://github.com/suharvest/rkvoice-stream) | Rockchip NPU engine (`backends/rk/` wraps this) | RK3576/RK3588 model formats, RKNN perf numbers, TTS/ASR backend internals |
|
|
157
|
+
| [jetson-voice-engine](https://github.com/suharvest/qwen3-edgellm-jetson) | Jetson TensorRT build scripts, model export, artifacts (`backends/jetson/` wraps this) | Jetson model conversion, TRT engine build, Orin-specific optimisations |
|
|
158
|
+
|
|
159
|
+
## Acknowledgements
|
|
160
|
+
|
|
161
|
+
- [sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx) — CPU ASR/TTS runtime
|
|
162
|
+
- [OpenVoiceStream](https://github.com/suharvest/openvoicestream) — the deployable server product built on this engine
|
|
163
|
+
|
|
164
|
+
## License
|
|
165
|
+
|
|
166
|
+
Apache-2.0. See [LICENSE](LICENSE).
|