decibri 5.3.0 → 5.5.0
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.
- package/CHANGELOG.md +48 -0
- package/LICENSE +191 -0
- package/README.md +11 -3
- package/examples/decibri.browser.js +3 -1
- package/index.d.ts +45 -5
- package/index.js +52 -52
- package/models/README.md +21 -103
- package/models/THIRD-PARTY-NOTICES.md +110 -0
- package/package.json +5 -5
- package/src/browser/decibri-browser.js +14 -1
- package/src/browser/decibri-output-browser.js +6 -0
- package/src/browser/index.d.ts +5 -2
- package/src/decibri-output.js +6 -2
- package/src/decibri.d.ts +164 -14
- package/src/decibri.js +228 -17
- package/src/errors.js +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,54 @@ For other decibri packages, see:
|
|
|
9
9
|
- Rust core: [crates/decibri/CHANGELOG.md](../../crates/decibri/CHANGELOG.md)
|
|
10
10
|
- Python package: [bindings/python/CHANGELOG.md](../../bindings/python/CHANGELOG.md)
|
|
11
11
|
|
|
12
|
+
## [5.5.0] - 2026-08-10
|
|
13
|
+
|
|
14
|
+
### Breaking changes
|
|
15
|
+
|
|
16
|
+
- **The `RangeError` thrown for a `channels` count below 1 carries the message `channels must be at least 1`.** It carried `channels must be between 1 and 32`, naming an upper bound that neither `Microphone` nor `Speaker` enforces. Code that matches the message text exactly stops matching and has to be updated to the new text. Nothing else about the error moves: it is still a `RangeError`, thrown for the same input, `channels: 0` on either constructor or `open()`.
|
|
17
|
+
- **`Speaker` accepts a `channels` count above 32.** It threw `RangeError: channels must be between 1 and 32` from the constructor. It now accepts any count above zero, offers the count to the device when playback starts, and a device that cannot serve it emits a `DecibriError` with code `SPEAKER_CHANNELS_UNSUPPORTED` on the `'error'` event, or rejects `writeAsync()` with it. Code that relied on the constructor throwing to reject an unsupported output channel count has to handle the failure asynchronously instead, on `'error'` or the rejection. `new Speaker({ channels: 0 })` still throws a `RangeError` from the constructor, and a count above 16383 still carries `STREAM_OPEN_FAILED` naming that limit. How many channels a device serves depends on the `sampleRate` asked for as well as the count.
|
|
18
|
+
- **An output channel count above the device's reported figure carries `SPEAKER_CHANNELS_UNSUPPORTED`.** It carried `STREAM_OPEN_FAILED`. Code branching on `STREAM_OPEN_FAILED` to detect an unsupported output channel count has to match `SPEAKER_CHANNELS_UNSUPPORTED` as well, and cannot drop `STREAM_OPEN_FAILED`, because a device that reports no figure at all keeps `STREAM_OPEN_FAILED` for the same condition. `STREAM_OPEN_FAILED` is otherwise unchanged and remains the code for an output open that failed for any other reason.
|
|
19
|
+
- **The browser `Microphone` rejects a `channels` count above 1.** It accepted 1 to 32 and delivered the first channel only, with nothing to indicate the rest were dropped. A count above 1 now throws `RangeError: multichannel capture is not supported; channels must be 1 (mono)`, and a count below 1 throws `RangeError: channels must be at least 1` where it threw a `TypeError`. Code passing a count above 1 to the browser entry has to pass 1 and mix down its own sources, or read the single channel it was already receiving. `channels: 1` is unchanged, as is every other browser `Microphone` option. Both class and message now match the Node entry's for the same values, so the two entries reject the same input the same way.
|
|
20
|
+
- The browser `Speaker` is unchanged. It still accepts 1 to 32 channels, the range the Web Audio specification requires an implementation to support, and keeps its own `channels must be between 1 and 32, got <n>` message, which that range does enforce.
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- Error code `SPEAKER_CHANNELS_UNSUPPORTED` on `DecibriError`, for an output device that cannot serve the requested `channels`. The message names the count asked for, the count the device reports (the figure `SpeakerInfo.maxOutputChannels` carries) and the platform's own message.
|
|
25
|
+
- `referenceChannels` on the `aec` option object: the channel count of the far-end reference pushed through `pushAecReference`. Default 1 (mono). With a count above 1 the pushed samples are read as interleaved frames and each frame is averaged to one mono sample before the canceller sees it. The collapse is opt-in: a caller pushing a multichannel reference must declare the count, and an undeclared multichannel push keeps its current behaviour, cancelling nothing and reporting no error. The declared count must match the pushed buffer: a mismatch is not detected and raises no error, and shows up only as `aecMetrics().delaySamples` staying `null` with no fault reported. A count below 1 throws a `RangeError`; the only ceiling is the option's own 16-bit carrier. A mono reference against playback through more than one loudspeaker has a cancellation ceiling: the canceller models one room response applied to the channel average, so a placement where the per-loudspeaker echo paths differ leaves a residual that adaptation does not remove.
|
|
26
|
+
- Each of the four platform packages (`@decibri/decibri-win32-x64-msvc`, `@decibri/decibri-darwin-arm64`, `@decibri/decibri-linux-x64-gnu`, `@decibri/decibri-linux-arm64-gnu`) now includes `THIRD-PARTY-NOTICES.md`, the third-party license notices for the ONNX Runtime dynamic libraries the package carries and for the third-party material incorporated into them, with a source-availability statement for the MPL-2.0-licensed Eigen code they contain.
|
|
27
|
+
- `models/THIRD-PARTY-NOTICES.md`, carrying the origin, version and license text for the two bundled ONNX models together with the training-data attribution the denoise checkpoint requires. It ships beside the weights it covers. `models/README.md` alongside it documents each model's tensor interface and points at the notice.
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- ONNX Runtime telemetry is disabled on the environment decibri commits when it initializes the runtime, where it was left at ONNX Runtime's own default of enabled. This covers every path that reaches the runtime: `vad: 'silero'` and the ACE `denoise` stage. Set `DECIBRI_ORT_TELEMETRY=1` in the environment before first use to leave it enabled; every other value, an empty value, and an absent variable leave it disabled. Two limits apply on Windows and decibri can close neither. ONNX Runtime logs one process-information event while the environment is being created, before the setting is applied, and logs it once per process, so that event is emitted whichever way the setting is left. The runtime also assigns its telemetry state from the Windows tracing session through an ETW callback, so the platform can re-enable telemetry after decibri has disabled it. On other platforms ONNX Runtime's telemetry provider does nothing. The browser build has no ONNX Runtime and is unaffected. No option, event, method or error text changes.
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- The bundled Silero VAD model is documented as v6.2, the version that ships. The `model` field on `VadOptions`, the `vad` option on `MicrophoneOptions`, the README and the notice beside the model named v5. Which model file ships is unchanged.
|
|
36
|
+
- The Silero VAD tensor specification in `models/README.md` names the tensors the model exposes: `input`, `state` and `sr` in, `output` and `stateN` out. It described a four-input form carrying separate `h` and `c` LSTM tensors.
|
|
37
|
+
|
|
38
|
+
## [5.4.0] - 2026-08-04
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
- `File.save(path, options)` writes the conditioned recording to disk as 16-bit PCM mono at `sampleRate`, in WAV, AIFF or FLAC, off the event loop. The container comes from the path's extension (`.wav`, `.aiff`, `.aif`, `.aifc` or `.flac`) or from `options.format`: decibri reads a file by its content and writes one by its name, and an extension it does not recognise rejects rather than defaulting. `options.compression` sets the FLAC compression level, 0 to 8 with 5 the default. Resolves to a `SaveReport`: `clippedSamples` counts finite samples outside full scale clamped to `[-1.0, 1.0]`, and `nonFiniteSamples` counts non-finite samples that never reach the file (NaN is written as silence, an infinity as full scale). Saving consumes the source and rejects with `FILE_ENGAGED` once the stream is engaged, exactly as `analyze()` does.
|
|
43
|
+
- `AudioWriter`, a Writable file sink for PCM audio. Pipe a `File`, or any stream of int16 or float32 PCM bytes, into it and the whole stream is written as one audio file when it finishes, with the same containers, encoding, clamp and non-finite handling as `File.save`, so the two spellings produce the same bytes. Takes `sampleRate` (required), `dtype`, and the `File.save` options; `report` carries the `SaveReport` after `'finish'`.
|
|
44
|
+
- Error code `FILE_WRITE_FAILED` on `DecibriError`, for an encoded file the filesystem refuses to write. The message names the path and the underlying I/O failure.
|
|
45
|
+
- `File` reads AIFF, AIFF-C and FLAC as well as WAV, and reads WAV in mu-law, A-law, 8-bit and 24-bit as well as the 16-bit PCM and 32-bit float it already read. The container is identified from the file's own bytes, so the path's extension does not decide how a file is read. No option changes: the same `new File(path)` and `File.open(path)` open more files.
|
|
46
|
+
- Error code `AUDIO_FORMAT_UNSUPPORTED` on `DecibriError`, for a file in a container or an encoding decibri cannot decode. The message names the container tag, codec or sample width in question.
|
|
47
|
+
- Error code `AUDIO_FILE_MALFORMED` on `DecibriError`, for a file whose bytes are not what its format requires where they sit. The message names the byte offset and what was expected there.
|
|
48
|
+
- Error code `AUDIO_FILE_TRUNCATED` on `DecibriError`, for a file that ends before the audio it declares. The message names what was needed against what was available.
|
|
49
|
+
- `LICENSE`, the full Apache 2.0 text, in the published package.
|
|
50
|
+
|
|
51
|
+
### Changed
|
|
52
|
+
|
|
53
|
+
- **BREAKING: a WAV whose declared data length is not a whole number of frames now fails to open**, throwing a `DecibriError` with code `AUDIO_FILE_TRUNCATED`. It previously opened and delivered audio a fraction of a frame short of its own declaration, with nothing to indicate it. A file shorter than its declared length, which is what an interrupted download leaves behind, already failed to open and is unaffected.
|
|
54
|
+
- A file declaring no channels carries `AUDIO_FORMAT_UNSUPPORTED` where it carried `WAV_INVALID`.
|
|
55
|
+
|
|
56
|
+
### Removed
|
|
57
|
+
|
|
58
|
+
- **BREAKING: the `WAV_INVALID` error code.** `AUDIO_FORMAT_UNSUPPORTED`, `AUDIO_FILE_MALFORMED` and `AUDIO_FILE_TRUNCATED` replace it, splitting what was one failure into the three the caller acts on differently. Code branching on `err.code === 'WAV_INVALID'` must be updated; `catch (e) { if (e instanceof DecibriError) ... }` catches all three unchanged.
|
|
59
|
+
|
|
12
60
|
## [5.3.0] - 2026-07-31
|
|
13
61
|
|
|
14
62
|
### Added
|
package/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
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 the 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 the 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 any 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
|
+
Copyright 2026 Decibri
|
|
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.
|
package/README.md
CHANGED
|
@@ -152,7 +152,7 @@ Creates a Writable stream for speaker playback.
|
|
|
152
152
|
| Option | Type | Default | Description |
|
|
153
153
|
| --- | --- | --- | --- |
|
|
154
154
|
| `sampleRate` | number | 16000 | Playback sample rate (1000 to 384000) |
|
|
155
|
-
| `channels` | number | 1 | Output channels (1 to
|
|
155
|
+
| `channels` | number | 1 | Output channels (1 or more, up to what the device supports) |
|
|
156
156
|
| `dtype` | `'int16'` \| `'float32'` | `'int16'` | Sample encoding of incoming data |
|
|
157
157
|
| `device` | number, string, or `{ id: string }` | system default | Output device index, case-insensitive name substring, or stable per-host ID |
|
|
158
158
|
|
|
@@ -293,7 +293,7 @@ mic.on('silence', () => console.log('silent'));
|
|
|
293
293
|
|
|
294
294
|
### Silero mode
|
|
295
295
|
|
|
296
|
-
ML-based detection using the Silero VAD
|
|
296
|
+
ML-based detection using the Silero VAD v6.2 model. More accurate than energy mode, especially in noisy environments.
|
|
297
297
|
|
|
298
298
|
```javascript
|
|
299
299
|
const mic = new Microphone({ vad: { model: 'silero', threshold: 0.5 } });
|
|
@@ -337,11 +337,19 @@ setTimeout(() => mic.stop(), 5000);
|
|
|
337
337
|
|
|
338
338
|
VAD reads the signal before the chain, so `vadScore` and the `'speech'` / `'silence'` events are unaffected by which conditioning stages you enable. The conditioning chain runs in the native Node.js capture path; the browser build does not include it.
|
|
339
339
|
|
|
340
|
+
## ONNX Runtime telemetry
|
|
341
|
+
|
|
342
|
+
Silero mode (`vad: 'silero'`) and the ACE `denoise` stage run on ONNX Runtime, which carries its own telemetry, separate from anything decibri does. Decibri disables it on the environment it commits when it initializes the runtime. Set `DECIBRI_ORT_TELEMETRY=1` in the environment before first use to leave it enabled; every other value, an empty value, and an absent variable leave it disabled.
|
|
343
|
+
|
|
344
|
+
Two limits apply on Windows and decibri can close neither, so decibri does not claim that no telemetry is emitted. ONNX Runtime logs one process-information event while the environment is being created, before the setting is applied, and logs it once per process, so that event is emitted whichever way the setting is left. The runtime also assigns its telemetry state from the Windows tracing session through an ETW callback, so the platform can re-enable telemetry after decibri has disabled it. On other platforms ONNX Runtime's telemetry provider does nothing.
|
|
345
|
+
|
|
346
|
+
Neither ONNX Runtime nor this setting applies to the browser build, which has no ONNX Runtime.
|
|
347
|
+
|
|
340
348
|
## API: File (offline source)
|
|
341
349
|
|
|
342
350
|
Everything a `Microphone` does to live audio, `File` does to audio you already have: the same conditioning options, the same Readable stream of conditioned chunks (finite: it ends at EOF), and the same opt-in `vad`. Because a `File` is a complete recording, it can also analyze the whole recording for speech.
|
|
343
351
|
|
|
344
|
-
- `await File.open(path, options?)`: read a
|
|
352
|
+
- `await File.open(path, options?)`: read a file off the event loop (recommended, like `Microphone.open`). Reads WAV, AIFF, AIFF-C and FLAC, identified from the file's own bytes rather than its extension.
|
|
345
353
|
- `new File(path, options?)`: the same result, synchronous (blocks on disk I/O; fine for scripts).
|
|
346
354
|
- `File.buffer(samples, options)`: wrap a `Float32Array` of samples you already hold. `options.inputRate` is required (raw samples carry no header); a raw `Buffer` of bytes is rejected as ambiguous.
|
|
347
355
|
- `await file.analyze()` (also spelled `analyse()`): consume the source and resolve to a `VadReport` of per-window `scores` (`{ start, end, vadScore, isSpeech }`) and merged speech `segments` (`{ start, end }`), in seconds of file time. Requires `vad: 'silero'`; a `File` opened without `vad` rejects with `analysis requires VAD`.
|
|
@@ -70,7 +70,7 @@ var decibri = (function() {
|
|
|
70
70
|
var require_decibri_browser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
71
71
|
const { Emitter } = require_emitter();
|
|
72
72
|
const { WORKLET_SOURCE } = require_worklet_inline();
|
|
73
|
-
const VERSION = "5.
|
|
73
|
+
const VERSION = "5.5.0";
|
|
74
74
|
/**
|
|
75
75
|
* Browser microphone capture.
|
|
76
76
|
*
|
|
@@ -132,6 +132,8 @@ var decibri = (function() {
|
|
|
132
132
|
this._noiseSuppression = options.noiseSuppression ?? true;
|
|
133
133
|
this._workletUrl = options.workletUrl;
|
|
134
134
|
if (this._sampleRate < 1e3 || this._sampleRate > 384e3) throw new RangeError("sample rate must be between 1000 and 384000");
|
|
135
|
+
if (this._channels < 1) throw new RangeError("channels must be at least 1");
|
|
136
|
+
if (this._channels > 1) throw new RangeError("multichannel capture is not supported; channels must be 1 (mono)");
|
|
135
137
|
if (this._channels < 1 || this._channels > 32) throw new TypeError(`channels must be between 1 and 32, got ${this._channels}`);
|
|
136
138
|
if (this._framesPerBuffer < 64 || this._framesPerBuffer > 65536) throw new TypeError(`frames per buffer must be between 64 and 65536, got ${this._framesPerBuffer}`);
|
|
137
139
|
if (this._dtype !== "int16" && this._dtype !== "float32") throw new TypeError("dtype must be 'int16' or 'float32'");
|
package/index.d.ts
CHANGED
|
@@ -115,13 +115,14 @@ export declare class DecibriOutputBridge {
|
|
|
115
115
|
*/
|
|
116
116
|
export declare class FileHandle {
|
|
117
117
|
/**
|
|
118
|
-
* Open
|
|
119
|
-
* I/O; the JS wrapper's async `File.open` uses `openAsync`
|
|
118
|
+
* Open an audio path as an offline source, synchronously (blocks on
|
|
119
|
+
* disk I/O; the JS wrapper's async `File.open` uses `openAsync`
|
|
120
|
+
* instead).
|
|
120
121
|
*/
|
|
121
122
|
static open(path: string, options?: FileOptions | undefined | null): FileHandle
|
|
122
123
|
/**
|
|
123
|
-
* Open
|
|
124
|
-
*
|
|
124
|
+
* Open an audio path without blocking the JS event loop: the disk read,
|
|
125
|
+
* decode, and chain construction run on the libuv thread pool.
|
|
125
126
|
*/
|
|
126
127
|
static openAsync(path: string, options?: FileOptions | undefined | null): Promise<unknown>
|
|
127
128
|
/**
|
|
@@ -147,6 +148,15 @@ export declare class FileHandle {
|
|
|
147
148
|
* the configuration and retry.
|
|
148
149
|
*/
|
|
149
150
|
analyze(): Promise<unknown>
|
|
151
|
+
/**
|
|
152
|
+
* Consume the source and write the conditioned recording to disk, off
|
|
153
|
+
* the JS event loop. Resolves to the `SaveReport`.
|
|
154
|
+
*
|
|
155
|
+
* Everything checkable is checked before the source is taken, so a
|
|
156
|
+
* rejected call leaves the File exactly as it was and the caller can fix
|
|
157
|
+
* the arguments and retry.
|
|
158
|
+
*/
|
|
159
|
+
save(path: string, options?: SaveOptions | undefined | null): Promise<unknown>
|
|
150
160
|
/** Release the source. Idempotent; a closed File reads as ended. */
|
|
151
161
|
close(): void
|
|
152
162
|
/**
|
|
@@ -157,7 +167,7 @@ export declare class FileHandle {
|
|
|
157
167
|
/** The target output rate every delivered chunk carries. */
|
|
158
168
|
get sampleRate(): number
|
|
159
169
|
/**
|
|
160
|
-
* The source's native rate, from the
|
|
170
|
+
* The source's native rate, from the file's header or the explicit
|
|
161
171
|
* `inputRate` of `buffer`.
|
|
162
172
|
*/
|
|
163
173
|
get inputRate(): number
|
|
@@ -314,6 +324,17 @@ export interface DecibriOptions {
|
|
|
314
324
|
* when `aec` names a model.
|
|
315
325
|
*/
|
|
316
326
|
aecReferenceSampleRate?: number
|
|
327
|
+
/**
|
|
328
|
+
* Number of channels in the far-end reference pushed through
|
|
329
|
+
* `pushAecReference`, at least 1. Absent means the reference is mono;
|
|
330
|
+
* when it names a count above 1, the core collapses each interleaved
|
|
331
|
+
* frame to one mono sample before the canceller sees it. The declared
|
|
332
|
+
* count must match the pushed buffer: a mismatch is not detected and
|
|
333
|
+
* raises no error, and shows up only as `aecMetrics().delaySamples`
|
|
334
|
+
* staying `null` with no fault reported. Consulted only when `aec`
|
|
335
|
+
* names a model.
|
|
336
|
+
*/
|
|
337
|
+
aecReferenceChannels?: number
|
|
317
338
|
}
|
|
318
339
|
|
|
319
340
|
/** Options passed from JS constructor for output. */
|
|
@@ -373,6 +394,25 @@ export interface OutputDeviceInfoJs {
|
|
|
373
394
|
isDefault: boolean
|
|
374
395
|
}
|
|
375
396
|
|
|
397
|
+
/**
|
|
398
|
+
* Options passed from the JS `File.save` wrapper: the container format
|
|
399
|
+
* override and the FLAC compression level.
|
|
400
|
+
*/
|
|
401
|
+
export interface SaveOptions {
|
|
402
|
+
format?: string
|
|
403
|
+
compression?: number
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* What a save did to the samples on their way into the file: finite
|
|
408
|
+
* samples outside full scale clamped and counted, non-finite samples
|
|
409
|
+
* replaced (NaN with silence, an infinity with full scale) and counted.
|
|
410
|
+
*/
|
|
411
|
+
export interface SaveReport {
|
|
412
|
+
clippedSamples: number
|
|
413
|
+
nonFiniteSamples: number
|
|
414
|
+
}
|
|
415
|
+
|
|
376
416
|
/** One merged speech region of a recording, in seconds of file time. */
|
|
377
417
|
export interface Segment {
|
|
378
418
|
start: number
|