decibri 4.4.1 → 5.0.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 +35 -3
- package/MIGRATION.md +70 -0
- package/README.md +45 -8
- package/examples/README.md +4 -3
- package/examples/decibri.browser.js +18 -6
- package/index.d.ts +41 -0
- package/index.js +52 -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 +104 -17
- package/src/decibri.js +197 -55
- package/src/errors.js +14 -0
package/index.js
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('@decibri/decibri-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('@decibri/decibri-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
80
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('@decibri/decibri-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('@decibri/decibri-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
96
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('@decibri/decibri-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('@decibri/decibri-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
117
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('@decibri/decibri-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('@decibri/decibri-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
133
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('@decibri/decibri-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('@decibri/decibri-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
150
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('@decibri/decibri-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('@decibri/decibri-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
166
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('@decibri/decibri-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('@decibri/decibri-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
185
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('@decibri/decibri-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('@decibri/decibri-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
201
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('@decibri/decibri-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('@decibri/decibri-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
217
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('@decibri/decibri-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('@decibri/decibri-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
237
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('@decibri/decibri-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('@decibri/decibri-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
253
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('@decibri/decibri-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('@decibri/decibri-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
274
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('@decibri/decibri-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('@decibri/decibri-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
290
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('@decibri/decibri-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('@decibri/decibri-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
308
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('@decibri/decibri-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('@decibri/decibri-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
324
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('@decibri/decibri-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('@decibri/decibri-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
342
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('@decibri/decibri-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('@decibri/decibri-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
358
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('@decibri/decibri-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('@decibri/decibri-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
376
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('@decibri/decibri-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('@decibri/decibri-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
392
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('@decibri/decibri-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('@decibri/decibri-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
410
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('@decibri/decibri-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('@decibri/decibri-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
426
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('@decibri/decibri-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('@decibri/decibri-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
443
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('@decibri/decibri-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('@decibri/decibri-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
459
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('@decibri/decibri-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('@decibri/decibri-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
479
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('@decibri/decibri-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('@decibri/decibri-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
495
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('@decibri/decibri-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('@decibri/decibri-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected
|
|
511
|
+
if (bindingPackageVersion !== '5.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 5.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
package/models/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Models
|
|
2
|
+
|
|
3
|
+
This directory holds the third-party model files decibri bundles, together with
|
|
4
|
+
the license notices each one requires. These notices ship inside the published
|
|
5
|
+
npm and PyPI packages alongside the model weights, so the attribution travels
|
|
6
|
+
with the files it covers.
|
|
7
|
+
|
|
8
|
+
## silero_vad.onnx
|
|
9
|
+
|
|
10
|
+
- **Name:** Silero VAD v5
|
|
11
|
+
- **License:** MIT
|
|
12
|
+
- **Source:** https://github.com/snakers4/silero-vad
|
|
13
|
+
- **Size:** ~2.2 MB
|
|
14
|
+
- **Purpose:** Voice Activity Detection. Determines whether an audio frame contains human speech
|
|
15
|
+
|
|
16
|
+
### Input/Output Specification
|
|
17
|
+
|
|
18
|
+
**Inputs:**
|
|
19
|
+
- `input`: f32[batch, window_size]: audio samples (512 at 16kHz, 256 at 8kHz)
|
|
20
|
+
- `sr`: i64[batch]: sample rate
|
|
21
|
+
- `h`: f32[2, batch, 64]: LSTM hidden state
|
|
22
|
+
- `c`: f32[2, batch, 64]: LSTM cell state
|
|
23
|
+
|
|
24
|
+
**Outputs:**
|
|
25
|
+
- `output`: f32[batch, 1]: speech probability (0.0 to 1.0)
|
|
26
|
+
- `hn`: f32[2, batch, 64]: updated hidden state
|
|
27
|
+
- `cn`: f32[2, batch, 64]: updated cell state
|
|
28
|
+
|
|
29
|
+
Note: Exact tensor names may differ. Verified at build time from the model file.
|
|
30
|
+
|
|
31
|
+
### License Notice
|
|
32
|
+
|
|
33
|
+
This model is a third-party artifact, not proprietary to decibri. It is
|
|
34
|
+
distributed under the MIT License, reproduced in full below.
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
MIT License
|
|
38
|
+
|
|
39
|
+
Copyright (c) 2020-present Silero Team
|
|
40
|
+
|
|
41
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
42
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
43
|
+
in the Software without restriction, including without limitation the rights
|
|
44
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
45
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
46
|
+
furnished to do so, subject to the following conditions:
|
|
47
|
+
|
|
48
|
+
The above copyright notice and this permission notice shall be included in all
|
|
49
|
+
copies or substantial portions of the Software.
|
|
50
|
+
|
|
51
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
52
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
53
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
54
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
55
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
56
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
57
|
+
SOFTWARE.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## fastenhancer_t.onnx
|
|
61
|
+
|
|
62
|
+
- **Name:** FastEnhancer-T (tiny tier), VoiceBank-DEMAND checkpoint, waveform variant
|
|
63
|
+
- **License:** MIT
|
|
64
|
+
- **Source:** https://github.com/aask1357/fastenhancer (release `onnx-vd-v1.0.0`)
|
|
65
|
+
- **Size:** ~122 KB (125,036 bytes)
|
|
66
|
+
- **Purpose:** Single-channel speech enhancement (denoise). Maps a window of noisy speech samples to a hop of cleaned speech samples, frame by frame, for streaming use.
|
|
67
|
+
|
|
68
|
+
### Input/Output Specification
|
|
69
|
+
|
|
70
|
+
Verified at build time from the model file (ONNX IR version 10, opset 18,
|
|
71
|
+
exported from PyTorch 2.7.1). All tensors are fp32.
|
|
72
|
+
|
|
73
|
+
**Inputs:**
|
|
74
|
+
- `wav_in`: f32[1, 512]: one analysis window of audio samples.
|
|
75
|
+
- `cache_in_0`: f32[1, 256]: the overlap-add tail buffer (one hop), carried across calls.
|
|
76
|
+
- `cache_in_1`: f32[1, 16, 20]: streaming recurrent cache, carried across calls.
|
|
77
|
+
- `cache_in_2`: f32[1, 16, 20]: streaming recurrent cache, carried across calls.
|
|
78
|
+
|
|
79
|
+
**Outputs:**
|
|
80
|
+
- `wav_out`: f32[1, 256]: one hop of enhanced audio samples.
|
|
81
|
+
- `cache_out_0`: f32[1, 256]: updated overlap-add buffer, feed back as `cache_in_0` on the next call.
|
|
82
|
+
- `cache_out_1`: f32[1, 16, 20]: updated cache, feed back as `cache_in_1` on the next call.
|
|
83
|
+
- `cache_out_2`: f32[1, 16, 20]: updated cache, feed back as `cache_in_2` on the next call.
|
|
84
|
+
|
|
85
|
+
Streaming contract: this is the waveform-in/waveform-out variant. The model bakes
|
|
86
|
+
the complete spectral path into the graph (windowing, the forward and inverse
|
|
87
|
+
`DFT`, power compression, and overlap-add), so the host feeds audio samples and
|
|
88
|
+
receives audio samples with no spectral processing of its own. The three cache
|
|
89
|
+
tensors hold the model's overlap-add and recurrent state. Initialize them to
|
|
90
|
+
zeros at the start of a stream and feed each call's `cache_out` values back as
|
|
91
|
+
the next call's `cache_in` values.
|
|
92
|
+
|
|
93
|
+
### License Notice
|
|
94
|
+
|
|
95
|
+
This model is a third-party artifact, not proprietary to decibri. The model
|
|
96
|
+
code and weights are distributed under the MIT License, reproduced in full
|
|
97
|
+
below.
|
|
98
|
+
|
|
99
|
+
```text
|
|
100
|
+
MIT License
|
|
101
|
+
|
|
102
|
+
Copyright (c) 2025 AHN Sung Hwan
|
|
103
|
+
|
|
104
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
105
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
106
|
+
in the Software without restriction, including without limitation the rights
|
|
107
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
108
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
109
|
+
furnished to do so, subject to the following conditions:
|
|
110
|
+
|
|
111
|
+
The above copyright notice and this permission notice shall be included in all
|
|
112
|
+
copies or substantial portions of the Software.
|
|
113
|
+
|
|
114
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
115
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
116
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
117
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
118
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
119
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
120
|
+
SOFTWARE.
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Training-Data Attribution
|
|
124
|
+
|
|
125
|
+
The bundled checkpoint is trained on the VoiceBank-DEMAND noisy speech dataset,
|
|
126
|
+
which pairs clean speech from the CSTR VCTK Corpus with noise from the DEMAND
|
|
127
|
+
database. Each source dataset requires attribution:
|
|
128
|
+
|
|
129
|
+
- **VoiceBank-DEMAND.** Valentini-Botinhao, Cassia. (2017). Noisy speech
|
|
130
|
+
database for training speech enhancement algorithms and TTS models, 2016
|
|
131
|
+
[sound]. University of Edinburgh, School of Informatics, Centre for Speech
|
|
132
|
+
Technology Research (CSTR). Licensed under Creative Commons Attribution 4.0
|
|
133
|
+
International (CC BY 4.0), https://creativecommons.org/licenses/by/4.0/.
|
|
134
|
+
https://doi.org/10.7488/ds/2117
|
|
135
|
+
|
|
136
|
+
- **CSTR VCTK Corpus (version 0.92).** Yamagishi, Junichi; Veaux, Christophe;
|
|
137
|
+
MacDonald, Kirsten. (2019). CSTR VCTK Corpus: English Multi-speaker Corpus
|
|
138
|
+
for CSTR Voice Cloning Toolkit (version 0.92) [sound]. University of
|
|
139
|
+
Edinburgh, Centre for Speech Technology Research (CSTR). Licensed under the
|
|
140
|
+
Open Data Commons Attribution License (ODC-By) v1.0,
|
|
141
|
+
https://opendatacommons.org/licenses/by/1-0/.
|
|
142
|
+
https://doi.org/10.7488/ds/2645
|
|
143
|
+
|
|
144
|
+
- **DEMAND.** Thiemann, Joachim; Ito, Nobutaka; Vincent, Emmanuel. (2013).
|
|
145
|
+
DEMAND: a collection of multi-channel recordings of acoustic noise in
|
|
146
|
+
diverse environments. Licensed under Creative Commons
|
|
147
|
+
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0),
|
|
148
|
+
https://creativecommons.org/licenses/by-sa/3.0/.
|
|
149
|
+
https://doi.org/10.5281/zenodo.1227121
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "decibri",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Cross-platform audio capture, playback, and processing for Node.js and browsers",
|
|
5
5
|
"main": "src/decibri.js",
|
|
6
6
|
"types": "src/decibri.d.ts",
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
"MIGRATION.md"
|
|
73
73
|
],
|
|
74
74
|
"optionalDependencies": {
|
|
75
|
-
"@decibri/decibri-win32-x64-msvc": "
|
|
76
|
-
"@decibri/decibri-darwin-arm64": "
|
|
77
|
-
"@decibri/decibri-linux-x64-gnu": "
|
|
78
|
-
"@decibri/decibri-linux-arm64-gnu": "
|
|
75
|
+
"@decibri/decibri-win32-x64-msvc": "5.0.0",
|
|
76
|
+
"@decibri/decibri-darwin-arm64": "5.0.0",
|
|
77
|
+
"@decibri/decibri-linux-x64-gnu": "5.0.0",
|
|
78
|
+
"@decibri/decibri-linux-arm64-gnu": "5.0.0"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@napi-rs/cli": "^3.7.0"
|
|
@@ -6,7 +6,7 @@ const { WORKLET_SOURCE } = require('./worklet-inline.js');
|
|
|
6
6
|
// Browser build version. Keep in sync with package.json on each release; the
|
|
7
7
|
// browser bundle cannot read package.json at runtime the way the Node wrapper
|
|
8
8
|
// does, so this is a maintained constant.
|
|
9
|
-
const VERSION = '
|
|
9
|
+
const VERSION = '5.0.0';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Browser microphone capture.
|
|
@@ -38,21 +38,47 @@ class Microphone extends Emitter {
|
|
|
38
38
|
this._stopRequested = false;
|
|
39
39
|
|
|
40
40
|
// ── VAD state ─────────────────────────────────────────────────────────
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
//
|
|
41
|
+
// vad accepts false (disabled, default), the 'energy' shorthand, or a config
|
|
42
|
+
// object { model: 'energy', threshold?, holdoffMs? } to tune the policy. The
|
|
43
|
+
// browser runs energy VAD only; Silero needs ONNX Runtime, which is
|
|
44
|
+
// Node-only. The legacy vad: true form and the flat vadThreshold/vadHoldoff
|
|
45
|
+
// options are rejected with a migration error.
|
|
46
|
+
if (options.vadThreshold !== undefined || options.vadHoldoff !== undefined) {
|
|
47
|
+
throw new TypeError(
|
|
48
|
+
"vadThreshold and vadHoldoff are no longer supported. Pass them on the vad config object: vad: { model: 'energy', threshold: 0.01, holdoffMs: 300 }."
|
|
49
|
+
);
|
|
50
|
+
}
|
|
44
51
|
const vad = options.vad ?? false;
|
|
52
|
+
let vadThreshold = 0.01;
|
|
53
|
+
let vadHoldoff = 300;
|
|
45
54
|
if (vad === false) {
|
|
46
55
|
this._vad = false;
|
|
47
56
|
} else if (vad === true) {
|
|
48
57
|
throw new TypeError("vad: true is no longer supported. Specify the mode explicitly: vad: 'energy'.");
|
|
49
58
|
} else if (vad === 'energy') {
|
|
50
59
|
this._vad = true;
|
|
60
|
+
} else if (vad !== null && typeof vad === 'object' && !Array.isArray(vad)) {
|
|
61
|
+
if (vad.model !== 'energy') {
|
|
62
|
+
throw new TypeError(`Invalid vad model: ${JSON.stringify(vad.model)}. Expected 'energy'.`);
|
|
63
|
+
}
|
|
64
|
+
this._vad = true;
|
|
65
|
+
if (vad.threshold !== undefined) {
|
|
66
|
+
if (vad.threshold < 0 || vad.threshold > 1) {
|
|
67
|
+
throw new TypeError(`threshold must be between 0 and 1, got ${vad.threshold}`);
|
|
68
|
+
}
|
|
69
|
+
vadThreshold = vad.threshold;
|
|
70
|
+
}
|
|
71
|
+
if (vad.holdoffMs !== undefined) {
|
|
72
|
+
if (vad.holdoffMs < 0) {
|
|
73
|
+
throw new TypeError(`holdoffMs must be >= 0, got ${vad.holdoffMs}`);
|
|
74
|
+
}
|
|
75
|
+
vadHoldoff = vad.holdoffMs;
|
|
76
|
+
}
|
|
51
77
|
} else {
|
|
52
|
-
throw new TypeError(`Invalid vad value: ${JSON.stringify(vad)}. Expected false
|
|
78
|
+
throw new TypeError(`Invalid vad value: ${JSON.stringify(vad)}. Expected false, 'energy', or a config object { model, threshold, holdoffMs }.`);
|
|
53
79
|
}
|
|
54
|
-
this._vadThreshold =
|
|
55
|
-
this._vadHoldoff =
|
|
80
|
+
this._vadThreshold = vadThreshold;
|
|
81
|
+
this._vadHoldoff = vadHoldoff;
|
|
56
82
|
this._vadScore = 0;
|
|
57
83
|
this._isSpeaking = false;
|
|
58
84
|
this._silenceTimer = null;
|
|
@@ -80,12 +106,6 @@ class Microphone extends Emitter {
|
|
|
80
106
|
if (this._dtype !== 'int16' && this._dtype !== 'float32') {
|
|
81
107
|
throw new TypeError("dtype must be 'int16' or 'float32'");
|
|
82
108
|
}
|
|
83
|
-
if (this._vadThreshold < 0 || this._vadThreshold > 1) {
|
|
84
|
-
throw new TypeError(`vadThreshold must be between 0 and 1, got ${this._vadThreshold}`);
|
|
85
|
-
}
|
|
86
|
-
if (this._vadHoldoff < 0) {
|
|
87
|
-
throw new TypeError(`vadHoldoff must be >= 0, got ${this._vadHoldoff}`);
|
|
88
|
-
}
|
|
89
109
|
}
|
|
90
110
|
|
|
91
111
|
// ── Public API ──────────────────────────────────────────────────────────
|
package/src/browser/index.d.ts
CHANGED
|
@@ -15,6 +15,27 @@ export interface VersionInfo {
|
|
|
15
15
|
decibri: string;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Voice-activity-detection config object (browser), passed on the `vad` option
|
|
20
|
+
* to tune the detector. The browser runs energy VAD only, so `model` is
|
|
21
|
+
* `'energy'`; pass this object to override the threshold or holdoff.
|
|
22
|
+
*/
|
|
23
|
+
export interface VadOptions {
|
|
24
|
+
/** Detector to run. The browser supports only the energy RMS detector. */
|
|
25
|
+
model: 'energy';
|
|
26
|
+
/**
|
|
27
|
+
* RMS energy threshold for speech detection.
|
|
28
|
+
* @default 0.01
|
|
29
|
+
* @range 0–1
|
|
30
|
+
*/
|
|
31
|
+
threshold?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Milliseconds of sub-threshold audio before emitting `'silence'`.
|
|
34
|
+
* @default 300
|
|
35
|
+
*/
|
|
36
|
+
holdoffMs?: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
18
39
|
/** Constructor options for the browser `Microphone` class. */
|
|
19
40
|
export interface MicrophoneOptions {
|
|
20
41
|
/**
|
|
@@ -53,29 +74,20 @@ export interface MicrophoneOptions {
|
|
|
53
74
|
dtype?: 'int16' | 'float32';
|
|
54
75
|
|
|
55
76
|
/**
|
|
56
|
-
* Voice activity detection
|
|
77
|
+
* Voice activity detection. One of:
|
|
57
78
|
* - `false`: disabled (default)
|
|
58
79
|
* - `'energy'`: RMS energy threshold
|
|
80
|
+
* - a `VadOptions` config object `{ model: 'energy', threshold?, holdoffMs? }`
|
|
81
|
+
* to tune the threshold and holdoff
|
|
59
82
|
*
|
|
60
|
-
* The browser runs energy VAD only; Silero is Node-only.
|
|
61
|
-
*
|
|
62
|
-
*
|
|
83
|
+
* The browser runs energy VAD only; Silero is Node-only. The string shorthand
|
|
84
|
+
* uses a 0.01 threshold and a 300 ms holdoff; pass a `VadOptions` object to
|
|
85
|
+
* override them. When enabled, emits `'speech'` and `'silence'` events and
|
|
86
|
+
* updates `vadScore`. The legacy `vad: true` form is rejected; specify the
|
|
87
|
+
* mode explicitly.
|
|
63
88
|
* @default false
|
|
64
89
|
*/
|
|
65
|
-
vad?: false | 'energy';
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* RMS energy threshold for speech detection (VAD mode only).
|
|
69
|
-
* @default 0.01
|
|
70
|
-
* @range 0–1
|
|
71
|
-
*/
|
|
72
|
-
vadThreshold?: number;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Milliseconds of sub-threshold audio before emitting `'silence'`.
|
|
76
|
-
* @default 300
|
|
77
|
-
*/
|
|
78
|
-
vadHoldoff?: number;
|
|
90
|
+
vad?: false | 'energy' | VadOptions;
|
|
79
91
|
|
|
80
92
|
/**
|
|
81
93
|
* Enable browser echo cancellation.
|