decibri 3.4.2 → 4.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # decibri
2
2
 
3
- Cross-platform audio capture, output, and voice activity detection for Node.js and browsers.
3
+ Cross-platform audio capture, playback, and voice activity detection for Node.js and browsers.
4
4
 
5
5
  ## Installation
6
6
 
@@ -8,18 +8,24 @@ Cross-platform audio capture, output, and voice activity detection for Node.js a
8
8
  npm install decibri
9
9
  ```
10
10
 
11
- One package for Node.js and browsers. Node.js gets a native addon (Rust via napi-rs). Browsers get a JavaScript AudioWorklet implementation. Platform-specific binaries are installed automatically.
11
+ One package for Node.js and browsers. Node.js gets a prebuilt native addon. Browsers get a JavaScript AudioWorklet implementation. Platform-specific binaries are installed automatically.
12
12
 
13
13
  Requires Node.js >= 18. TypeScript definitions are bundled.
14
14
 
15
+ The package uses named exports:
16
+
17
+ ```javascript
18
+ const { Microphone, Speaker, inputDevices, outputDevices, version } = require('decibri');
19
+ ```
20
+
15
21
  ## Quick Start
16
22
 
17
23
  ### Capture audio
18
24
 
19
25
  ```javascript
20
- const Decibri = require('decibri');
26
+ const { Microphone } = require('decibri');
21
27
 
22
- const mic = new Decibri({ sampleRate: 16000, channels: 1 });
28
+ const mic = new Microphone({ sampleRate: 16000, channels: 1 });
23
29
  mic.on('data', (chunk) => { /* Buffer of Int16 PCM samples */ });
24
30
  setTimeout(() => mic.stop(), 5000);
25
31
  ```
@@ -27,9 +33,9 @@ setTimeout(() => mic.stop(), 5000);
27
33
  ### Play audio
28
34
 
29
35
  ```javascript
30
- const { DecibriOutput } = require('decibri');
36
+ const { Speaker } = require('decibri');
31
37
 
32
- const speaker = new DecibriOutput({ sampleRate: 16000, channels: 1 });
38
+ const speaker = new Speaker({ sampleRate: 16000, channels: 1 });
33
39
  speaker.write(pcmBuffer);
34
40
  speaker.end();
35
41
  ```
@@ -37,9 +43,9 @@ speaker.end();
37
43
  ### Browser capture
38
44
 
39
45
  ```javascript
40
- import { Decibri } from 'decibri'; // browser entry via conditional export
46
+ import { Microphone } from 'decibri'; // browser entry via conditional export
41
47
 
42
- const mic = new Decibri({ sampleRate: 16000 });
48
+ const mic = new Microphone({ sampleRate: 16000 });
43
49
  mic.on('data', (chunk) => { /* Int16Array of PCM samples */ });
44
50
  await mic.start(); // requires user gesture in Safari
45
51
  ```
@@ -47,14 +53,16 @@ await mic.start(); // requires user gesture in Safari
47
53
  ### Pipe capture to playback (echo)
48
54
 
49
55
  ```javascript
50
- const mic = new Decibri({ sampleRate: 16000, channels: 1 });
51
- const speaker = new DecibriOutput({ sampleRate: 16000, channels: 1 });
56
+ const { Microphone, Speaker } = require('decibri');
57
+
58
+ const mic = new Microphone({ sampleRate: 16000, channels: 1 });
59
+ const speaker = new Speaker({ sampleRate: 16000, channels: 1 });
52
60
  mic.pipe(speaker);
53
61
  ```
54
62
 
55
- ## API: Decibri (Capture)
63
+ ## API: Microphone (Capture)
56
64
 
57
- ### `new Decibri(options?)`
65
+ ### `new Microphone(options?)`
58
66
 
59
67
  Creates a Readable stream that captures from the microphone.
60
68
 
@@ -64,27 +72,32 @@ Creates a Readable stream that captures from the microphone.
64
72
  | `channels` | number | 1 | Input channels (1 to 32) |
65
73
  | `framesPerBuffer` | number | 1600 | Frames per chunk (64 to 65536). At 16kHz mono, 1600 = 100ms = 3200 bytes |
66
74
  | `device` | number, string, or `{ id: string }` | system default | Device index, case-insensitive name substring, or stable per-host ID |
67
- | `format` | `'int16'` \| `'float32'` | `'int16'` | Sample encoding |
68
- | `vad` | boolean | false | Enable voice activity detection |
69
- | `vadMode` | `'energy'` \| `'silero'` | `'energy'` | VAD engine: RMS threshold or Silero ML model |
70
- | `vadThreshold` | number | 0.01 / 0.5 | Speech threshold. Default depends on `vadMode` |
75
+ | `dtype` | `'int16'` \| `'float32'` | `'int16'` | Sample encoding |
76
+ | `vad` | `false` \| `'silero'` \| `'energy'` | `false` | Voice activity detection: disabled, the Silero ML model, or an RMS energy threshold |
77
+ | `vadThreshold` | number | 0.5 / 0.01 | Speech threshold. Default is 0.5 for `'silero'`, 0.01 for `'energy'` |
71
78
  | `vadHoldoff` | number | 300 | Silence holdoff in ms |
79
+ | `modelPath` | string | bundled model | Path to the Silero model. Only used when `vad` is `'silero'` |
72
80
 
73
81
  Standard `ReadableOptions` (e.g. `highWaterMark`) are also accepted.
74
82
 
83
+ `vad: true` is not accepted; pass the mode explicitly as `vad: 'silero'` or `vad: 'energy'`.
84
+
75
85
  ### Methods
76
86
 
77
87
  | Method | Description |
78
88
  | --- | --- |
79
89
  | `mic.stop()` | Stop capture and end stream. Safe to call multiple times |
80
- | `Decibri.devices()` | List available input devices |
81
- | `Decibri.version()` | Version info |
90
+ | `Microphone.devices()` | List available input devices |
91
+ | `Microphone.version()` | Version info: `{ decibri, audioBackend, binding }` |
92
+
93
+ The module-level `inputDevices()` and `version()` free functions are equivalent to the static methods.
82
94
 
83
95
  ### Properties
84
96
 
85
97
  | Property | Type | Description |
86
98
  | --- | --- | --- |
87
99
  | `mic.isOpen` | boolean | `true` while capturing |
100
+ | `mic.vadScore` | number | Latest VAD score for the active mode (Silero probability or normalized RMS); 0 when disabled |
88
101
 
89
102
  ### Events
90
103
 
@@ -97,9 +110,9 @@ Standard `ReadableOptions` (e.g. `highWaterMark`) are also accepted.
97
110
  | `'end'` | - | Stream ended |
98
111
  | `'error'` | Error | An error occurred |
99
112
 
100
- ## API: DecibriOutput (Playback)
113
+ ## API: Speaker (Playback)
101
114
 
102
- ### `new DecibriOutput(options?)`
115
+ ### `new Speaker(options?)`
103
116
 
104
117
  Creates a Writable stream for speaker playback.
105
118
 
@@ -107,7 +120,7 @@ Creates a Writable stream for speaker playback.
107
120
  | --- | --- | --- | --- |
108
121
  | `sampleRate` | number | 16000 | Playback sample rate (1000 to 384000) |
109
122
  | `channels` | number | 1 | Output channels (1 to 32) |
110
- | `format` | `'int16'` \| `'float32'` | `'int16'` | Sample encoding of incoming data |
123
+ | `dtype` | `'int16'` \| `'float32'` | `'int16'` | Sample encoding of incoming data |
111
124
  | `device` | number, string, or `{ id: string }` | system default | Output device index, case-insensitive name substring, or stable per-host ID |
112
125
 
113
126
  Standard `WritableOptions` (e.g. `highWaterMark`) are also accepted.
@@ -118,24 +131,46 @@ Standard `WritableOptions` (e.g. `highWaterMark`) are also accepted.
118
131
  | `speaker.end()` | Signal end. Drains remaining audio, then emits `'finish'` |
119
132
  | `speaker.stop()` | Immediate stop. Discards remaining audio |
120
133
  | `speaker.isPlaying` | `true` while audio is being output |
121
- | `DecibriOutput.devices()` | List available output devices |
122
- | `DecibriOutput.version()` | Same as `Decibri.version()` |
134
+ | `Speaker.devices()` | List available output devices |
135
+ | `Speaker.version()` | Same as `Microphone.version()` |
136
+
137
+ The module-level `outputDevices()` free function is equivalent to `Speaker.devices()`.
138
+
139
+ ## Errors
140
+
141
+ Construction errors come as typed classes you can catch:
142
+
143
+ ```javascript
144
+ const { Microphone, DecibriError, DeviceError } = require('decibri');
145
+
146
+ try {
147
+ new Microphone({ device: 'no such device' });
148
+ } catch (err) {
149
+ if (err instanceof DeviceError) {
150
+ console.log(err.code); // e.g. 'MICROPHONE_NOT_FOUND'
151
+ }
152
+ }
153
+ ```
154
+
155
+ `DeviceError`, `OrtError`, and `OrtPathError` extend `DecibriError`, which extends `Error`. Each carries a stable `code` string. Argument validation (bad `sampleRate`, `channels`, `dtype`, or `vad`) throws a built-in `RangeError` or `TypeError`.
123
156
 
124
157
  ## API: Browser
125
158
 
126
159
  The browser API uses `getUserMedia` and `AudioWorklet`. It differs from the Node.js API because browser audio is fundamentally async.
127
160
 
128
- ### `new Decibri(options?)` (browser)
161
+ ### `new Microphone(options?)` (browser)
129
162
 
130
163
  Same options as Node.js, plus:
131
164
 
132
165
  | Option | Type | Default | Description |
133
166
  | --- | --- | --- | --- |
134
- | `device` | string | system default | Device ID from `Decibri.devices()` (not index) |
167
+ | `device` | string | system default | Device ID from `Microphone.devices()` (not index) |
135
168
  | `echoCancellation` | boolean | true | Browser echo cancellation |
136
169
  | `noiseSuppression` | boolean | true | Browser noise suppression |
137
170
  | `workletUrl` | string | inline blob | Custom worklet URL for strict CSP |
138
171
 
172
+ The browser runs energy-mode VAD only, so its `vad` option accepts `false` or `'energy'`. The browser `version()` returns `{ decibri }` only.
173
+
139
174
  ### Key differences from Node.js
140
175
 
141
176
  | Aspect | Node.js | Browser |
@@ -144,49 +179,52 @@ Same options as Node.js, plus:
144
179
  | Base class | Readable stream | Custom Emitter |
145
180
  | Data type | Buffer | Int16Array / Float32Array |
146
181
  | `devices()` | Sync, returns array | Async, returns Promise |
147
- | Sample rate | Direct via cpal | Resampled from native rate |
182
+ | Sample rate | Native device rate | Resampled from native rate |
183
+ | VAD | `'silero'` or `'energy'` | `'energy'` only |
148
184
 
149
185
  ## Voice Activity Detection
150
186
 
151
- ### Energy mode (default)
187
+ ### Energy mode
152
188
 
153
189
  Lightweight RMS energy threshold. No model required.
154
190
 
155
191
  ```javascript
156
- const mic = new Decibri({ vad: true, vadThreshold: 0.01 });
192
+ const mic = new Microphone({ vad: 'energy', vadThreshold: 0.01 });
157
193
  mic.on('speech', () => console.log('speaking'));
158
194
  mic.on('silence', () => console.log('silent'));
159
195
  ```
160
196
 
161
197
  ### Silero mode
162
198
 
163
- ML-based detection using the Silero VAD v5 ONNX model. More accurate than energy mode, especially in noisy environments.
199
+ ML-based detection using the Silero VAD v5 model. More accurate than energy mode, especially in noisy environments.
164
200
 
165
201
  ```javascript
166
- const mic = new Decibri({ vad: true, vadMode: 'silero', vadThreshold: 0.5 });
202
+ const mic = new Microphone({ vad: 'silero', vadThreshold: 0.5 });
167
203
  mic.on('speech', () => console.log('speaking'));
168
204
  mic.on('silence', () => console.log('silent'));
169
205
  ```
170
206
 
171
- The Silero model (~2MB) ships inside the npm package. No downloads or API keys required.
207
+ The Silero model (~2MB) ships inside the npm package. No downloads or API keys required. Silero mode is Node.js only.
172
208
 
173
209
  ## Device Selection
174
210
 
175
211
  ```javascript
212
+ const { Microphone } = require('decibri');
213
+
176
214
  // System default
177
- const mic = new Decibri();
215
+ const mic = new Microphone();
178
216
 
179
217
  // By name (case-insensitive substring match)
180
- const mic = new Decibri({ device: 'USB' });
218
+ const mic = new Microphone({ device: 'USB' });
181
219
 
182
220
  // By index
183
- const devices = Decibri.devices();
184
- const mic = new Decibri({ device: devices[1].index });
221
+ const devices = Microphone.devices();
222
+ const mic = new Microphone({ device: devices[1].index });
185
223
 
186
224
  // By stable per-host ID (survives across enumerations)
187
- const mic = new Decibri({ device: { id: devices[1].id } });
225
+ const mic = new Microphone({ device: { id: devices[1].id } });
188
226
 
189
- Decibri.devices();
227
+ Microphone.devices();
190
228
  // [
191
229
  // { index: 0, name: 'Microphone', id: '{0.0.1.00000000}.{...}', maxInputChannels: 2, defaultSampleRate: 48000, isDefault: true },
192
230
  // { index: 1, name: 'USB Headset', id: '{0.0.1.00000000}.{...}', maxInputChannels: 1, defaultSampleRate: 44100, isDefault: false }
@@ -206,6 +244,10 @@ node node_modules/decibri/examples/websocket-server.js # terminal 1
206
244
  node node_modules/decibri/examples/websocket-stream.js # terminal 2
207
245
  ```
208
246
 
247
+ ## Migrating from 3.x
248
+
249
+ decibri 4.0.0 renames the API to a microphone and speaker vocabulary and switches to named exports. See [MIGRATION.md](./MIGRATION.md) for a complete before-and-after guide.
250
+
209
251
  ## Platform Support
210
252
 
211
253
  | Platform | Architecture | Audio Backend |
@@ -218,9 +260,9 @@ node node_modules/decibri/examples/websocket-stream.js # terminal 2
218
260
 
219
261
  ## How It Works
220
262
 
221
- decibri is a Rust library using cpal for cross-platform audio I/O. The Rust core compiles to a Node.js native addon via napi-rs and ships pre-built binaries for each platform. Browser support uses a JavaScript AudioWorklet implementation with the same event-driven API.
263
+ decibri compiles a Rust audio core to a Node.js native addon and ships prebuilt binaries for each platform, so there is no build step on install. Browser support uses a JavaScript AudioWorklet implementation with the same event-driven API.
222
264
 
223
- Audio flows from the OS audio device through cpal's callback, into a crossbeam channel, through frame-exact buffering (guarantees consistent chunk sizes), and into Node.js via a threadsafe function. The JavaScript layer wraps this in a standard Readable stream.
265
+ On Node.js, audio flows from the OS audio device through frame-exact buffering (which guarantees consistent chunk sizes) and into a standard Readable stream. In the browser, audio is captured and resampled in an AudioWorklet and delivered through the same `'data'` event interface.
224
266
 
225
267
  ## Documentation
226
268
 
@@ -5,14 +5,14 @@
5
5
  // Usage (from repo clone): node npm/decibri/examples/wav-capture.js
6
6
 
7
7
  const fs = require('fs');
8
- const Decibri = require('decibri');
8
+ const { Microphone } = require('decibri');
9
9
 
10
10
  const SAMPLE_RATE = 16000;
11
11
  const CHANNELS = 1;
12
12
  const BITS_PER_SAMPLE = 16;
13
13
  const DURATION_MS = 5000;
14
14
 
15
- const mic = new Decibri({ sampleRate: SAMPLE_RATE, channels: CHANNELS });
15
+ const mic = new Microphone({ sampleRate: SAMPLE_RATE, channels: CHANNELS });
16
16
  const chunks = [];
17
17
 
18
18
  mic.on('data', (chunk) => chunks.push(chunk));
@@ -5,11 +5,11 @@
5
5
  // Usage (from repo clone): node npm/decibri/examples/websocket-stream.js [ws://localhost:8080]
6
6
 
7
7
  const { WebSocket } = require('ws');
8
- const Decibri = require('decibri');
8
+ const { Microphone } = require('decibri');
9
9
 
10
10
  const url = process.argv[2] || 'ws://localhost:8080';
11
11
  const ws = new WebSocket(url);
12
- const mic = new Decibri({ sampleRate: 16000, channels: 1 });
12
+ const mic = new Microphone({ sampleRate: 16000, channels: 1 });
13
13
 
14
14
  ws.on('open', () => {
15
15
  console.log(`Connected to ${url}, streaming audio. Ctrl+C to stop.`);
package/index.d.ts CHANGED
@@ -115,5 +115,5 @@ export interface OutputDeviceInfoJs {
115
115
  /** Version info returned to JS. */
116
116
  export interface VersionInfoJs {
117
117
  decibri: string
118
- portaudio: string
118
+ audioBackend: string
119
119
  }
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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
80
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
96
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
117
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
133
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
201
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
217
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
237
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
253
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
274
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
290
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
308
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
342
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
358
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
376
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
392
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
426
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
479
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
495
+ if (bindingPackageVersion !== '4.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 4.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 !== '3.4.2' && 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 3.4.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
511
+ if (bindingPackageVersion !== '4.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 4.0.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,7 +1,7 @@
1
1
  {
2
2
  "name": "decibri",
3
- "version": "3.4.2",
4
- "description": "Cross-platform audio capture, output, and processing for Node.js and browsers",
3
+ "version": "4.0.0",
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",
7
7
  "browser": "./src/browser/index.js",
@@ -67,13 +67,15 @@
67
67
  "examples/",
68
68
  "index.js",
69
69
  "index.d.ts",
70
- "README.md"
70
+ "README.md",
71
+ "CHANGELOG.md",
72
+ "MIGRATION.md"
71
73
  ],
72
74
  "optionalDependencies": {
73
- "@decibri/decibri-win32-x64-msvc": "3.4.2",
74
- "@decibri/decibri-darwin-arm64": "3.4.2",
75
- "@decibri/decibri-linux-x64-gnu": "3.4.2",
76
- "@decibri/decibri-linux-arm64-gnu": "3.4.2"
75
+ "@decibri/decibri-win32-x64-msvc": "4.0.0",
76
+ "@decibri/decibri-darwin-arm64": "4.0.0",
77
+ "@decibri/decibri-linux-x64-gnu": "4.0.0",
78
+ "@decibri/decibri-linux-arm64-gnu": "4.0.0"
77
79
  },
78
80
  "devDependencies": {
79
81
  "@napi-rs/cli": "^3.0.0"