decibri 5.5.0 → 5.7.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 +54 -1
- package/MIGRATION.md +8 -12
- package/README.md +13 -9
- package/examples/decibri.browser.js +93 -12
- package/index.d.ts +94 -15
- package/index.js +52 -52
- package/package.json +7 -5
- package/src/browser/decibri-browser.js +174 -25
- package/src/browser/index.d.ts +58 -7
- package/src/browser/worklet-inline.js +2 -2
- package/src/browser/worklet-processor.js +116 -32
- package/src/decibri.d.ts +183 -22
- package/src/decibri.js +242 -47
- package/src/errors.js +9 -1
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 !== '5.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
80
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
96
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
117
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
133
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
150
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
166
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
185
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
201
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
217
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
237
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
253
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
274
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
290
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
308
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
324
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
342
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
358
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
376
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
392
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
410
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
426
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
443
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
459
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
479
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
495
|
+
if (bindingPackageVersion !== '5.7.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.7.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 !== '5.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 5.
|
|
511
|
+
if (bindingPackageVersion !== '5.7.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.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "decibri",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.7.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",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"binaryName": "decibri",
|
|
57
57
|
"targets": [
|
|
58
58
|
"x86_64-pc-windows-msvc",
|
|
59
|
+
"aarch64-pc-windows-msvc",
|
|
59
60
|
"aarch64-apple-darwin",
|
|
60
61
|
"x86_64-unknown-linux-gnu",
|
|
61
62
|
"aarch64-unknown-linux-gnu"
|
|
@@ -72,10 +73,11 @@
|
|
|
72
73
|
"MIGRATION.md"
|
|
73
74
|
],
|
|
74
75
|
"optionalDependencies": {
|
|
75
|
-
"@decibri/decibri-win32-x64-msvc": "5.
|
|
76
|
-
"@decibri/decibri-
|
|
77
|
-
"@decibri/decibri-
|
|
78
|
-
"@decibri/decibri-linux-
|
|
76
|
+
"@decibri/decibri-win32-x64-msvc": "5.7.0",
|
|
77
|
+
"@decibri/decibri-win32-arm64-msvc": "5.7.0",
|
|
78
|
+
"@decibri/decibri-darwin-arm64": "5.7.0",
|
|
79
|
+
"@decibri/decibri-linux-x64-gnu": "5.7.0",
|
|
80
|
+
"@decibri/decibri-linux-arm64-gnu": "5.7.0"
|
|
79
81
|
},
|
|
80
82
|
"devDependencies": {
|
|
81
83
|
"@napi-rs/cli": "^3.7.0"
|
|
@@ -6,13 +6,15 @@ 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 = '5.
|
|
9
|
+
const VERSION = '5.7.0';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Browser microphone capture.
|
|
13
13
|
*
|
|
14
14
|
* Uses getUserMedia + AudioWorklet for real-time audio capture in browsers.
|
|
15
|
-
* Emits 'data' events with Int16Array or Float32Array chunks
|
|
15
|
+
* Emits 'data' events with Int16Array or Float32Array chunks holding
|
|
16
|
+
* framesPerBuffer frames of the delivered channel count, interleaved frame
|
|
17
|
+
* by frame.
|
|
16
18
|
*
|
|
17
19
|
* Ported from decibri-web decibri.ts. Logic identical, types removed.
|
|
18
20
|
*
|
|
@@ -39,10 +41,10 @@ class Microphone extends Emitter {
|
|
|
39
41
|
|
|
40
42
|
// ── VAD state ─────────────────────────────────────────────────────────
|
|
41
43
|
// vad accepts false (disabled, default), the 'energy' shorthand, or a config
|
|
42
|
-
// object { model: 'energy', threshold?, holdoffMs? } to tune the
|
|
43
|
-
// browser runs energy VAD only; Silero needs ONNX Runtime,
|
|
44
|
-
// Node-only. The legacy vad: true form and the flat
|
|
45
|
-
// options are rejected with a migration error.
|
|
44
|
+
// object { model: 'energy', threshold?, holdoffMs?, source? } to tune the
|
|
45
|
+
// policy. The browser runs energy VAD only; Silero needs ONNX Runtime,
|
|
46
|
+
// which is Node-only. The legacy vad: true form and the flat
|
|
47
|
+
// vadThreshold/vadHoldoff options are rejected with a migration error.
|
|
46
48
|
if (options.vadThreshold !== undefined || options.vadHoldoff !== undefined) {
|
|
47
49
|
throw new TypeError(
|
|
48
50
|
"vadThreshold and vadHoldoff are no longer supported. Pass them on the vad config object: vad: { model: 'energy', threshold: 0.01, holdoffMs: 300 }."
|
|
@@ -51,6 +53,7 @@ class Microphone extends Emitter {
|
|
|
51
53
|
const vad = options.vad ?? false;
|
|
52
54
|
let vadThreshold = 0.01;
|
|
53
55
|
let vadHoldoff = 300;
|
|
56
|
+
let vadSource;
|
|
54
57
|
if (vad === false) {
|
|
55
58
|
this._vad = false;
|
|
56
59
|
} else if (vad === true) {
|
|
@@ -82,11 +85,34 @@ class Microphone extends Emitter {
|
|
|
82
85
|
}
|
|
83
86
|
vadHoldoff = vad.holdoffMs;
|
|
84
87
|
}
|
|
88
|
+
// source names the 0-based DELIVERED channel the detector reads, the
|
|
89
|
+
// position within the delivered interleaved frames after any
|
|
90
|
+
// channelMap; absent scores the frame average of every delivered
|
|
91
|
+
// channel. The checks and the messages are the node entry's. The
|
|
92
|
+
// delivered-count check runs only against a valid count; a count below
|
|
93
|
+
// one is reported as its own error below, exactly as on the node entry.
|
|
94
|
+
if (vad.source !== undefined) {
|
|
95
|
+
const source = vad.source;
|
|
96
|
+
if (typeof source !== 'number' || !Number.isInteger(source)) {
|
|
97
|
+
throw new TypeError('vad source must be an integer');
|
|
98
|
+
}
|
|
99
|
+
if (source < 0 || source > 65535) {
|
|
100
|
+
throw new RangeError('vad source must be between 0 and 65535');
|
|
101
|
+
}
|
|
102
|
+
const deliveredChannels = options.channels ?? 1;
|
|
103
|
+
if (deliveredChannels >= 1 && source >= deliveredChannels) {
|
|
104
|
+
throw new RangeError(
|
|
105
|
+
`the detector source names delivered channel ${source}; the delivered channel count is ${deliveredChannels}`
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
vadSource = source;
|
|
109
|
+
}
|
|
85
110
|
} else {
|
|
86
|
-
throw new TypeError(`Invalid vad value: ${JSON.stringify(vad)}. Expected false, 'energy', or a config object { model, threshold, holdoffMs }.`);
|
|
111
|
+
throw new TypeError(`Invalid vad value: ${JSON.stringify(vad)}. Expected false, 'energy', or a config object { model, threshold, holdoffMs, source }.`);
|
|
87
112
|
}
|
|
88
113
|
this._vadThreshold = vadThreshold;
|
|
89
114
|
this._vadHoldoff = vadHoldoff;
|
|
115
|
+
this._vadSource = vadSource;
|
|
90
116
|
this._vadScore = 0;
|
|
91
117
|
this._isSpeaking = false;
|
|
92
118
|
this._silenceTimer = null;
|
|
@@ -94,6 +120,7 @@ class Microphone extends Emitter {
|
|
|
94
120
|
// ── Options ───────────────────────────────────────────────────────────
|
|
95
121
|
this._sampleRate = options.sampleRate ?? 16000;
|
|
96
122
|
this._channels = options.channels ?? 1;
|
|
123
|
+
this._channelMap = options.channelMap;
|
|
97
124
|
this._framesPerBuffer = options.framesPerBuffer ?? 1600;
|
|
98
125
|
this._device = options.device;
|
|
99
126
|
this._dtype = options.dtype ?? 'int16';
|
|
@@ -105,21 +132,44 @@ class Microphone extends Emitter {
|
|
|
105
132
|
if (this._sampleRate < 1000 || this._sampleRate > 384000) {
|
|
106
133
|
throw new RangeError('sample rate must be between 1000 and 384000');
|
|
107
134
|
}
|
|
108
|
-
//
|
|
109
|
-
//
|
|
110
|
-
//
|
|
135
|
+
// The number of channels delivered, interleaved frame by frame. Bounded
|
|
136
|
+
// below here; bounded above by the granted track alone, which answers
|
|
137
|
+
// when the stream starts. No fixed maximum exists on this path. The
|
|
138
|
+
// classes and the messages are the node entry's, so the same value is
|
|
139
|
+
// rejected the same way in both runtimes.
|
|
111
140
|
if (this._channels < 1) {
|
|
112
141
|
throw new RangeError('channels must be at least 1');
|
|
113
142
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
//
|
|
121
|
-
|
|
122
|
-
|
|
143
|
+
// An optional list of 0-based device channel indices, one per delivered
|
|
144
|
+
// channel: delivered channel j carries device channel channelMap[j].
|
|
145
|
+
// Entries may repeat and may appear in any order, so a map both selects
|
|
146
|
+
// and permutes. Absence derives the delivered channels from the count
|
|
147
|
+
// alone: 1 delivers the documented average of every granted channel, and
|
|
148
|
+
// the granted count delivers every granted channel in granted order. The
|
|
149
|
+
// checks here are shape-only (an array of integers that fit the channel
|
|
150
|
+
// count's width, with one entry per channel), the node entry's classes
|
|
151
|
+
// and messages; whether each entry exists on the track is checked when
|
|
152
|
+
// the stream starts, against the granted track's own report, because
|
|
153
|
+
// only the grant can say how many channels it carries. No fixed maximum
|
|
154
|
+
// exists on this path.
|
|
155
|
+
const channelMap = this._channelMap;
|
|
156
|
+
if (channelMap !== undefined) {
|
|
157
|
+
if (!Array.isArray(channelMap)) {
|
|
158
|
+
throw new TypeError(
|
|
159
|
+
`Invalid channelMap value: ${JSON.stringify(channelMap)}. Expected an array of 0-based device channel indices, such as [0].`
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
for (const entry of channelMap) {
|
|
163
|
+
if (typeof entry !== 'number' || !Number.isInteger(entry)) {
|
|
164
|
+
throw new TypeError('channelMap entries must be integers');
|
|
165
|
+
}
|
|
166
|
+
if (entry < 0 || entry > 65535) {
|
|
167
|
+
throw new RangeError('channelMap entries must be between 0 and 65535');
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (channelMap.length !== this._channels) {
|
|
171
|
+
throw new RangeError('channelMap must have exactly one entry per channel');
|
|
172
|
+
}
|
|
123
173
|
}
|
|
124
174
|
if (this._framesPerBuffer < 64 || this._framesPerBuffer > 65536) {
|
|
125
175
|
throw new TypeError(`frames per buffer must be between 64 and 65536, got ${this._framesPerBuffer}`);
|
|
@@ -203,6 +253,9 @@ class Microphone extends Emitter {
|
|
|
203
253
|
/**
|
|
204
254
|
* Most recent VAD score: the normalized RMS of the last chunk in `'energy'`
|
|
205
255
|
* mode, or 0 when VAD is disabled or before the first chunk is processed.
|
|
256
|
+
* A chunk carrying more than one channel is collapsed to the average of
|
|
257
|
+
* its channels, or to the one delivered channel a `vad: { source }` names,
|
|
258
|
+
* before the RMS, so the score reflects one channel's level.
|
|
206
259
|
* @returns {number}
|
|
207
260
|
*/
|
|
208
261
|
get vadScore() {
|
|
@@ -240,8 +293,14 @@ class Microphone extends Emitter {
|
|
|
240
293
|
await this._audioContext.resume();
|
|
241
294
|
|
|
242
295
|
// 2. Request microphone access
|
|
296
|
+
// The channel ask is 32 with ideal semantics, the count the Web Audio
|
|
297
|
+
// specification requires an implementation to support: the browser
|
|
298
|
+
// grants what it can serve and never rejects on this constraint. The
|
|
299
|
+
// granted track's own report, not this ask, is the authority for
|
|
300
|
+
// everything downstream, so a grant above the ask flows through
|
|
301
|
+
// unclamped.
|
|
243
302
|
const audioConstraints = {
|
|
244
|
-
channelCount:
|
|
303
|
+
channelCount: { ideal: 32 },
|
|
245
304
|
echoCancellation: this._echoCancellation,
|
|
246
305
|
noiseSuppression: this._noiseSuppression,
|
|
247
306
|
};
|
|
@@ -259,6 +318,49 @@ class Microphone extends Emitter {
|
|
|
259
318
|
throw error;
|
|
260
319
|
}
|
|
261
320
|
|
|
321
|
+
// The granted track's report is the capture-side authority, as the
|
|
322
|
+
// resolved device's report is on the node path: the map's entries, or
|
|
323
|
+
// the unmapped count's derivation, are checked against it here, before
|
|
324
|
+
// the worklet is built, with the node entry's message for the same
|
|
325
|
+
// condition. Without a map, only two derivations have a single meaning:
|
|
326
|
+
// 1 delivers the average of every granted channel, and the granted count
|
|
327
|
+
// delivers every granted channel in granted order; a count above the
|
|
328
|
+
// grant does not exist to deliver, and a strict subset above one does
|
|
329
|
+
// not say which channels it means, so the map has to name them. A
|
|
330
|
+
// browser that omits channelCount from getSettings() defers the check to
|
|
331
|
+
// the worklet, which sees the true channel count of every block it
|
|
332
|
+
// processes. At one delivered channel with no map there is nothing to
|
|
333
|
+
// check: the average serves any granted count.
|
|
334
|
+
if (this._channelMap !== undefined || this._channels > 1) {
|
|
335
|
+
const track = this._stream.getAudioTracks()[0];
|
|
336
|
+
const settings = track && typeof track.getSettings === 'function' ? track.getSettings() : {};
|
|
337
|
+
const granted = settings.channelCount;
|
|
338
|
+
if (typeof granted === 'number') {
|
|
339
|
+
let message = null;
|
|
340
|
+
if (this._channelMap !== undefined) {
|
|
341
|
+
for (const entry of this._channelMap) {
|
|
342
|
+
if (entry >= granted) {
|
|
343
|
+
message = `the channel map names device channel ${entry}; the device reports ${granted} input channels`;
|
|
344
|
+
break;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
} else if (this._channels > granted) {
|
|
348
|
+
message = `the input device does not support ${this._channels} delivered channels; it reports ${granted}`;
|
|
349
|
+
} else if (this._channels < granted) {
|
|
350
|
+
message = `a channel map is required to deliver ${this._channels} of the device's ${granted} input channels`;
|
|
351
|
+
}
|
|
352
|
+
if (message !== null) {
|
|
353
|
+
this._stream.getTracks().forEach(t => t.stop());
|
|
354
|
+
this._stream = null;
|
|
355
|
+
await this._audioContext.close();
|
|
356
|
+
this._audioContext = null;
|
|
357
|
+
const error = new Error(message);
|
|
358
|
+
this.emit('error', error);
|
|
359
|
+
throw error;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
262
364
|
// 3. Load AudioWorklet processor
|
|
263
365
|
let blobUrl = null;
|
|
264
366
|
const workletUrl = this._workletUrl ?? (blobUrl = this._createBlobUrl());
|
|
@@ -286,15 +388,31 @@ class Microphone extends Emitter {
|
|
|
286
388
|
format: this._dtype,
|
|
287
389
|
nativeSampleRate,
|
|
288
390
|
targetSampleRate: this._sampleRate,
|
|
391
|
+
channels: this._channels,
|
|
392
|
+
channelMap: this._channelMap ?? null,
|
|
289
393
|
},
|
|
290
394
|
});
|
|
291
395
|
|
|
292
396
|
// 5. Wire up data from worklet
|
|
293
397
|
this._workletNode.port.onmessage = (event) => {
|
|
294
|
-
const
|
|
398
|
+
const data = event.data;
|
|
399
|
+
|
|
400
|
+
// The port carries raw ArrayBuffer chunks and tagged control objects,
|
|
401
|
+
// as on the output worklet's port. The one control message is the
|
|
402
|
+
// worklet's channel-map failure: surface it and stop, so a map naming
|
|
403
|
+
// a channel the track does not carry is never silent.
|
|
404
|
+
if (!(data instanceof ArrayBuffer)) {
|
|
405
|
+
if (data && data.type === 'error') {
|
|
406
|
+
const error = new Error(data.message);
|
|
407
|
+
this.emit('error', error);
|
|
408
|
+
this.stop();
|
|
409
|
+
}
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
|
|
295
413
|
const chunk = this._dtype === 'int16'
|
|
296
|
-
? new Int16Array(
|
|
297
|
-
: new Float32Array(
|
|
414
|
+
? new Int16Array(data)
|
|
415
|
+
: new Float32Array(data);
|
|
298
416
|
|
|
299
417
|
this.emit('data', chunk);
|
|
300
418
|
|
|
@@ -359,11 +477,42 @@ class Microphone extends Emitter {
|
|
|
359
477
|
}
|
|
360
478
|
|
|
361
479
|
_computeRms(chunk) {
|
|
362
|
-
let sum = 0;
|
|
363
480
|
const n = chunk.length;
|
|
364
481
|
if (n === 0) return 0;
|
|
482
|
+
const channels = this._channels;
|
|
483
|
+
const isFloat = chunk instanceof Float32Array;
|
|
484
|
+
|
|
485
|
+
if (channels > 1) {
|
|
486
|
+
// Score one channel's level, as the node path's detector feed does:
|
|
487
|
+
// collapse each interleaved frame as the configured source directs,
|
|
488
|
+
// the engine's average (single-precision accumulation, f32 quotient)
|
|
489
|
+
// by default or one named delivered channel's sample alone, then take
|
|
490
|
+
// the RMS of the collapsed signal.
|
|
491
|
+
const frames = Math.floor(n / channels);
|
|
492
|
+
if (frames === 0) return 0;
|
|
493
|
+
const source = this._vadSource;
|
|
494
|
+
let sum = 0;
|
|
495
|
+
if (source !== undefined) {
|
|
496
|
+
for (let f = 0; f < frames; f++) {
|
|
497
|
+
const s = isFloat ? chunk[f * channels + source] : chunk[f * channels + source] / 32768;
|
|
498
|
+
sum += s * s;
|
|
499
|
+
}
|
|
500
|
+
return Math.sqrt(sum / frames);
|
|
501
|
+
}
|
|
502
|
+
for (let f = 0; f < frames; f++) {
|
|
503
|
+
let acc = 0;
|
|
504
|
+
for (let c = 0; c < channels; c++) {
|
|
505
|
+
const s = isFloat ? chunk[f * channels + c] : chunk[f * channels + c] / 32768;
|
|
506
|
+
acc = Math.fround(acc + s);
|
|
507
|
+
}
|
|
508
|
+
const mono = Math.fround(acc / channels);
|
|
509
|
+
sum += mono * mono;
|
|
510
|
+
}
|
|
511
|
+
return Math.sqrt(sum / frames);
|
|
512
|
+
}
|
|
365
513
|
|
|
366
|
-
|
|
514
|
+
let sum = 0;
|
|
515
|
+
if (isFloat) {
|
|
367
516
|
for (let i = 0; i < n; i++) sum += chunk[i] * chunk[i];
|
|
368
517
|
} else {
|
|
369
518
|
for (let i = 0; i < n; i++) {
|