voxlock 1.0.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.
- voxlock-1.0.0/LICENSE +202 -0
- voxlock-1.0.0/PKG-INFO +149 -0
- voxlock-1.0.0/README.md +122 -0
- voxlock-1.0.0/README.pypi.md +122 -0
- voxlock-1.0.0/pyproject.toml +35 -0
- voxlock-1.0.0/setup.cfg +4 -0
- voxlock-1.0.0/voxlock/__init__.py +5 -0
- voxlock-1.0.0/voxlock/__main__.py +3 -0
- voxlock-1.0.0/voxlock/cli.py +31 -0
- voxlock-1.0.0/voxlock/core.py +117 -0
- voxlock-1.0.0/voxlock.egg-info/PKG-INFO +149 -0
- voxlock-1.0.0/voxlock.egg-info/SOURCES.txt +14 -0
- voxlock-1.0.0/voxlock.egg-info/dependency_links.txt +1 -0
- voxlock-1.0.0/voxlock.egg-info/entry_points.txt +2 -0
- voxlock-1.0.0/voxlock.egg-info/requires.txt +5 -0
- voxlock-1.0.0/voxlock.egg-info/top_level.txt +1 -0
voxlock-1.0.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.
|
voxlock-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: voxlock
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: The best performing voice isolator there is: keeps the caller's voice and removes the other voices in the room. Streaming, CPU, ONNX.
|
|
5
|
+
Author-email: Arbaz Siddiqui <arbaz00@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://huggingface.co/arbazsiddiqui/voxlock
|
|
8
|
+
Project-URL: Repository, https://github.com/arbazsiddiqui/voxlock
|
|
9
|
+
Project-URL: Demo, https://arbazsiddiqui.me/voxlock
|
|
10
|
+
Project-URL: Issues, https://github.com/arbazsiddiqui/voxlock/issues
|
|
11
|
+
Keywords: voice isolation,background voice cancellation,target speaker extraction,speech enhancement,voice agents,telephony,speech-to-text,streaming,real-time,onnx
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
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
|
+
Requires-Dist: numpy>=1.24
|
|
22
|
+
Requires-Dist: onnxruntime>=1.17
|
|
23
|
+
Requires-Dist: huggingface_hub>=0.20
|
|
24
|
+
Requires-Dist: soundfile>=0.12
|
|
25
|
+
Requires-Dist: soxr>=0.3
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# VoxLock
|
|
29
|
+
|
|
30
|
+
**The best performing voice isolator there is.** VoxLock is an open-source voice isolation model: it keeps the caller's voice and removes the other voices in the room before speech-to-text hears them. Made for voice agents and phone calls: one input, the call audio, and it picks out the caller by itself. It streams on a CPU with 24 ms of algorithmic latency.
|
|
31
|
+
|
|
32
|
+
**[Live demo](https://arbazsiddiqui.me/voxlock)** · **[Model on Hugging Face](https://huggingface.co/arbazsiddiqui/voxlock)**
|
|
33
|
+
|
|
34
|
+
<p>
|
|
35
|
+
<a href="https://pypi.org/project/voxlock/"><img alt="PyPI" src="https://img.shields.io/pypi/v/voxlock?label=pypi"></a>
|
|
36
|
+
<a href="https://huggingface.co/arbazsiddiqui/voxlock"><img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97%20model-voxlock-yellow"></a>
|
|
37
|
+
<a href="https://github.com/arbazsiddiqui/voxlock#results"><img alt="Krisp benchmark WER 4.95%" src="https://img.shields.io/badge/Krisp%20benchmark%20WER-4.95%25-brightgreen"></a>
|
|
38
|
+
<a href="https://github.com/arbazsiddiqui/voxlock/blob/main/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/badge/license-Apache--2.0-blue"></a>
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
<a href="https://raw.githubusercontent.com/arbazsiddiqui/voxlock/main/assets/demo.mp4"><img src="https://raw.githubusercontent.com/arbazsiddiqui/voxlock/main/assets/demo-play.jpg" alt="The same 6.5 seconds of a call with VoxLock off and on: off, speech-to-text transcribes the other person; on, it transcribes the caller" width="100%"></a>
|
|
42
|
+
|
|
43
|
+
## Results
|
|
44
|
+
|
|
45
|
+
<img src="https://raw.githubusercontent.com/arbazsiddiqui/voxlock/main/assets/results.png" alt="VoxLock has the lowest word error rate and leaks the fewest background words on the Krisp Voice Isolation Benchmark" width="100%">
|
|
46
|
+
|
|
47
|
+
| Model | Access | Word error rate % | Background words leaked / min |
|
|
48
|
+
|---|---|---|---|
|
|
49
|
+
| **VoxLock** | **open** | **4.95** | **0.11** |
|
|
50
|
+
| Krisp VI 2.5 Default | paid | 5.30 | 1.52 |
|
|
51
|
+
| Krisp VI 2.5 Balanced | paid | 5.32 | 2.02 |
|
|
52
|
+
| Krisp VI 2.5 HD | paid | 5.79 | 2.74 |
|
|
53
|
+
| Krisp VI 2.5 Lite | paid | 6.21 | 4.52 |
|
|
54
|
+
| ai-coustics Voice Focus 2.2 L | paid | 6.84 | 0.66 |
|
|
55
|
+
| ai-coustics Voice Focus 2.2 S | paid | 6.91 | 1.00 |
|
|
56
|
+
| Sanas Voice Isolation SE 1.0 | paid | 9.38 | 13.76 |
|
|
57
|
+
| REAL-TSE causal (VoxLock's starting checkpoint) | open | 9.81 | 13.73 |
|
|
58
|
+
| Hush | open | 12.09 | 19.58 |
|
|
59
|
+
| DeepFilterNet3 | open | 13.30 | 22.77 |
|
|
60
|
+
| TIGER | open | 14.72 | 37.24 |
|
|
61
|
+
| No processing | | 23.21 | 66.48 |
|
|
62
|
+
| SAM-Audio small (Meta) | open | 33.77 | 21.15 |
|
|
63
|
+
|
|
64
|
+
265 real recordings from the [Krisp Voice Isolation Benchmark](https://huggingface.co/datasets/Krisp-AI/VoiceIsolation-Benchmark-Dataset), transcribed with Parakeet TDT 0.6B v2 and scored with the benchmark's published method. **Background words leaked** counts words transcribed while only the background was talking, per minute of that audio.
|
|
65
|
+
|
|
66
|
+
On real AMI meetings not used in training, with the headset wearer as the caller:
|
|
67
|
+
|
|
68
|
+
| Model | Access | Word error rate % | Background words leaked / min |
|
|
69
|
+
|---|---|---|---|
|
|
70
|
+
| **VoxLock** | **open** | **10.12** | 2.12 |
|
|
71
|
+
| ai-coustics Voice Focus 2.2 S | paid | 11.85 | **1.06** |
|
|
72
|
+
| ai-coustics Voice Focus 2.2 L | paid | 12.13 | 1.72 |
|
|
73
|
+
| Sanas Voice Isolation SE 1.0 | paid | 13.30 | 5.30 |
|
|
74
|
+
| TIGER | open | 22.84 | 36.85 |
|
|
75
|
+
| DeepFilterNet3 | open | 26.78 | 38.84 |
|
|
76
|
+
| Hush | open | 33.00 | 68.93 |
|
|
77
|
+
| No processing | | 33.03 | 78.34 |
|
|
78
|
+
|
|
79
|
+
Caller words missed, deletions, insertions and 95% intervals: [bench/results](https://github.com/arbazsiddiqui/voxlock/tree/main/bench/results).
|
|
80
|
+
|
|
81
|
+
## Use
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
pip install voxlock
|
|
85
|
+
voxlock call.wav -o caller.wav
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Any sample rate, mono or stereo. The model, 50 MB, downloads from Hugging Face on first use.
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
import voxlock
|
|
92
|
+
|
|
93
|
+
vl = voxlock.VoxLock()
|
|
94
|
+
call = voxlock.load_audio("call.wav") # 16 kHz mono float32
|
|
95
|
+
caller = vl.isolate(call) # same length as the input
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
VoxLock keeps the voice in a 3-second sample of the caller. `isolate` takes the loudest 3 seconds in the first 15 seconds of the call, which is how it was benchmarked. Pass `sample=` to choose it yourself.
|
|
99
|
+
|
|
100
|
+
### Live calls
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
stream = vl.stream(sample) # about 3 s of the caller, 16 kHz mono
|
|
104
|
+
for chunk in call_audio: # 16 kHz float32 chunks of any size
|
|
105
|
+
send(stream.push(chunk)) # the isolated audio, about 24 ms behind
|
|
106
|
+
send(stream.flush()) # at the end of the call
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The stream needs the sample before it starts. In a voice agent, take the first 3 seconds the caller speaks, or a sample saved from an earlier call, and pass the audio through until then. Streaming gives the same output as `isolate`. With 4 CPU threads on an Apple M2 Pro it runs in real time from 40 ms chunks (`VoxLock(threads=4)`).
|
|
110
|
+
|
|
111
|
+
### PyTorch
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
git clone https://github.com/arbazsiddiqui/voxlock && cd voxlock
|
|
115
|
+
pip install -r requirements.txt
|
|
116
|
+
huggingface-cli download arbazsiddiqui/voxlock model.safetensors config.yaml --local-dir ckpt
|
|
117
|
+
python isolate.py --ckpt ckpt --in call.wav --out caller.wav
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Training
|
|
121
|
+
|
|
122
|
+
A 27M causal band-split RNN target-speaker extractor, fine-tuned from the [REAL-TSE challenge baseline](https://github.com/REAL-TSE/wesep-real-tse) on a single NVIDIA L4:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
REAL-TSE tfmap_context_causal_100
|
|
126
|
+
-> simulated calls 4,000 steps LibriSpeech callers + background talkers in simulated rooms
|
|
127
|
+
-> real AMI crosstalk 4,000 steps headset recordings from 40 meetings
|
|
128
|
+
-> long calls (30 s) 800 steps callers who talk throughout
|
|
129
|
+
-> rooms and distances 400 steps callers near or far from the mic, background voices dry or in the room, room noise
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Repository
|
|
133
|
+
|
|
134
|
+
| Path | |
|
|
135
|
+
|---|---|
|
|
136
|
+
| `voxlock/` | the `pip install voxlock` package: whole files, streaming, command line |
|
|
137
|
+
| `isolate.py` | PyTorch inference |
|
|
138
|
+
| `export_onnx.py` | ONNX export |
|
|
139
|
+
| `demo/` | the browser demo (`python demo/serve.py`) |
|
|
140
|
+
| `bench/` | benchmark harness, vendor runners, per-file results |
|
|
141
|
+
| `train/` | training scripts and data preparation |
|
|
142
|
+
|
|
143
|
+
## Acknowledgements
|
|
144
|
+
|
|
145
|
+
Built on the REAL-TSE challenge baseline and [WeSep](https://github.com/wenet-e2e/wesep) by Shuai Wang, Ke Zhang and co-authors, with [WeSpeaker](https://github.com/wenet-e2e/wespeaker)'s ECAPA model. Trained on [LibriSpeech](https://www.openslr.org/12) and the [AMI Meeting Corpus](https://groups.inf.ed.ac.uk/ami/corpus/).
|
|
146
|
+
|
|
147
|
+
## License
|
|
148
|
+
|
|
149
|
+
Apache-2.0.
|
voxlock-1.0.0/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# VoxLock
|
|
2
|
+
|
|
3
|
+
**The best performing voice isolator there is.** VoxLock is an open-source voice isolation model: it keeps the caller's voice and removes the other voices in the room before speech-to-text hears them. Made for voice agents and phone calls: one input, the call audio, and it picks out the caller by itself. It streams on a CPU with 24 ms of algorithmic latency.
|
|
4
|
+
|
|
5
|
+
**[Live demo](https://arbazsiddiqui.me/voxlock)** · **[Model on Hugging Face](https://huggingface.co/arbazsiddiqui/voxlock)**
|
|
6
|
+
|
|
7
|
+
<p>
|
|
8
|
+
<a href="https://pypi.org/project/voxlock/"><img alt="PyPI" src="https://img.shields.io/pypi/v/voxlock?label=pypi"></a>
|
|
9
|
+
<a href="https://huggingface.co/arbazsiddiqui/voxlock"><img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97%20model-voxlock-yellow"></a>
|
|
10
|
+
<a href="#results"><img alt="Krisp benchmark WER 4.95%" src="https://img.shields.io/badge/Krisp%20benchmark%20WER-4.95%25-brightgreen"></a>
|
|
11
|
+
<a href="LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/badge/license-Apache--2.0-blue"></a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<a href="assets/demo.mp4"><img src="assets/demo-play.jpg" alt="The same 6.5 seconds of a call with VoxLock off and on: off, speech-to-text transcribes the other person; on, it transcribes the caller" width="100%"></a>
|
|
15
|
+
|
|
16
|
+
## Results
|
|
17
|
+
|
|
18
|
+
<img src="assets/results.png" alt="VoxLock has the lowest word error rate and leaks the fewest background words on the Krisp Voice Isolation Benchmark" width="100%">
|
|
19
|
+
|
|
20
|
+
| Model | Access | Word error rate % | Background words leaked / min |
|
|
21
|
+
|---|---|---|---|
|
|
22
|
+
| **VoxLock** | **open** | **4.95** | **0.11** |
|
|
23
|
+
| Krisp VI 2.5 Default | paid | 5.30 | 1.52 |
|
|
24
|
+
| Krisp VI 2.5 Balanced | paid | 5.32 | 2.02 |
|
|
25
|
+
| Krisp VI 2.5 HD | paid | 5.79 | 2.74 |
|
|
26
|
+
| Krisp VI 2.5 Lite | paid | 6.21 | 4.52 |
|
|
27
|
+
| ai-coustics Voice Focus 2.2 L | paid | 6.84 | 0.66 |
|
|
28
|
+
| ai-coustics Voice Focus 2.2 S | paid | 6.91 | 1.00 |
|
|
29
|
+
| Sanas Voice Isolation SE 1.0 | paid | 9.38 | 13.76 |
|
|
30
|
+
| REAL-TSE causal (VoxLock's starting checkpoint) | open | 9.81 | 13.73 |
|
|
31
|
+
| Hush | open | 12.09 | 19.58 |
|
|
32
|
+
| DeepFilterNet3 | open | 13.30 | 22.77 |
|
|
33
|
+
| TIGER | open | 14.72 | 37.24 |
|
|
34
|
+
| No processing | | 23.21 | 66.48 |
|
|
35
|
+
| SAM-Audio small (Meta) | open | 33.77 | 21.15 |
|
|
36
|
+
|
|
37
|
+
265 real recordings from the [Krisp Voice Isolation Benchmark](https://huggingface.co/datasets/Krisp-AI/VoiceIsolation-Benchmark-Dataset), transcribed with Parakeet TDT 0.6B v2 and scored with the benchmark's published method. **Background words leaked** counts words transcribed while only the background was talking, per minute of that audio.
|
|
38
|
+
|
|
39
|
+
On real AMI meetings not used in training, with the headset wearer as the caller:
|
|
40
|
+
|
|
41
|
+
| Model | Access | Word error rate % | Background words leaked / min |
|
|
42
|
+
|---|---|---|---|
|
|
43
|
+
| **VoxLock** | **open** | **10.12** | 2.12 |
|
|
44
|
+
| ai-coustics Voice Focus 2.2 S | paid | 11.85 | **1.06** |
|
|
45
|
+
| ai-coustics Voice Focus 2.2 L | paid | 12.13 | 1.72 |
|
|
46
|
+
| Sanas Voice Isolation SE 1.0 | paid | 13.30 | 5.30 |
|
|
47
|
+
| TIGER | open | 22.84 | 36.85 |
|
|
48
|
+
| DeepFilterNet3 | open | 26.78 | 38.84 |
|
|
49
|
+
| Hush | open | 33.00 | 68.93 |
|
|
50
|
+
| No processing | | 33.03 | 78.34 |
|
|
51
|
+
|
|
52
|
+
Caller words missed, deletions, insertions and 95% intervals: [bench/results](bench/results).
|
|
53
|
+
|
|
54
|
+
## Use
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install voxlock
|
|
58
|
+
voxlock call.wav -o caller.wav
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Any sample rate, mono or stereo. The model, 50 MB, downloads from Hugging Face on first use.
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import voxlock
|
|
65
|
+
|
|
66
|
+
vl = voxlock.VoxLock()
|
|
67
|
+
call = voxlock.load_audio("call.wav") # 16 kHz mono float32
|
|
68
|
+
caller = vl.isolate(call) # same length as the input
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
VoxLock keeps the voice in a 3-second sample of the caller. `isolate` takes the loudest 3 seconds in the first 15 seconds of the call, which is how it was benchmarked. Pass `sample=` to choose it yourself.
|
|
72
|
+
|
|
73
|
+
### Live calls
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
stream = vl.stream(sample) # about 3 s of the caller, 16 kHz mono
|
|
77
|
+
for chunk in call_audio: # 16 kHz float32 chunks of any size
|
|
78
|
+
send(stream.push(chunk)) # the isolated audio, about 24 ms behind
|
|
79
|
+
send(stream.flush()) # at the end of the call
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The stream needs the sample before it starts. In a voice agent, take the first 3 seconds the caller speaks, or a sample saved from an earlier call, and pass the audio through until then. Streaming gives the same output as `isolate`. With 4 CPU threads on an Apple M2 Pro it runs in real time from 40 ms chunks (`VoxLock(threads=4)`).
|
|
83
|
+
|
|
84
|
+
### PyTorch
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
git clone https://github.com/arbazsiddiqui/voxlock && cd voxlock
|
|
88
|
+
pip install -r requirements.txt
|
|
89
|
+
huggingface-cli download arbazsiddiqui/voxlock model.safetensors config.yaml --local-dir ckpt
|
|
90
|
+
python isolate.py --ckpt ckpt --in call.wav --out caller.wav
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Training
|
|
94
|
+
|
|
95
|
+
A 27M causal band-split RNN target-speaker extractor, fine-tuned from the [REAL-TSE challenge baseline](https://github.com/REAL-TSE/wesep-real-tse) on a single NVIDIA L4:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
REAL-TSE tfmap_context_causal_100
|
|
99
|
+
-> simulated calls 4,000 steps LibriSpeech callers + background talkers in simulated rooms
|
|
100
|
+
-> real AMI crosstalk 4,000 steps headset recordings from 40 meetings
|
|
101
|
+
-> long calls (30 s) 800 steps callers who talk throughout
|
|
102
|
+
-> rooms and distances 400 steps callers near or far from the mic, background voices dry or in the room, room noise
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Repository
|
|
106
|
+
|
|
107
|
+
| Path | |
|
|
108
|
+
|---|---|
|
|
109
|
+
| `voxlock/` | the `pip install voxlock` package: whole files, streaming, command line |
|
|
110
|
+
| `isolate.py` | PyTorch inference |
|
|
111
|
+
| `export_onnx.py` | ONNX export |
|
|
112
|
+
| `demo/` | the browser demo (`python demo/serve.py`) |
|
|
113
|
+
| `bench/` | benchmark harness, vendor runners, per-file results |
|
|
114
|
+
| `train/` | training scripts and data preparation |
|
|
115
|
+
|
|
116
|
+
## Acknowledgements
|
|
117
|
+
|
|
118
|
+
Built on the REAL-TSE challenge baseline and [WeSep](https://github.com/wenet-e2e/wesep) by Shuai Wang, Ke Zhang and co-authors, with [WeSpeaker](https://github.com/wenet-e2e/wespeaker)'s ECAPA model. Trained on [LibriSpeech](https://www.openslr.org/12) and the [AMI Meeting Corpus](https://groups.inf.ed.ac.uk/ami/corpus/).
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
Apache-2.0.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# VoxLock
|
|
2
|
+
|
|
3
|
+
**The best performing voice isolator there is.** VoxLock is an open-source voice isolation model: it keeps the caller's voice and removes the other voices in the room before speech-to-text hears them. Made for voice agents and phone calls: one input, the call audio, and it picks out the caller by itself. It streams on a CPU with 24 ms of algorithmic latency.
|
|
4
|
+
|
|
5
|
+
**[Live demo](https://arbazsiddiqui.me/voxlock)** · **[Model on Hugging Face](https://huggingface.co/arbazsiddiqui/voxlock)**
|
|
6
|
+
|
|
7
|
+
<p>
|
|
8
|
+
<a href="https://pypi.org/project/voxlock/"><img alt="PyPI" src="https://img.shields.io/pypi/v/voxlock?label=pypi"></a>
|
|
9
|
+
<a href="https://huggingface.co/arbazsiddiqui/voxlock"><img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97%20model-voxlock-yellow"></a>
|
|
10
|
+
<a href="https://github.com/arbazsiddiqui/voxlock#results"><img alt="Krisp benchmark WER 4.95%" src="https://img.shields.io/badge/Krisp%20benchmark%20WER-4.95%25-brightgreen"></a>
|
|
11
|
+
<a href="https://github.com/arbazsiddiqui/voxlock/blob/main/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/badge/license-Apache--2.0-blue"></a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<a href="https://raw.githubusercontent.com/arbazsiddiqui/voxlock/main/assets/demo.mp4"><img src="https://raw.githubusercontent.com/arbazsiddiqui/voxlock/main/assets/demo-play.jpg" alt="The same 6.5 seconds of a call with VoxLock off and on: off, speech-to-text transcribes the other person; on, it transcribes the caller" width="100%"></a>
|
|
15
|
+
|
|
16
|
+
## Results
|
|
17
|
+
|
|
18
|
+
<img src="https://raw.githubusercontent.com/arbazsiddiqui/voxlock/main/assets/results.png" alt="VoxLock has the lowest word error rate and leaks the fewest background words on the Krisp Voice Isolation Benchmark" width="100%">
|
|
19
|
+
|
|
20
|
+
| Model | Access | Word error rate % | Background words leaked / min |
|
|
21
|
+
|---|---|---|---|
|
|
22
|
+
| **VoxLock** | **open** | **4.95** | **0.11** |
|
|
23
|
+
| Krisp VI 2.5 Default | paid | 5.30 | 1.52 |
|
|
24
|
+
| Krisp VI 2.5 Balanced | paid | 5.32 | 2.02 |
|
|
25
|
+
| Krisp VI 2.5 HD | paid | 5.79 | 2.74 |
|
|
26
|
+
| Krisp VI 2.5 Lite | paid | 6.21 | 4.52 |
|
|
27
|
+
| ai-coustics Voice Focus 2.2 L | paid | 6.84 | 0.66 |
|
|
28
|
+
| ai-coustics Voice Focus 2.2 S | paid | 6.91 | 1.00 |
|
|
29
|
+
| Sanas Voice Isolation SE 1.0 | paid | 9.38 | 13.76 |
|
|
30
|
+
| REAL-TSE causal (VoxLock's starting checkpoint) | open | 9.81 | 13.73 |
|
|
31
|
+
| Hush | open | 12.09 | 19.58 |
|
|
32
|
+
| DeepFilterNet3 | open | 13.30 | 22.77 |
|
|
33
|
+
| TIGER | open | 14.72 | 37.24 |
|
|
34
|
+
| No processing | | 23.21 | 66.48 |
|
|
35
|
+
| SAM-Audio small (Meta) | open | 33.77 | 21.15 |
|
|
36
|
+
|
|
37
|
+
265 real recordings from the [Krisp Voice Isolation Benchmark](https://huggingface.co/datasets/Krisp-AI/VoiceIsolation-Benchmark-Dataset), transcribed with Parakeet TDT 0.6B v2 and scored with the benchmark's published method. **Background words leaked** counts words transcribed while only the background was talking, per minute of that audio.
|
|
38
|
+
|
|
39
|
+
On real AMI meetings not used in training, with the headset wearer as the caller:
|
|
40
|
+
|
|
41
|
+
| Model | Access | Word error rate % | Background words leaked / min |
|
|
42
|
+
|---|---|---|---|
|
|
43
|
+
| **VoxLock** | **open** | **10.12** | 2.12 |
|
|
44
|
+
| ai-coustics Voice Focus 2.2 S | paid | 11.85 | **1.06** |
|
|
45
|
+
| ai-coustics Voice Focus 2.2 L | paid | 12.13 | 1.72 |
|
|
46
|
+
| Sanas Voice Isolation SE 1.0 | paid | 13.30 | 5.30 |
|
|
47
|
+
| TIGER | open | 22.84 | 36.85 |
|
|
48
|
+
| DeepFilterNet3 | open | 26.78 | 38.84 |
|
|
49
|
+
| Hush | open | 33.00 | 68.93 |
|
|
50
|
+
| No processing | | 33.03 | 78.34 |
|
|
51
|
+
|
|
52
|
+
Caller words missed, deletions, insertions and 95% intervals: [bench/results](https://github.com/arbazsiddiqui/voxlock/tree/main/bench/results).
|
|
53
|
+
|
|
54
|
+
## Use
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install voxlock
|
|
58
|
+
voxlock call.wav -o caller.wav
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Any sample rate, mono or stereo. The model, 50 MB, downloads from Hugging Face on first use.
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import voxlock
|
|
65
|
+
|
|
66
|
+
vl = voxlock.VoxLock()
|
|
67
|
+
call = voxlock.load_audio("call.wav") # 16 kHz mono float32
|
|
68
|
+
caller = vl.isolate(call) # same length as the input
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
VoxLock keeps the voice in a 3-second sample of the caller. `isolate` takes the loudest 3 seconds in the first 15 seconds of the call, which is how it was benchmarked. Pass `sample=` to choose it yourself.
|
|
72
|
+
|
|
73
|
+
### Live calls
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
stream = vl.stream(sample) # about 3 s of the caller, 16 kHz mono
|
|
77
|
+
for chunk in call_audio: # 16 kHz float32 chunks of any size
|
|
78
|
+
send(stream.push(chunk)) # the isolated audio, about 24 ms behind
|
|
79
|
+
send(stream.flush()) # at the end of the call
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The stream needs the sample before it starts. In a voice agent, take the first 3 seconds the caller speaks, or a sample saved from an earlier call, and pass the audio through until then. Streaming gives the same output as `isolate`. With 4 CPU threads on an Apple M2 Pro it runs in real time from 40 ms chunks (`VoxLock(threads=4)`).
|
|
83
|
+
|
|
84
|
+
### PyTorch
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
git clone https://github.com/arbazsiddiqui/voxlock && cd voxlock
|
|
88
|
+
pip install -r requirements.txt
|
|
89
|
+
huggingface-cli download arbazsiddiqui/voxlock model.safetensors config.yaml --local-dir ckpt
|
|
90
|
+
python isolate.py --ckpt ckpt --in call.wav --out caller.wav
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Training
|
|
94
|
+
|
|
95
|
+
A 27M causal band-split RNN target-speaker extractor, fine-tuned from the [REAL-TSE challenge baseline](https://github.com/REAL-TSE/wesep-real-tse) on a single NVIDIA L4:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
REAL-TSE tfmap_context_causal_100
|
|
99
|
+
-> simulated calls 4,000 steps LibriSpeech callers + background talkers in simulated rooms
|
|
100
|
+
-> real AMI crosstalk 4,000 steps headset recordings from 40 meetings
|
|
101
|
+
-> long calls (30 s) 800 steps callers who talk throughout
|
|
102
|
+
-> rooms and distances 400 steps callers near or far from the mic, background voices dry or in the room, room noise
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Repository
|
|
106
|
+
|
|
107
|
+
| Path | |
|
|
108
|
+
|---|---|
|
|
109
|
+
| `voxlock/` | the `pip install voxlock` package: whole files, streaming, command line |
|
|
110
|
+
| `isolate.py` | PyTorch inference |
|
|
111
|
+
| `export_onnx.py` | ONNX export |
|
|
112
|
+
| `demo/` | the browser demo (`python demo/serve.py`) |
|
|
113
|
+
| `bench/` | benchmark harness, vendor runners, per-file results |
|
|
114
|
+
| `train/` | training scripts and data preparation |
|
|
115
|
+
|
|
116
|
+
## Acknowledgements
|
|
117
|
+
|
|
118
|
+
Built on the REAL-TSE challenge baseline and [WeSep](https://github.com/wenet-e2e/wesep) by Shuai Wang, Ke Zhang and co-authors, with [WeSpeaker](https://github.com/wenet-e2e/wespeaker)'s ECAPA model. Trained on [LibriSpeech](https://www.openslr.org/12) and the [AMI Meeting Corpus](https://groups.inf.ed.ac.uk/ami/corpus/).
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
Apache-2.0.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "voxlock"
|
|
3
|
+
version = "1.0.0"
|
|
4
|
+
description = "The best performing voice isolator there is: keeps the caller's voice and removes the other voices in the room. Streaming, CPU, ONNX."
|
|
5
|
+
readme = "README.pypi.md"
|
|
6
|
+
requires-python = ">=3.9"
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
dependencies = ["numpy>=1.24", "onnxruntime>=1.17", "huggingface_hub>=0.20", "soundfile>=0.12", "soxr>=0.3"]
|
|
10
|
+
authors = [{ name = "Arbaz Siddiqui", email = "arbaz00@gmail.com" }]
|
|
11
|
+
keywords = ["voice isolation", "background voice cancellation", "target speaker extraction", "speech enhancement", "voice agents", "telephony", "speech-to-text", "streaming", "real-time", "onnx"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 5 - Production/Stable",
|
|
14
|
+
"Intended Audience :: Developers",
|
|
15
|
+
"Intended Audience :: Science/Research",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Topic :: Multimedia :: Sound/Audio :: Speech",
|
|
18
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Homepage = "https://huggingface.co/arbazsiddiqui/voxlock"
|
|
23
|
+
Repository = "https://github.com/arbazsiddiqui/voxlock"
|
|
24
|
+
Demo = "https://arbazsiddiqui.me/voxlock"
|
|
25
|
+
Issues = "https://github.com/arbazsiddiqui/voxlock/issues"
|
|
26
|
+
|
|
27
|
+
[project.scripts]
|
|
28
|
+
voxlock = "voxlock.cli:main"
|
|
29
|
+
|
|
30
|
+
[build-system]
|
|
31
|
+
requires = ["setuptools>=77"]
|
|
32
|
+
build-backend = "setuptools.build_meta"
|
|
33
|
+
|
|
34
|
+
[tool.setuptools]
|
|
35
|
+
packages = ["voxlock"]
|
voxlock-1.0.0/setup.cfg
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"""VoxLock, the best performing voice isolator: keeps the caller's voice and removes the other voices in the room."""
|
|
2
|
+
from .core import SR, Stream, VoxLock, download, load_audio, loud_sample
|
|
3
|
+
|
|
4
|
+
__version__ = "1.0.0"
|
|
5
|
+
__all__ = ["SR", "Stream", "VoxLock", "download", "load_audio", "loud_sample"]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""voxlock call.wav -o caller.wav"""
|
|
2
|
+
import argparse, sys, time
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
import soundfile as sf
|
|
5
|
+
from . import SR, VoxLock, load_audio
|
|
6
|
+
|
|
7
|
+
def main(argv=None):
|
|
8
|
+
ap = argparse.ArgumentParser(prog="voxlock", description="Keep the caller's voice, remove the other voices in the room.")
|
|
9
|
+
ap.add_argument("inputs", nargs="+", help="audio files, any sample rate")
|
|
10
|
+
ap.add_argument("-o", "--out", help="output file (one input) or folder (several); default: <name>.voxlock.wav")
|
|
11
|
+
ap.add_argument("--sample", help="a recording of the caller's voice; default: the loudest 3 s in the first 15 s")
|
|
12
|
+
ap.add_argument("--fp32", action="store_true", help="use the float32 model files")
|
|
13
|
+
ap.add_argument("--threads", type=int, default=0)
|
|
14
|
+
a = ap.parse_args(argv)
|
|
15
|
+
vl = VoxLock(fp16=not a.fp32, threads=a.threads)
|
|
16
|
+
sample = load_audio(a.sample) if a.sample else None
|
|
17
|
+
for src in map(Path, a.inputs):
|
|
18
|
+
if a.out and len(a.inputs) == 1:
|
|
19
|
+
dst = Path(a.out)
|
|
20
|
+
elif a.out:
|
|
21
|
+
dst = Path(a.out) / f"{src.stem}.wav"
|
|
22
|
+
else:
|
|
23
|
+
dst = src.with_name(f"{src.stem}.voxlock.wav")
|
|
24
|
+
dst.parent.mkdir(parents=True, exist_ok=True)
|
|
25
|
+
x = load_audio(src)
|
|
26
|
+
t = time.time()
|
|
27
|
+
sf.write(str(dst), vl.isolate(x, sample), SR)
|
|
28
|
+
print(f"{src} -> {dst} ({len(x) / SR:.1f} s in {time.time() - t:.1f} s)", file=sys.stderr)
|
|
29
|
+
|
|
30
|
+
if __name__ == "__main__":
|
|
31
|
+
main()
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"""VoxLock on onnxruntime: isolate a whole call, or stream a live one chunk by chunk.
|
|
2
|
+
|
|
3
|
+
Streaming and file mode give the same output: only the LSTM state crosses frames, and it is carried over.
|
|
4
|
+
"""
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
import numpy as np
|
|
7
|
+
import onnxruntime as ort
|
|
8
|
+
|
|
9
|
+
SR, HOP, NFFT, PAD = 16000, 128, 512, 256
|
|
10
|
+
REPO, REVISION = "arbazsiddiqui/voxlock", "770c2e4ede56458ca0ccf977de935e46d6733f2c"
|
|
11
|
+
WIN2 = (0.5 - 0.5 * np.cos(2 * np.pi * np.arange(NFFT) / NFFT)).astype(np.float32) ** 2
|
|
12
|
+
|
|
13
|
+
def loud_sample(mix, sec=3.0, within=15.0):
|
|
14
|
+
"""The voice sample VoxLock is benchmarked with: the loudest `sec` seconds in the first `within` seconds."""
|
|
15
|
+
seg = np.asarray(mix, np.float32)[: int(within * SR)]
|
|
16
|
+
n = len(seg) // 160
|
|
17
|
+
w = int(sec * SR / 160)
|
|
18
|
+
if n <= w:
|
|
19
|
+
return seg
|
|
20
|
+
e = (seg[: n * 160].reshape(n, 160) ** 2).mean(1)
|
|
21
|
+
st = int(np.convolve(e, np.ones(w), "valid").argmax()) * 160
|
|
22
|
+
return seg[st: st + int(sec * SR)]
|
|
23
|
+
|
|
24
|
+
def load_audio(path):
|
|
25
|
+
"""Any file soundfile reads, as 16 kHz mono float32."""
|
|
26
|
+
import soundfile as sf, soxr
|
|
27
|
+
x, sr = sf.read(str(path), dtype="float32", always_2d=True)
|
|
28
|
+
x = x.mean(1)
|
|
29
|
+
return (soxr.resample(x, sr, SR) if sr != SR else x).astype(np.float32)
|
|
30
|
+
|
|
31
|
+
def download(fp16=True):
|
|
32
|
+
"""Fetch the ONNX files from Hugging Face into its cache, once. Returns the folder holding them."""
|
|
33
|
+
from huggingface_hub import hf_hub_download
|
|
34
|
+
sfx = "_fp16" if fp16 else ""
|
|
35
|
+
hf_hub_download(REPO, "config.yaml", revision=REVISION)
|
|
36
|
+
for name in (f"onnx/enroll{sfx}.onnx", f"onnx/chunk{sfx}.onnx"):
|
|
37
|
+
path = hf_hub_download(REPO, name, revision=REVISION)
|
|
38
|
+
return Path(path).parent
|
|
39
|
+
|
|
40
|
+
class VoxLock:
|
|
41
|
+
def __init__(self, model_dir=None, fp16=True, threads=0):
|
|
42
|
+
"""model_dir: a folder with enroll*.onnx and chunk*.onnx; None downloads them from Hugging Face.
|
|
43
|
+
fp16=True uses the 50 MB float16-weight files, False the float32 ones. threads=0 lets onnxruntime choose."""
|
|
44
|
+
model_dir = Path(model_dir) if model_dir else download(fp16)
|
|
45
|
+
so = ort.SessionOptions()
|
|
46
|
+
if threads:
|
|
47
|
+
so.intra_op_num_threads = threads
|
|
48
|
+
sfx = "_fp16" if fp16 and (model_dir / "chunk_fp16.onnx").exists() else ""
|
|
49
|
+
self.enroll = ort.InferenceSession(str(model_dir / f"enroll{sfx}.onnx"), so)
|
|
50
|
+
self.chunk = ort.InferenceSession(str(model_dir / f"chunk{sfx}.onnx"), so)
|
|
51
|
+
|
|
52
|
+
def stream(self, sample):
|
|
53
|
+
"""A live stream locked to the voice in `sample` (about 3 s of the caller, 16 kHz mono)."""
|
|
54
|
+
return Stream(self, np.asarray(sample, np.float32))
|
|
55
|
+
|
|
56
|
+
def isolate(self, audio, sample=None):
|
|
57
|
+
"""The whole call in, the caller out, same length. Without `sample`, uses loud_sample(audio)."""
|
|
58
|
+
audio = np.asarray(audio, np.float32)
|
|
59
|
+
s = self.stream(loud_sample(audio) if sample is None else sample)
|
|
60
|
+
return np.concatenate([s.push(audio, frames_per_run=100), s.flush()])[: len(audio)]
|
|
61
|
+
|
|
62
|
+
class Stream:
|
|
63
|
+
def __init__(self, vl, sample):
|
|
64
|
+
self.vl = vl
|
|
65
|
+
self.mag, self.ctx = vl.enroll.run(None, {"enroll": sample[None]})
|
|
66
|
+
self.h = np.zeros((6, 32, 256), np.float32); self.c = np.zeros_like(self.h)
|
|
67
|
+
self.head = np.zeros(0, np.float32) # first samples, until the start padding can be built
|
|
68
|
+
self.buf = None # padded input not yet consumed by a frame
|
|
69
|
+
self.ola = np.zeros(NFFT, np.float32); self.env = np.zeros(NFFT, np.float32)
|
|
70
|
+
self.dropped = 0 # leading padded samples still to drop from the output
|
|
71
|
+
self.n_in = 0
|
|
72
|
+
|
|
73
|
+
def _run(self, frames_per_run):
|
|
74
|
+
out = []
|
|
75
|
+
while self.buf is not None and len(self.buf) >= NFFT:
|
|
76
|
+
k = min(frames_per_run, 1 + (len(self.buf) - NFFT) // HOP)
|
|
77
|
+
seg = self.buf[: (k - 1) * HOP + NFFT]
|
|
78
|
+
fr, self.h, self.c = self.vl.chunk.run(None, {"wav": seg[None], "enroll_mag": self.mag, "context": self.ctx,
|
|
79
|
+
"h": self.h, "c": self.c})
|
|
80
|
+
ola = np.concatenate([self.ola, np.zeros(k * HOP, np.float32)])
|
|
81
|
+
env = np.concatenate([self.env, np.zeros(k * HOP, np.float32)])
|
|
82
|
+
for j in range(k):
|
|
83
|
+
ola[j * HOP: j * HOP + NFFT] += fr[0, j]; env[j * HOP: j * HOP + NFFT] += WIN2
|
|
84
|
+
done = k * HOP # samples no later frame will touch
|
|
85
|
+
y = ola[:done] / np.where(env[:done] > 1e-11, env[:done], 1.0)
|
|
86
|
+
self.ola, self.env = ola[done:], env[done:]
|
|
87
|
+
self.buf = self.buf[done:]
|
|
88
|
+
cut = min(self.dropped, len(y)); self.dropped -= cut
|
|
89
|
+
out.append(y[cut:])
|
|
90
|
+
return np.concatenate(out) if out else np.zeros(0, np.float32)
|
|
91
|
+
|
|
92
|
+
def push(self, chunk, frames_per_run=100):
|
|
93
|
+
"""Any number of 16 kHz samples in; the isolated audio that is ready comes out, 24 ms behind the input."""
|
|
94
|
+
chunk = np.asarray(chunk, np.float32)
|
|
95
|
+
self.n_in += len(chunk)
|
|
96
|
+
if self.buf is None:
|
|
97
|
+
self.head = np.concatenate([self.head, chunk])
|
|
98
|
+
if len(self.head) <= PAD:
|
|
99
|
+
return np.zeros(0, np.float32)
|
|
100
|
+
self.buf = np.concatenate([self.head[1: PAD + 1][::-1], self.head]) # torch.stft centre padding (reflect)
|
|
101
|
+
self.dropped = PAD
|
|
102
|
+
else:
|
|
103
|
+
self.buf = np.concatenate([self.buf, chunk])
|
|
104
|
+
return self._run(frames_per_run)
|
|
105
|
+
|
|
106
|
+
def flush(self):
|
|
107
|
+
"""End of the call: returns the last samples still held back."""
|
|
108
|
+
if self.buf is None:
|
|
109
|
+
return np.zeros(0, np.float32)
|
|
110
|
+
x = np.concatenate([self.buf, self.buf[-PAD - 1: -1][::-1]]) # end padding (reflect)
|
|
111
|
+
nfr = 1 + (len(x) - NFFT) // HOP
|
|
112
|
+
x = np.pad(x, (0, max(0, (nfr - 1) * HOP + NFFT - len(x))))
|
|
113
|
+
self.buf = x
|
|
114
|
+
y = self._run(100)
|
|
115
|
+
y = np.concatenate([y, self.ola / np.where(self.env > 1e-11, self.env, 1.0)])
|
|
116
|
+
self.buf = None
|
|
117
|
+
return y
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: voxlock
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: The best performing voice isolator there is: keeps the caller's voice and removes the other voices in the room. Streaming, CPU, ONNX.
|
|
5
|
+
Author-email: Arbaz Siddiqui <arbaz00@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://huggingface.co/arbazsiddiqui/voxlock
|
|
8
|
+
Project-URL: Repository, https://github.com/arbazsiddiqui/voxlock
|
|
9
|
+
Project-URL: Demo, https://arbazsiddiqui.me/voxlock
|
|
10
|
+
Project-URL: Issues, https://github.com/arbazsiddiqui/voxlock/issues
|
|
11
|
+
Keywords: voice isolation,background voice cancellation,target speaker extraction,speech enhancement,voice agents,telephony,speech-to-text,streaming,real-time,onnx
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
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
|
+
Requires-Dist: numpy>=1.24
|
|
22
|
+
Requires-Dist: onnxruntime>=1.17
|
|
23
|
+
Requires-Dist: huggingface_hub>=0.20
|
|
24
|
+
Requires-Dist: soundfile>=0.12
|
|
25
|
+
Requires-Dist: soxr>=0.3
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# VoxLock
|
|
29
|
+
|
|
30
|
+
**The best performing voice isolator there is.** VoxLock is an open-source voice isolation model: it keeps the caller's voice and removes the other voices in the room before speech-to-text hears them. Made for voice agents and phone calls: one input, the call audio, and it picks out the caller by itself. It streams on a CPU with 24 ms of algorithmic latency.
|
|
31
|
+
|
|
32
|
+
**[Live demo](https://arbazsiddiqui.me/voxlock)** · **[Model on Hugging Face](https://huggingface.co/arbazsiddiqui/voxlock)**
|
|
33
|
+
|
|
34
|
+
<p>
|
|
35
|
+
<a href="https://pypi.org/project/voxlock/"><img alt="PyPI" src="https://img.shields.io/pypi/v/voxlock?label=pypi"></a>
|
|
36
|
+
<a href="https://huggingface.co/arbazsiddiqui/voxlock"><img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97%20model-voxlock-yellow"></a>
|
|
37
|
+
<a href="https://github.com/arbazsiddiqui/voxlock#results"><img alt="Krisp benchmark WER 4.95%" src="https://img.shields.io/badge/Krisp%20benchmark%20WER-4.95%25-brightgreen"></a>
|
|
38
|
+
<a href="https://github.com/arbazsiddiqui/voxlock/blob/main/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/badge/license-Apache--2.0-blue"></a>
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
<a href="https://raw.githubusercontent.com/arbazsiddiqui/voxlock/main/assets/demo.mp4"><img src="https://raw.githubusercontent.com/arbazsiddiqui/voxlock/main/assets/demo-play.jpg" alt="The same 6.5 seconds of a call with VoxLock off and on: off, speech-to-text transcribes the other person; on, it transcribes the caller" width="100%"></a>
|
|
42
|
+
|
|
43
|
+
## Results
|
|
44
|
+
|
|
45
|
+
<img src="https://raw.githubusercontent.com/arbazsiddiqui/voxlock/main/assets/results.png" alt="VoxLock has the lowest word error rate and leaks the fewest background words on the Krisp Voice Isolation Benchmark" width="100%">
|
|
46
|
+
|
|
47
|
+
| Model | Access | Word error rate % | Background words leaked / min |
|
|
48
|
+
|---|---|---|---|
|
|
49
|
+
| **VoxLock** | **open** | **4.95** | **0.11** |
|
|
50
|
+
| Krisp VI 2.5 Default | paid | 5.30 | 1.52 |
|
|
51
|
+
| Krisp VI 2.5 Balanced | paid | 5.32 | 2.02 |
|
|
52
|
+
| Krisp VI 2.5 HD | paid | 5.79 | 2.74 |
|
|
53
|
+
| Krisp VI 2.5 Lite | paid | 6.21 | 4.52 |
|
|
54
|
+
| ai-coustics Voice Focus 2.2 L | paid | 6.84 | 0.66 |
|
|
55
|
+
| ai-coustics Voice Focus 2.2 S | paid | 6.91 | 1.00 |
|
|
56
|
+
| Sanas Voice Isolation SE 1.0 | paid | 9.38 | 13.76 |
|
|
57
|
+
| REAL-TSE causal (VoxLock's starting checkpoint) | open | 9.81 | 13.73 |
|
|
58
|
+
| Hush | open | 12.09 | 19.58 |
|
|
59
|
+
| DeepFilterNet3 | open | 13.30 | 22.77 |
|
|
60
|
+
| TIGER | open | 14.72 | 37.24 |
|
|
61
|
+
| No processing | | 23.21 | 66.48 |
|
|
62
|
+
| SAM-Audio small (Meta) | open | 33.77 | 21.15 |
|
|
63
|
+
|
|
64
|
+
265 real recordings from the [Krisp Voice Isolation Benchmark](https://huggingface.co/datasets/Krisp-AI/VoiceIsolation-Benchmark-Dataset), transcribed with Parakeet TDT 0.6B v2 and scored with the benchmark's published method. **Background words leaked** counts words transcribed while only the background was talking, per minute of that audio.
|
|
65
|
+
|
|
66
|
+
On real AMI meetings not used in training, with the headset wearer as the caller:
|
|
67
|
+
|
|
68
|
+
| Model | Access | Word error rate % | Background words leaked / min |
|
|
69
|
+
|---|---|---|---|
|
|
70
|
+
| **VoxLock** | **open** | **10.12** | 2.12 |
|
|
71
|
+
| ai-coustics Voice Focus 2.2 S | paid | 11.85 | **1.06** |
|
|
72
|
+
| ai-coustics Voice Focus 2.2 L | paid | 12.13 | 1.72 |
|
|
73
|
+
| Sanas Voice Isolation SE 1.0 | paid | 13.30 | 5.30 |
|
|
74
|
+
| TIGER | open | 22.84 | 36.85 |
|
|
75
|
+
| DeepFilterNet3 | open | 26.78 | 38.84 |
|
|
76
|
+
| Hush | open | 33.00 | 68.93 |
|
|
77
|
+
| No processing | | 33.03 | 78.34 |
|
|
78
|
+
|
|
79
|
+
Caller words missed, deletions, insertions and 95% intervals: [bench/results](https://github.com/arbazsiddiqui/voxlock/tree/main/bench/results).
|
|
80
|
+
|
|
81
|
+
## Use
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
pip install voxlock
|
|
85
|
+
voxlock call.wav -o caller.wav
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Any sample rate, mono or stereo. The model, 50 MB, downloads from Hugging Face on first use.
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
import voxlock
|
|
92
|
+
|
|
93
|
+
vl = voxlock.VoxLock()
|
|
94
|
+
call = voxlock.load_audio("call.wav") # 16 kHz mono float32
|
|
95
|
+
caller = vl.isolate(call) # same length as the input
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
VoxLock keeps the voice in a 3-second sample of the caller. `isolate` takes the loudest 3 seconds in the first 15 seconds of the call, which is how it was benchmarked. Pass `sample=` to choose it yourself.
|
|
99
|
+
|
|
100
|
+
### Live calls
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
stream = vl.stream(sample) # about 3 s of the caller, 16 kHz mono
|
|
104
|
+
for chunk in call_audio: # 16 kHz float32 chunks of any size
|
|
105
|
+
send(stream.push(chunk)) # the isolated audio, about 24 ms behind
|
|
106
|
+
send(stream.flush()) # at the end of the call
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The stream needs the sample before it starts. In a voice agent, take the first 3 seconds the caller speaks, or a sample saved from an earlier call, and pass the audio through until then. Streaming gives the same output as `isolate`. With 4 CPU threads on an Apple M2 Pro it runs in real time from 40 ms chunks (`VoxLock(threads=4)`).
|
|
110
|
+
|
|
111
|
+
### PyTorch
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
git clone https://github.com/arbazsiddiqui/voxlock && cd voxlock
|
|
115
|
+
pip install -r requirements.txt
|
|
116
|
+
huggingface-cli download arbazsiddiqui/voxlock model.safetensors config.yaml --local-dir ckpt
|
|
117
|
+
python isolate.py --ckpt ckpt --in call.wav --out caller.wav
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Training
|
|
121
|
+
|
|
122
|
+
A 27M causal band-split RNN target-speaker extractor, fine-tuned from the [REAL-TSE challenge baseline](https://github.com/REAL-TSE/wesep-real-tse) on a single NVIDIA L4:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
REAL-TSE tfmap_context_causal_100
|
|
126
|
+
-> simulated calls 4,000 steps LibriSpeech callers + background talkers in simulated rooms
|
|
127
|
+
-> real AMI crosstalk 4,000 steps headset recordings from 40 meetings
|
|
128
|
+
-> long calls (30 s) 800 steps callers who talk throughout
|
|
129
|
+
-> rooms and distances 400 steps callers near or far from the mic, background voices dry or in the room, room noise
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Repository
|
|
133
|
+
|
|
134
|
+
| Path | |
|
|
135
|
+
|---|---|
|
|
136
|
+
| `voxlock/` | the `pip install voxlock` package: whole files, streaming, command line |
|
|
137
|
+
| `isolate.py` | PyTorch inference |
|
|
138
|
+
| `export_onnx.py` | ONNX export |
|
|
139
|
+
| `demo/` | the browser demo (`python demo/serve.py`) |
|
|
140
|
+
| `bench/` | benchmark harness, vendor runners, per-file results |
|
|
141
|
+
| `train/` | training scripts and data preparation |
|
|
142
|
+
|
|
143
|
+
## Acknowledgements
|
|
144
|
+
|
|
145
|
+
Built on the REAL-TSE challenge baseline and [WeSep](https://github.com/wenet-e2e/wesep) by Shuai Wang, Ke Zhang and co-authors, with [WeSpeaker](https://github.com/wenet-e2e/wespeaker)'s ECAPA model. Trained on [LibriSpeech](https://www.openslr.org/12) and the [AMI Meeting Corpus](https://groups.inf.ed.ac.uk/ami/corpus/).
|
|
146
|
+
|
|
147
|
+
## License
|
|
148
|
+
|
|
149
|
+
Apache-2.0.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
README.pypi.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
voxlock/__init__.py
|
|
6
|
+
voxlock/__main__.py
|
|
7
|
+
voxlock/cli.py
|
|
8
|
+
voxlock/core.py
|
|
9
|
+
voxlock.egg-info/PKG-INFO
|
|
10
|
+
voxlock.egg-info/SOURCES.txt
|
|
11
|
+
voxlock.egg-info/dependency_links.txt
|
|
12
|
+
voxlock.egg-info/entry_points.txt
|
|
13
|
+
voxlock.egg-info/requires.txt
|
|
14
|
+
voxlock.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
voxlock
|