decibri 3.4.0 → 3.4.1

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,338 +1,182 @@
1
- <!-- markdownlint-disable MD033 MD041 -->
1
+ <!-- markdownlint-disable MD033 MD041 MD059 -->
2
2
  <div align="center">
3
3
  <img width="100" height="100" alt="decibri" src="https://github.com/user-attachments/assets/a1a7aa23-6954-4cac-9490-76354f0865ee" />
4
4
 
5
5
  # decibri
6
6
 
7
- Cross-platform audio capture, output, and processing for Node.js and browsers.
8
-
9
- <!-- badges: start -->
10
- <table>
11
- <tr>
12
- <td><strong>Meta</strong></td>
13
- <td>
14
- <a href="https://pypi.org/project/decibri/"><img src="https://img.shields.io/pypi/v/decibri" alt="PyPI version"></a>&nbsp;
15
- <a href="https://www.npmjs.com/package/decibri"><img src="https://img.shields.io/npm/v/decibri" alt="npm version"></a>&nbsp;
16
- <a href="https://crates.io/crates/decibri"><img src="https://img.shields.io/crates/v/decibri" alt="crates.io version"></a>&nbsp;
17
- <a href="https://github.com/decibri/decibri/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache_2.0-blue.svg" alt="Apache 2.0 License"></a>&nbsp;
18
- <a href="https://decibri.com"><img src="https://img.shields.io/badge/Website-decibri.com-blue" alt="decibri.com"></a>&nbsp;
19
- <a href="https://decibri.com/docs/"><img src="https://img.shields.io/badge/docs-passing-brightgreen" alt="Docs"></a>
20
- </td>
21
- </tr>
22
- <tr>
23
- <td><strong>Binaries</strong></td>
24
- <td>
25
- <a href="https://github.com/decibri/decibri/actions/workflows/release.yml"><img src="https://img.shields.io/github/actions/workflow/status/decibri/decibri/release.yml?job=Build%20x86_64-pc-windows-msvc&label=Windows%20x64&logo=microsoft&logoColor=white" alt="Windows x64"></a>&nbsp;
26
- <a href="https://github.com/decibri/decibri/actions/workflows/release.yml"><img src="https://img.shields.io/github/actions/workflow/status/decibri/decibri/release.yml?job=Build%20aarch64-apple-darwin&label=macOS%20ARM64&logo=apple" alt="macOS ARM64"></a>&nbsp;
27
- <a href="https://github.com/decibri/decibri/actions/workflows/release.yml"><img src="https://img.shields.io/github/actions/workflow/status/decibri/decibri/release.yml?job=Build%20x86_64-unknown-linux-gnu&label=Linux%20x64&logo=linux&logoColor=white" alt="Linux x64"></a>&nbsp;
28
- <a href="https://github.com/decibri/decibri/actions/workflows/release.yml"><img src="https://img.shields.io/github/actions/workflow/status/decibri/decibri/release.yml?job=Build%20aarch64-unknown-linux-gnu&label=Linux%20ARM64&logo=linux&logoColor=white" alt="Linux ARM64"></a>
29
- </td>
30
- </tr>
31
- <tr>
32
- <tr>
33
- <td><strong>Integrations</strong></td>
34
- <td>
35
- <a href="https://decibri.com/docs/node/integrations/openai-realtime"><img src="https://img.shields.io/badge/OpenAI-cloud-blue" alt="OpenAI"></a>&nbsp;
36
- <a href="https://decibri.com/docs/node/integrations/deepgram"><img src="https://img.shields.io/badge/Deepgram-cloud-blue" alt="Deepgram"></a>&nbsp;
37
- <a href="https://decibri.com/docs/node/integrations/assemblyai"><img src="https://img.shields.io/badge/AssemblyAI-cloud-blue" alt="AssemblyAI"></a>&nbsp;
38
- <a href="https://decibri.com/docs/node/integrations/mistral-voxtral"><img src="https://img.shields.io/badge/Mistral-cloud-blue" alt="Mistral"></a>&nbsp;
39
- <a href="https://decibri.com/docs/node/integrations/aws-transcribe"><img src="https://img.shields.io/badge/AWS_Transcribe-cloud-blue" alt="AWS Transcribe"></a>&nbsp;
40
- <a href="https://decibri.com/docs/node/integrations/google-speech"><img src="https://img.shields.io/badge/Google_Speech-cloud-blue" alt="Google Speech-to-Text"></a>&nbsp;
41
- <a href="https://decibri.com/docs/node/integrations/azure-speech"><img src="https://img.shields.io/badge/Azure_Speech-cloud-blue" alt="Azure Speech-to-Text"></a>&nbsp;
42
- <a href="https://decibri.com/docs/node/integrations/sherpa-onnx-stt"><img src="https://img.shields.io/badge/Sherpa--ONNX-local-brightgreen" alt="Sherpa-ONNX"></a>&nbsp;
43
- <a href="https://decibri.com/docs/node/integrations/whisper-cpp"><img src="https://img.shields.io/badge/Whisper.cpp-local-brightgreen" alt="Whisper.cpp"></a>
44
- </td>
45
- </tr>
46
- </table>
47
- <!-- badges: end -->
7
+ Cross-platform audio capture, playback, and voice activity detection for Python, Rust, and Node.js.
8
+
9
+ <a href="https://pypi.org/project/decibri/"><img src="https://img.shields.io/pypi/v/decibri" alt="PyPI version"></a>&nbsp;
10
+ <a href="https://www.npmjs.com/package/decibri"><img src="https://img.shields.io/npm/v/decibri" alt="npm version"></a>&nbsp;
11
+ <a href="https://crates.io/crates/decibri"><img src="https://img.shields.io/crates/v/decibri" alt="crates.io version"></a>&nbsp;
12
+ <a href="https://github.com/decibri/decibri/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache_2.0-blue.svg" alt="Apache 2.0 License"></a>&nbsp;
13
+ <a href="https://decibri.com"><img src="https://img.shields.io/badge/Website-decibri.com-blue" alt="decibri.com"></a>&nbsp;
14
+ <a href="https://decibri.com/docs/"><img src="https://img.shields.io/badge/docs-passing-brightgreen" alt="Docs"></a>
15
+
48
16
  </div>
49
17
 
50
18
  ---
51
19
 
52
- ## Installation
20
+ ## What is decibri?
53
21
 
54
- ```bash
55
- npm install decibri
56
- ```
22
+ Decibri is a cross-platform audio engine for real-time speech and voice applications. One unified API across Python, Rust, Node.js, and browsers.
57
23
 
58
- 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.
24
+ Key features:
59
25
 
60
- Requires Node.js >= 18. TypeScript definitions are bundled.
26
+ - Microphone capture and speaker playback
27
+ - Voice activity detection (Silero or energy modes)
28
+ - Async and streaming APIs
29
+ - Cross-platform: Windows, macOS, Linux, browsers
30
+ - Available in Python, Node.js, and Rust
31
+ - Cloud and local speech-to-text integrations
61
32
 
62
- ---
33
+ To learn more, visit [decibri.com/docs/](https://decibri.com/docs/).
63
34
 
64
- ## Using from Rust
35
+ ## Installation
65
36
 
66
- Most users want the npm package above. If you're building a Rust
67
- application directly against the [`decibri`](https://crates.io/crates/decibri) crate on crates.io:
37
+ **Python** (recommended with [uv](https://docs.astral.sh/uv/)):
68
38
 
69
39
  ```bash
70
- cargo add decibri
40
+ uv pip install decibri
71
41
  ```
72
42
 
73
- The `vad` feature (enabled by default) uses ONNX Runtime via the
74
- [`ort`](https://crates.io/crates/ort) crate. From 3.1.0 onwards, `ort` is
75
- configured with `load-dynamic` by default, meaning ONNX Runtime is loaded
76
- from a shared library at runtime. Choose one of:
43
+ Or with pip:
44
+
45
+ ```bash
46
+ pip install decibri
47
+ ```
77
48
 
78
- - **Zero-config builds.** Opt into the download-binaries mode:
49
+ <br/>
79
50
 
80
- ```toml
81
- decibri = { version = "3.1", features = ["ort-download-binaries"], default-features = false }
82
- ```
51
+ **Node.js:**
83
52
 
84
- Add back any other features you need (`capture`, `output`, `vad`,
85
- `denoise`, `gain`). ORT is downloaded during `cargo build` and embedded
86
- in your binary (the 3.0.x behaviour).
53
+ ```bash
54
+ npm install decibri
55
+ ```
87
56
 
88
- - **Production deployments with bundled ORT.** Take default features,
89
- then either set `ORT_DYLIB_PATH=/path/to/libonnxruntime.{so,dylib,dll}`
90
- before first use, or call `ort::init_from(path).commit()` at startup.
91
- ONNX Runtime is initialized once per process. If your app creates
92
- multiple `SileroVad` instances with different paths, the first one
93
- wins and later paths are silently ignored. Pick one path and reuse it.
57
+ <br/>
94
58
 
95
- If you only need capture, output, or DSP (no Silero VAD), you won't pull
96
- in `ort` at all:
59
+ **Rust:**
97
60
 
98
- ```toml
99
- decibri = { version = "3.1", features = ["capture", "output"], default-features = false }
61
+ ```bash
62
+ cargo add decibri
100
63
  ```
101
64
 
102
- See the [`ort` crate linking docs](https://ort.pyke.io/setup/linking)
103
- for runtime-loading details.
104
-
105
- ---
65
+ <br/>
106
66
 
107
67
  ## Quick Start
108
68
 
109
- ### Capture audio
69
+ ### Python
110
70
 
111
- ```javascript
112
- const Decibri = require('decibri');
71
+ ```python
72
+ import decibri
113
73
 
114
- const mic = new Decibri({ sampleRate: 16000, channels: 1 });
115
- mic.on('data', (chunk) => { /* Buffer of Int16 PCM samples */ });
116
- setTimeout(() => mic.stop(), 5000);
74
+ with decibri.Microphone(sample_rate=16000) as mic:
75
+ for chunk in mic:
76
+ print(f"Got {len(chunk)} bytes")
77
+ break
117
78
  ```
118
79
 
119
- ### Play audio
80
+ Full Python guide: [here](bindings/python/README.md).
120
81
 
121
- ```javascript
122
- const { DecibriOutput } = require('decibri');
123
-
124
- const speaker = new DecibriOutput({ sampleRate: 16000, channels: 1 });
125
- speaker.write(pcmBuffer);
126
- speaker.end();
127
- ```
82
+ <br/>
128
83
 
129
- ### Browser capture
84
+ ### Node.js
130
85
 
131
86
  ```javascript
132
- import { Decibri } from 'decibri'; // browser entry via conditional export
87
+ const Decibri = require('decibri');
133
88
 
134
89
  const mic = new Decibri({ sampleRate: 16000 });
135
- mic.on('data', (chunk) => { /* Int16Array of PCM samples */ });
136
- await mic.start(); // requires user gesture in Safari
137
- ```
138
-
139
- ### Pipe capture to playback (echo)
140
-
141
- ```javascript
142
- const mic = new Decibri({ sampleRate: 16000, channels: 1 });
143
- const speaker = new DecibriOutput({ sampleRate: 16000, channels: 1 });
144
- mic.pipe(speaker);
90
+ mic.on('data', (chunk) => console.log(`Got ${chunk.length} bytes`));
91
+ setTimeout(() => mic.stop(), 5000);
145
92
  ```
146
93
 
147
- ---
148
-
149
- ## API: Decibri (Capture)
150
-
151
- ### `new Decibri(options?)`
152
-
153
- Creates a `Readable` stream that captures from the microphone.
154
-
155
- | Option | Type | Default | Description |
156
- | --- | --- | --- | --- |
157
- | `sampleRate` | number | `16000` | Samples per second (1000–384000) |
158
- | `channels` | number | `1` | Input channels (1–32) |
159
- | `framesPerBuffer` | number | `1600` | Frames per chunk (64–65536). At 16kHz mono, 1600 = 100ms = 3200 bytes |
160
- | `device` | number \| string | system default | Device index or case-insensitive name substring |
161
- | `format` | `'int16'` \| `'float32'` | `'int16'` | Sample encoding |
162
- | `vad` | boolean | `false` | Enable voice activity detection |
163
- | `vadMode` | `'energy'` \| `'silero'` | `'energy'` | VAD engine: RMS threshold or Silero ML model |
164
- | `vadThreshold` | number | `0.01` / `0.5` | Speech threshold. Default depends on vadMode |
165
- | `vadHoldoff` | number | `300` | Silence holdoff in ms |
166
-
167
- Standard `ReadableOptions` (e.g. `highWaterMark`) are also accepted.
168
-
169
- ### Methods
170
-
171
- | Method | Description |
172
- | --- | --- |
173
- | `mic.stop()` | Stop capture and end stream. Safe to call multiple times |
174
- | `Decibri.devices()` | List available input devices |
175
- | `Decibri.version()` | Version info: `{ decibri: '3.0.0', portaudio: 'cpal 0.17' }` |
176
-
177
- ### Properties
94
+ Full Node.js and browser guide: [here](npm/decibri/README.md).
178
95
 
179
- | Property | Type | Description |
180
- | --- | --- | --- |
181
- | `mic.isOpen` | boolean | `true` while capturing |
96
+ <br/>
182
97
 
183
- ### Events
98
+ ### Rust
184
99
 
185
- | Event | Payload | Description |
186
- | --- | --- | --- |
187
- | `'data'` | `Buffer` | Audio chunk (Int16 LE or Float32 LE) |
188
- | `'backpressure'` | - | Internal buffer full, consumer too slow |
189
- | `'speech'` | - | VAD: audio crosses threshold |
190
- | `'silence'` | - | VAD: audio below threshold for `vadHoldoff` ms |
191
- | `'end'` | - | Stream ended |
192
- | `'error'` | `Error` | An error occurred |
100
+ ```rust
101
+ use decibri::capture::{AudioCapture, CaptureConfig};
193
102
 
194
- ---
195
-
196
- ## API: DecibriOutput (Playback)
197
-
198
- ### `new DecibriOutput(options?)`
199
-
200
- Creates a `Writable` stream for speaker playback.
201
-
202
- | Option | Type | Default | Description |
203
- | --- | --- | --- | --- |
204
- | `sampleRate` | number | `16000` | Playback sample rate (1000–384000) |
205
- | `channels` | number | `1` | Output channels (1–32) |
206
- | `format` | `'int16'` \| `'float32'` | `'int16'` | Sample encoding of incoming data |
207
- | `device` | number \| string | system default | Output device index or name substring |
208
-
209
- Standard `WritableOptions` (e.g. `highWaterMark`) are also accepted.
210
-
211
- | Method / Property | Description |
212
- | --- | --- |
213
- | `speaker.write(chunk)` | Write PCM data for playback |
214
- | `speaker.end()` | Signal end. Drains remaining audio, then emits `'finish'` |
215
- | `speaker.stop()` | Immediate stop. Discards remaining audio |
216
- | `speaker.isPlaying` | `true` while audio is being output |
217
- | `DecibriOutput.devices()` | List available output devices |
218
- | `DecibriOutput.version()` | Same as `Decibri.version()` |
219
-
220
- ---
221
-
222
- ## API: Browser
103
+ fn main() -> Result<(), Box<dyn std::error::Error>> {
104
+ let capture = AudioCapture::new(CaptureConfig::default())?;
105
+ let stream = capture.start()?;
106
+ while let Ok(Some(chunk)) = stream.next_chunk(None) {
107
+ println!("Got {} bytes", chunk.data.len());
108
+ }
109
+ Ok(())
110
+ }
111
+ ```
223
112
 
224
- The browser API uses `getUserMedia` and `AudioWorklet`. It differs from the Node.js API because browser audio is fundamentally async.
113
+ Full Rust guide: [here](crates/decibri/README.md).
225
114
 
226
- ### `new Decibri(options?)`
115
+ <br/>
227
116
 
228
- Same options as Node.js, plus:
117
+ ## Platform Support
229
118
 
230
- | Option | Type | Default | Description |
231
- | --- | --- | --- | --- |
232
- | `device` | string | system default | Device ID from `Decibri.devices()` (not index) |
233
- | `echoCancellation` | boolean | `true` | Browser echo cancellation |
234
- | `noiseSuppression` | boolean | `true` | Browser noise suppression |
235
- | `workletUrl` | string | inline blob | Custom worklet URL for strict CSP |
119
+ Supports:
236
120
 
237
- ### Key differences from Node.js
121
+ - Windows x64
122
+ - macOS arm64
123
+ - Linux x64
124
+ - Linux arm64
238
125
 
239
- | Aspect | Node.js | Browser |
240
- | --- | --- | --- |
241
- | Start | Automatic on first read | `await mic.start()` |
242
- | Base class | `Readable` stream | Custom `Emitter` |
243
- | Data type | `Buffer` | `Int16Array` / `Float32Array` |
244
- | `devices()` | Sync, returns array | Async, returns `Promise` |
245
- | Sample rate | Direct via cpal | Resampled from native rate |
246
-
247
- ---
126
+ <br/>
248
127
 
249
128
  ## Voice Activity Detection
250
129
 
251
- ### Energy mode (default)
252
-
253
- Lightweight RMS energy threshold. No model required.
130
+ Decibri ships two VAD modes:
254
131
 
255
- ```javascript
256
- const mic = new Decibri({ vad: true, vadThreshold: 0.01 });
257
- mic.on('speech', () => console.log('speaking'));
258
- mic.on('silence', () => console.log('silent'));
259
- ```
260
-
261
- ### Silero mode
132
+ - **Energy mode**: lightweight RMS threshold.
133
+ - **Silero mode**: ML-based detection using the Silero VAD v5 ONNX model. More accurate, especially in noisy environments. The model (~2.3 MB) is bundled; no downloads or API keys required.
262
134
 
263
- ML-based detection using the Silero VAD v5 ONNX model. More accurate than energy mode, especially in noisy environments.
135
+ ```python
136
+ import decibri
264
137
 
265
- ```javascript
266
- const mic = new Decibri({ vad: true, vadMode: 'silero', vadThreshold: 0.5 });
267
- mic.on('speech', () => console.log('speaking'));
268
- mic.on('silence', () => console.log('silent'));
138
+ with decibri.Microphone(sample_rate=16000, vad="silero", vad_threshold=0.5) as mic:
139
+ for chunk in mic:
140
+ print(f"VAD score {mic.vad_score}; speaking={mic.is_speaking}")
141
+ break
269
142
  ```
270
143
 
271
- The Silero model (~2MB) ships inside the npm package. No downloads or API keys required.
144
+ The same VAD API is available in Node.js and Rust. Language-specific examples and tuning advice live in each binding's README.
272
145
 
273
- ---
146
+ <br/>
274
147
 
275
- ## Device Selection
148
+ ## Integrations
276
149
 
277
- ```javascript
278
- // System default
279
- const mic = new Decibri();
280
-
281
- // By name (case-insensitive substring match)
282
- const mic = new Decibri({ device: 'USB' });
150
+ Decibri pipes microphone audio directly into cloud and local speech services. Full guides at [decibri.com/docs/integrations](https://decibri.com/docs/integrations).
283
151
 
284
- // By index
285
- const devices = Decibri.devices();
286
- const mic = new Decibri({ device: devices[1].index });
287
- ```
288
-
289
- ```javascript
290
- Decibri.devices();
291
- // [
292
- // { index: 0, name: 'Microphone', maxInputChannels: 2, defaultSampleRate: 48000, isDefault: true },
293
- // { index: 1, name: 'USB Headset', maxInputChannels: 1, defaultSampleRate: 44100, isDefault: false }
294
- // ]
295
- ```
152
+ | Provider | Environment | STT | TTS | VAD | KWS |
153
+ | :--- | :---: | :---: | :---: | :---: | :---: |
154
+ | OpenAI Realtime | Cloud | ✅ | ✅ | | |
155
+ | Deepgram | Cloud | ✅ | ✅ | | |
156
+ | AssemblyAI | Cloud | ✅ | | | |
157
+ | Mistral Voxtral | Cloud | ✅ | | | |
158
+ | AWS Transcribe | Cloud | ✅ | | | |
159
+ | Google Speech | Cloud | ✅ | ✅ | | |
160
+ | Azure Speech | Cloud | ✅ | ✅ | | |
161
+ | Sherpa-ONNX | Local | ✅ | ✅ | ✅ | ✅ |
162
+ | Whisper.cpp | Local | ✅ | | | |
296
163
 
297
- ---
164
+ <br/>
298
165
 
299
- ## Examples
166
+ ## Architecture
300
167
 
301
- Runnable examples are in [`examples/`](examples/).
168
+ Decibri is built on a single Rust core. The same audio engine powers all three language bindings, ensuring consistent behavior regardless of which language you use.
302
169
 
303
- ```bash
304
- # Capture to WAV file (no dependencies)
305
- node examples/wav-capture.js
170
+ Python and Node.js install pre-built native binaries for your platform. Browsers run the same API via a JavaScript implementation that ships inside the npm package.
306
171
 
307
- # Stream to WebSocket (requires: npm install ws)
308
- node examples/websocket-server.js # terminal 1
309
- node examples/websocket-stream.js # terminal 2
310
- ```
172
+ <br/>
311
173
 
312
- Integration guides for OpenAI, Deepgram, AssemblyAI, and other providers are at [decibri.com/docs](https://decibri.com/docs/).
174
+ ## Contributing
313
175
 
314
- ---
176
+ [Issues](https://github.com/decibri/decibri/issues) and PRs welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup.
315
177
 
316
- ## Platform Support
317
-
318
- | Platform | Architecture | Audio Backend |
319
- | --- | --- | --- |
320
- | Windows | x64 | WASAPI |
321
- | macOS | arm64 | CoreAudio |
322
- | Linux | x64 | ALSA |
323
- | Linux | arm64 | ALSA |
324
- | Browser | - | Web Audio API (AudioWorklet) |
325
-
326
- ---
327
-
328
- ## How It Works
329
-
330
- decibri is a Rust library using [cpal](https://github.com/RustAudio/cpal) for cross-platform audio I/O. The Rust core compiles to a Node.js native addon via [napi-rs](https://napi.rs/) and ships pre-built binaries for each platform. Browser support uses a JavaScript AudioWorklet implementation with the same event-driven API.
331
-
332
- 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.
333
-
334
- ---
178
+ <br/>
335
179
 
336
180
  ## License
337
181
 
338
- Apache-2.0 © [decibri](https://github.com/decibri)
182
+ Apache-2.0 © 2026 [Decibri](https://github.com/decibri).
@@ -0,0 +1,48 @@
1
+ 'use strict';
2
+ // Captures audio for DURATION_MS and writes a valid WAV file.
3
+ // No external dependencies. Uses Node.js built-ins only.
4
+ // Usage (after npm install decibri): node node_modules/decibri/examples/wav-capture.js
5
+ // Usage (from repo clone): node npm/decibri/examples/wav-capture.js
6
+
7
+ const fs = require('fs');
8
+ const Decibri = require('decibri');
9
+
10
+ const SAMPLE_RATE = 16000;
11
+ const CHANNELS = 1;
12
+ const BITS_PER_SAMPLE = 16;
13
+ const DURATION_MS = 5000;
14
+
15
+ const mic = new Decibri({ sampleRate: SAMPLE_RATE, channels: CHANNELS });
16
+ const chunks = [];
17
+
18
+ mic.on('data', (chunk) => chunks.push(chunk));
19
+ mic.on('error', (err) => { console.error('Mic error:', err.message); process.exit(1); });
20
+
21
+ console.log(`Recording for ${DURATION_MS / 1000} seconds...`);
22
+
23
+ setTimeout(() => {
24
+ mic.stop();
25
+
26
+ const pcm = Buffer.concat(chunks);
27
+ const header = buildWavHeader(pcm.length, SAMPLE_RATE, CHANNELS, BITS_PER_SAMPLE);
28
+ const out = fs.createWriteStream('capture.wav');
29
+ out.write(header);
30
+ out.end(pcm);
31
+ out.on('finish', () =>
32
+ console.log(`Wrote capture.wav (${(pcm.length / 1024).toFixed(1)} KB PCM, ${DURATION_MS / 1000}s)`)
33
+ );
34
+ }, DURATION_MS);
35
+
36
+ function buildWavHeader(dataBytes, sampleRate, channels, bitsPerSample) {
37
+ const byteRate = sampleRate * channels * bitsPerSample / 8;
38
+ const blockAlign = channels * bitsPerSample / 8;
39
+ const buf = Buffer.alloc(44);
40
+ buf.write('RIFF', 0); buf.writeUInt32LE(36 + dataBytes, 4);
41
+ buf.write('WAVE', 8); buf.write('fmt ', 12);
42
+ buf.writeUInt32LE(16, 16); buf.writeUInt16LE(1, 20); // PCM
43
+ buf.writeUInt16LE(channels, 22); buf.writeUInt32LE(sampleRate, 24);
44
+ buf.writeUInt32LE(byteRate, 28); buf.writeUInt16LE(blockAlign, 32);
45
+ buf.writeUInt16LE(bitsPerSample,34);
46
+ buf.write('data', 36); buf.writeUInt32LE(dataBytes, 40);
47
+ return buf;
48
+ }
@@ -0,0 +1,29 @@
1
+ 'use strict';
2
+ // Minimal WebSocket server that receives raw PCM chunks and logs byte counts.
3
+ // Use this to test examples/websocket-stream.js.
4
+ // Requires: npm install ws
5
+ // Usage (after npm install decibri): node node_modules/decibri/examples/websocket-server.js
6
+ // Usage (from repo clone): node npm/decibri/examples/websocket-server.js
7
+
8
+ const { WebSocketServer } = require('ws');
9
+
10
+ const wss = new WebSocketServer({ port: 8080 });
11
+ console.log('Listening on ws://localhost:8080');
12
+
13
+ wss.on('connection', (ws) => {
14
+ console.log('Client connected');
15
+ let total = 0;
16
+
17
+ ws.on('message', (data) => {
18
+ total += data.length;
19
+ process.stdout.write(`\rReceived ${(total / 1024).toFixed(1)} KB`);
20
+ });
21
+
22
+ ws.on('close', () => {
23
+ console.log(`\nClient disconnected. Total received: ${(total / 1024).toFixed(1)} KB`);
24
+ });
25
+
26
+ ws.on('error', (err) => {
27
+ console.error('\nWebSocket error:', err.message);
28
+ });
29
+ });
@@ -0,0 +1,44 @@
1
+ 'use strict';
2
+ // Streams raw PCM audio to a WebSocket server.
3
+ // Requires: npm install ws
4
+ // Usage (after npm install decibri): node node_modules/decibri/examples/websocket-stream.js [ws://localhost:8080]
5
+ // Usage (from repo clone): node npm/decibri/examples/websocket-stream.js [ws://localhost:8080]
6
+
7
+ const { WebSocket } = require('ws');
8
+ const Decibri = require('decibri');
9
+
10
+ const url = process.argv[2] || 'ws://localhost:8080';
11
+ const ws = new WebSocket(url);
12
+ const mic = new Decibri({ sampleRate: 16000, channels: 1 });
13
+
14
+ ws.on('open', () => {
15
+ console.log(`Connected to ${url}, streaming audio. Ctrl+C to stop.`);
16
+
17
+ mic.on('data', (chunk) => {
18
+ if (ws.readyState === WebSocket.OPEN) ws.send(chunk);
19
+ });
20
+
21
+ mic.on('error', (err) => {
22
+ console.error('Mic error:', err.message);
23
+ ws.close();
24
+ });
25
+
26
+ mic.on('backpressure', () => {
27
+ console.warn('Backpressure: consumer too slow');
28
+ });
29
+ });
30
+
31
+ ws.on('close', () => {
32
+ mic.stop();
33
+ console.log('WebSocket closed.');
34
+ });
35
+
36
+ ws.on('error', (err) => {
37
+ console.error('WebSocket error:', err.message);
38
+ mic.stop();
39
+ });
40
+
41
+ process.on('SIGINT', () => {
42
+ mic.stop();
43
+ ws.close();
44
+ });
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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
80
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
96
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
117
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
133
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
166
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
185
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
201
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
217
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
237
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
253
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
274
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
290
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
308
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
324
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
342
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
358
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
376
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
392
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
410
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
426
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
479
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
495
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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.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 3.4.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
511
+ if (bindingPackageVersion !== '3.4.1' && 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.1 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": "3.4.0",
3
+ "version": "3.4.1",
4
4
  "description": "Cross-platform audio capture, output, and processing for Node.js and browsers",
5
5
  "main": "src/decibri.js",
6
6
  "types": "src/decibri.d.ts",
@@ -64,15 +64,16 @@
64
64
  "files": [
65
65
  "src/",
66
66
  "models/",
67
+ "examples/",
67
68
  "index.js",
68
69
  "index.d.ts",
69
70
  "README.md"
70
71
  ],
71
72
  "optionalDependencies": {
72
- "@decibri/decibri-win32-x64-msvc": "3.4.0",
73
- "@decibri/decibri-darwin-arm64": "3.4.0",
74
- "@decibri/decibri-linux-x64-gnu": "3.4.0",
75
- "@decibri/decibri-linux-arm64-gnu": "3.4.0"
73
+ "@decibri/decibri-win32-x64-msvc": "3.4.1",
74
+ "@decibri/decibri-darwin-arm64": "3.4.1",
75
+ "@decibri/decibri-linux-x64-gnu": "3.4.1",
76
+ "@decibri/decibri-linux-arm64-gnu": "3.4.1"
76
77
  },
77
78
  "devDependencies": {
78
79
  "@napi-rs/cli": "^3.0.0"