decibri 4.4.2 → 5.1.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 +33 -3
- package/MIGRATION.md +70 -0
- package/README.md +73 -8
- package/examples/README.md +4 -3
- package/examples/decibri.browser.js +18 -6
- package/index.d.ts +126 -0
- package/index.js +53 -52
- package/models/README.md +149 -0
- package/models/fastenhancer_t.onnx +0 -0
- package/package.json +5 -5
- package/src/browser/decibri-browser.js +33 -13
- package/src/browser/index.d.ts +30 -18
- package/src/decibri.d.ts +326 -17
- package/src/decibri.js +573 -56
- package/src/errors.js +16 -1
package/src/errors.js
CHANGED
|
@@ -72,6 +72,7 @@ const DEVICE_CODES = [
|
|
|
72
72
|
const ORT_CODES = [
|
|
73
73
|
['decibri: failed to initialize ONNX Runtime', 'ORT_INIT_FAILED'],
|
|
74
74
|
['Failed to load Silero VAD model from', 'VAD_MODEL_LOAD_FAILED'],
|
|
75
|
+
['Failed to load model from', 'MODEL_LOAD_FAILED'],
|
|
75
76
|
['Failed to create ort session builder', 'ORT_SESSION_BUILD_FAILED'],
|
|
76
77
|
['Failed to set ort threads', 'ORT_THREADS_CONFIG_FAILED'],
|
|
77
78
|
['Silero VAD inference failed', 'ORT_INFERENCE_FAILED'],
|
|
@@ -98,7 +99,8 @@ function wrapNativeError(err) {
|
|
|
98
99
|
msg.startsWith('frames per buffer must be between') ||
|
|
99
100
|
msg.startsWith('Silero VAD only supports') ||
|
|
100
101
|
msg.startsWith('VAD threshold must be between') ||
|
|
101
|
-
msg.startsWith('device index out of range')
|
|
102
|
+
msg.startsWith('device index out of range') ||
|
|
103
|
+
msg.startsWith('analysis requires VAD')
|
|
102
104
|
) {
|
|
103
105
|
return new RangeError(msg);
|
|
104
106
|
}
|
|
@@ -130,6 +132,19 @@ function wrapNativeError(err) {
|
|
|
130
132
|
return new OrtError(msg, 'ORT_TENSOR_EXTRACT_FAILED');
|
|
131
133
|
}
|
|
132
134
|
|
|
135
|
+
// Runtime device/driver failure during streaming. Distinct from the
|
|
136
|
+
// enumeration/selection DeviceError family above (which mirrors the core's
|
|
137
|
+
// "Device errors"): this is the core's "Stream errors" DeviceFailed, surfaced
|
|
138
|
+
// as a base DecibriError with a dedicated code.
|
|
139
|
+
if (msg.startsWith('decibri: audio device error:')) {
|
|
140
|
+
return new DecibriError(msg, 'DEVICE_FAILED');
|
|
141
|
+
}
|
|
142
|
+
// Non-ORT ONNX backend failure: the reserved backend catch-all, surfaced as a
|
|
143
|
+
// base DecibriError with a dedicated code (not an OrtError).
|
|
144
|
+
if (msg.startsWith('ONNX backend error from')) {
|
|
145
|
+
return new DecibriError(msg, 'ONNX_BACKEND_FAILED');
|
|
146
|
+
}
|
|
147
|
+
|
|
133
148
|
// Any other error from the native constructor is still a decibri error.
|
|
134
149
|
return new DecibriError(msg, 'DECIBRI_ERROR');
|
|
135
150
|
}
|