decibri 5.2.5 → 5.4.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 +32 -0
- package/LICENSE +191 -0
- package/README.md +1 -1
- package/examples/decibri.browser.js +1 -1
- package/index.d.ts +133 -5
- package/index.js +52 -52
- package/package.json +5 -5
- package/src/browser/decibri-browser.js +1 -1
- package/src/decibri.d.ts +267 -8
- package/src/decibri.js +330 -10
- package/src/errors.js +11 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,38 @@ 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.4.0] - 2026-08-04
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- `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.
|
|
17
|
+
- `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'`.
|
|
18
|
+
- 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.
|
|
19
|
+
- `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.
|
|
20
|
+
- 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.
|
|
21
|
+
- 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.
|
|
22
|
+
- 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.
|
|
23
|
+
- `LICENSE`, the full Apache 2.0 text, in the published package.
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- **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.
|
|
28
|
+
- A file declaring no channels carries `AUDIO_FORMAT_UNSUPPORTED` where it carried `WAV_INVALID`.
|
|
29
|
+
|
|
30
|
+
### Removed
|
|
31
|
+
|
|
32
|
+
- **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.
|
|
33
|
+
|
|
34
|
+
## [5.3.0] - 2026-07-31
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
|
|
38
|
+
- `aec` option on `Microphone`: acoustic echo cancellation on the capture path. The short form names the model (`aec: 'tau'`); the object form takes `{ model, tailMs, suppression, referenceSampleRate }`. It runs before the detector tap, so `vadScore` and the `speech` / `silence` events read the echo-removed signal, and it requires `sampleRate` in 8000 to 48000. Native capture only: the browser entry keeps the platform's own `echoCancellation` constraint.
|
|
39
|
+
- `Microphone.pushAecReference(data)`, which queues the far-end audio the canceller cancels against: the same input shapes `Speaker.write` accepts, mono, in played order, at the declared `referenceSampleRate`. It never blocks and never throws on a full queue. When it is pushed does not have to match when it plays: the queue is read at the rate the capture consumes it, so a greeting pushed before the first `data` event, or a whole utterance handed over in one call, is read out over the capture it echoes into and every sample of it is cancelled against. The queue holds two seconds, which bounds how far ahead of its own capture a caller may run.
|
|
40
|
+
- `Microphone.aecMetrics()`, the canceller's transport and cancellation metrics merged with the reference queue's counters, or `null` while echo cancellation is off or capture is not running.
|
|
41
|
+
|
|
42
|
+
Echo cancellation joins automatic gain control as a stage that can drive captured samples above full scale when the limiter is off, because it subtracts its estimate of the echo from the capture and exceeds the capture wherever that estimate is wrong in phase. The limiter runs after it and bounds the output to its ceiling; the `int16` sample format clamps, so an over-scale sample arrives as full scale rather than wrapping, and a `float32` consumer without the limiter should clamp its own output.
|
|
43
|
+
|
|
12
44
|
## [5.2.5] - 2026-07-28
|
|
13
45
|
|
|
14
46
|
### Changed
|
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
|
@@ -341,7 +341,7 @@ VAD reads the signal before the chain, so `vadScore` and the `'speech'` / `'sile
|
|
|
341
341
|
|
|
342
342
|
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
343
|
|
|
344
|
-
- `await File.open(path, options?)`: read a
|
|
344
|
+
- `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
345
|
- `new File(path, options?)`: the same result, synchronous (blocks on disk I/O; fine for scripts).
|
|
346
346
|
- `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
347
|
- `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.4.0";
|
|
74
74
|
/**
|
|
75
75
|
* Browser microphone capture.
|
|
76
76
|
*
|
package/index.d.ts
CHANGED
|
@@ -29,6 +29,21 @@ export declare class DecibriBridge {
|
|
|
29
29
|
* number for any realistic count) to match the `vadProbability` getter.
|
|
30
30
|
*/
|
|
31
31
|
get overrunCount(): number
|
|
32
|
+
/**
|
|
33
|
+
* Queue far-end reference audio for the echo canceller. `buffer` is mono
|
|
34
|
+
* PCM bytes in the bridge's configured format, at the declared reference
|
|
35
|
+
* rate, in played order. Never blocks and never fails: a full queue
|
|
36
|
+
* discards and counts rather than erroring, and a push with no active
|
|
37
|
+
* stream (not started, stopped, or echo cancellation off) is a no-op.
|
|
38
|
+
*/
|
|
39
|
+
pushAecReference(buffer: Buffer): void
|
|
40
|
+
/**
|
|
41
|
+
* The echo canceller's transport and cancellation metrics, merged with the
|
|
42
|
+
* reference queue's own counters, or `null` when no stream is active or
|
|
43
|
+
* echo cancellation is off. Counters are returned as f64 (exact JS numbers
|
|
44
|
+
* for any realistic count), matching the `overrunCount` getter.
|
|
45
|
+
*/
|
|
46
|
+
aecMetrics(): AecMetricsJs | null
|
|
32
47
|
/** List all available audio input devices. */
|
|
33
48
|
static devices(): Array<DeviceInfoJs>
|
|
34
49
|
/** Version information. */
|
|
@@ -100,13 +115,14 @@ export declare class DecibriOutputBridge {
|
|
|
100
115
|
*/
|
|
101
116
|
export declare class FileHandle {
|
|
102
117
|
/**
|
|
103
|
-
* Open
|
|
104
|
-
* 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).
|
|
105
121
|
*/
|
|
106
122
|
static open(path: string, options?: FileOptions | undefined | null): FileHandle
|
|
107
123
|
/**
|
|
108
|
-
* Open
|
|
109
|
-
*
|
|
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.
|
|
110
126
|
*/
|
|
111
127
|
static openAsync(path: string, options?: FileOptions | undefined | null): Promise<unknown>
|
|
112
128
|
/**
|
|
@@ -132,6 +148,15 @@ export declare class FileHandle {
|
|
|
132
148
|
* the configuration and retry.
|
|
133
149
|
*/
|
|
134
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>
|
|
135
160
|
/** Release the source. Idempotent; a closed File reads as ended. */
|
|
136
161
|
close(): void
|
|
137
162
|
/**
|
|
@@ -142,12 +167,68 @@ export declare class FileHandle {
|
|
|
142
167
|
/** The target output rate every delivered chunk carries. */
|
|
143
168
|
get sampleRate(): number
|
|
144
169
|
/**
|
|
145
|
-
* The source's native rate, from the
|
|
170
|
+
* The source's native rate, from the file's header or the explicit
|
|
146
171
|
* `inputRate` of `buffer`.
|
|
147
172
|
*/
|
|
148
173
|
get inputRate(): number
|
|
149
174
|
}
|
|
150
175
|
|
|
176
|
+
/**
|
|
177
|
+
* Echo-cancellation metrics returned to JS by `aecMetrics()`. One object
|
|
178
|
+
* carries the canceller's own report and the reference queue's counters, so a
|
|
179
|
+
* caller reads one surface for the whole diagnosis.
|
|
180
|
+
*/
|
|
181
|
+
export interface AecMetricsJs {
|
|
182
|
+
/**
|
|
183
|
+
* The active delay alignment in samples, or `null` while the estimator is
|
|
184
|
+
* still searching. Staying `null` while `acquisitionParked` climbs is the
|
|
185
|
+
* signature of a canceller with no usable reference: none pushed, not at
|
|
186
|
+
* the declared rate, or not the signal that produced the echo.
|
|
187
|
+
*/
|
|
188
|
+
delaySamples?: number
|
|
189
|
+
/**
|
|
190
|
+
* Smoothed echo-return-loss-enhancement estimate in dB: how much echo the
|
|
191
|
+
* canceller is currently removing. 0 before the filter has converged.
|
|
192
|
+
*/
|
|
193
|
+
erleDb: number
|
|
194
|
+
/**
|
|
195
|
+
* Whether the double-talk detector currently believes the near-end talker
|
|
196
|
+
* is active; adaptation is held while true.
|
|
197
|
+
*/
|
|
198
|
+
doubleTalk: boolean
|
|
199
|
+
/**
|
|
200
|
+
* Near-end samples the canceller could find no far-end sample for while an
|
|
201
|
+
* alignment was active. The core keeps the far-end stream level with the
|
|
202
|
+
* capture, so this stays 0 for a caller who simply stops pushing; a
|
|
203
|
+
* non-zero count means the caller ran further ahead of the capture than
|
|
204
|
+
* the canceller's far-end history reaches.
|
|
205
|
+
*/
|
|
206
|
+
referenceStarved: number
|
|
207
|
+
/**
|
|
208
|
+
* Near-end samples processed while no delay alignment was active: the
|
|
209
|
+
* searching span, not a transport failure.
|
|
210
|
+
*/
|
|
211
|
+
acquisitionParked: number
|
|
212
|
+
/**
|
|
213
|
+
* Times the canceller inferred a capture discontinuity and rebuilt its
|
|
214
|
+
* alignment from the reference frontier.
|
|
215
|
+
*/
|
|
216
|
+
referenceReanchors: number
|
|
217
|
+
/**
|
|
218
|
+
* Far-end samples discarded because a single push exceeded the reference
|
|
219
|
+
* queue's bound, at the declared reference rate. The span they occupied is
|
|
220
|
+
* still represented as silence, so a discard costs the cancellation of
|
|
221
|
+
* that span alone.
|
|
222
|
+
*/
|
|
223
|
+
referenceDropped: number
|
|
224
|
+
/**
|
|
225
|
+
* Far-end samples the core supplied as silence because the caller had
|
|
226
|
+
* pushed none for them, at the capture rate. An accounting figure, not a
|
|
227
|
+
* fault: while nothing is playing, the far end is silence.
|
|
228
|
+
*/
|
|
229
|
+
referenceSilence: number
|
|
230
|
+
}
|
|
231
|
+
|
|
151
232
|
/**
|
|
152
233
|
* Options passed from JS constructor.
|
|
153
234
|
*
|
|
@@ -215,6 +296,34 @@ export interface DecibriOptions {
|
|
|
215
296
|
* DSP: no bundled file and no model path, like `agc`.
|
|
216
297
|
*/
|
|
217
298
|
limiter?: number
|
|
299
|
+
/**
|
|
300
|
+
* Echo canceller model name. The accepted set is owned by the canceller
|
|
301
|
+
* (`AecModel::from_str`); today it is `'tau'`. Absent leaves echo
|
|
302
|
+
* cancellation off. The JS wrapper resolves both public forms (the string
|
|
303
|
+
* shorthand and the `AecOptions` object) into this field and the three
|
|
304
|
+
* below. Pure DSP: no bundled file and no model path, like `highpass`.
|
|
305
|
+
*/
|
|
306
|
+
aec?: string
|
|
307
|
+
/**
|
|
308
|
+
* Echo canceller filter tail in milliseconds: an integer in `16..=500`.
|
|
309
|
+
* Absent takes the canceller's own default. Consulted only when `aec`
|
|
310
|
+
* names a model.
|
|
311
|
+
*/
|
|
312
|
+
aecTailMs?: number
|
|
313
|
+
/**
|
|
314
|
+
* Residual-suppression policy for the echo canceller: `'conservative'` or
|
|
315
|
+
* `'off'`. Absent takes the canceller's own default. Consulted only when
|
|
316
|
+
* `aec` names a model.
|
|
317
|
+
*/
|
|
318
|
+
aecSuppression?: string
|
|
319
|
+
/**
|
|
320
|
+
* Sample rate in Hz of the far-end reference pushed through
|
|
321
|
+
* `pushAecReference`, in `1000..=384000`. Absent means the reference is
|
|
322
|
+
* already at the capture rate; when it names a different rate, the core
|
|
323
|
+
* converts the reference before the canceller sees it. Consulted only
|
|
324
|
+
* when `aec` names a model.
|
|
325
|
+
*/
|
|
326
|
+
aecReferenceSampleRate?: number
|
|
218
327
|
}
|
|
219
328
|
|
|
220
329
|
/** Options passed from JS constructor for output. */
|
|
@@ -274,6 +383,25 @@ export interface OutputDeviceInfoJs {
|
|
|
274
383
|
isDefault: boolean
|
|
275
384
|
}
|
|
276
385
|
|
|
386
|
+
/**
|
|
387
|
+
* Options passed from the JS `File.save` wrapper: the container format
|
|
388
|
+
* override and the FLAC compression level.
|
|
389
|
+
*/
|
|
390
|
+
export interface SaveOptions {
|
|
391
|
+
format?: string
|
|
392
|
+
compression?: number
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* What a save did to the samples on their way into the file: finite
|
|
397
|
+
* samples outside full scale clamped and counted, non-finite samples
|
|
398
|
+
* replaced (NaN with silence, an infinity with full scale) and counted.
|
|
399
|
+
*/
|
|
400
|
+
export interface SaveReport {
|
|
401
|
+
clippedSamples: number
|
|
402
|
+
nonFiniteSamples: number
|
|
403
|
+
}
|
|
404
|
+
|
|
277
405
|
/** One merged speech region of a recording, in seconds of file time. */
|
|
278
406
|
export interface Segment {
|
|
279
407
|
start: number
|