decibri 3.3.2 → 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,337 +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://www.npmjs.com/package/decibri"><img src="https://img.shields.io/npm/v/decibri" alt="npm version"></a>&nbsp;
15
- <a href="https://crates.io/crates/decibri"><img src="https://img.shields.io/crates/v/decibri" alt="crates.io version"></a>&nbsp;
16
- <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;
17
- <a href="https://decibri.com"><img src="https://img.shields.io/badge/Website-decibri.com-blue" alt="decibri.com"></a>&nbsp;
18
- <a href="https://decibri.com/docs/"><img src="https://img.shields.io/badge/docs-passing-brightgreen" alt="Docs"></a>
19
- </td>
20
- </tr>
21
- <tr>
22
- <td><strong>Binaries</strong></td>
23
- <td>
24
- <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;
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%20aarch64-apple-darwin&label=macOS%20ARM64&logo=apple" alt="macOS ARM64"></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%20x86_64-unknown-linux-gnu&label=Linux%20x64&logo=linux&logoColor=white" alt="Linux x64"></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%20aarch64-unknown-linux-gnu&label=Linux%20ARM64&logo=linux&logoColor=white" alt="Linux ARM64"></a>
28
- </td>
29
- </tr>
30
- <tr>
31
- <tr>
32
- <td><strong>Integrations</strong></td>
33
- <td>
34
- <a href="https://decibri.com/docs/node/integrations/openai-realtime"><img src="https://img.shields.io/badge/OpenAI-cloud-blue" alt="OpenAI"></a>&nbsp;
35
- <a href="https://decibri.com/docs/node/integrations/deepgram"><img src="https://img.shields.io/badge/Deepgram-cloud-blue" alt="Deepgram"></a>&nbsp;
36
- <a href="https://decibri.com/docs/node/integrations/assemblyai"><img src="https://img.shields.io/badge/AssemblyAI-cloud-blue" alt="AssemblyAI"></a>&nbsp;
37
- <a href="https://decibri.com/docs/node/integrations/mistral-voxtral"><img src="https://img.shields.io/badge/Mistral-cloud-blue" alt="Mistral"></a>&nbsp;
38
- <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;
39
- <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;
40
- <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;
41
- <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;
42
- <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>
43
- </td>
44
- </tr>
45
- </table>
46
- <!-- 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
+
47
16
  </div>
48
17
 
49
18
  ---
50
19
 
51
- ## Installation
20
+ ## What is decibri?
52
21
 
53
- ```bash
54
- npm install decibri
55
- ```
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.
56
23
 
57
- 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:
58
25
 
59
- 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
60
32
 
61
- ---
33
+ To learn more, visit [decibri.com/docs/](https://decibri.com/docs/).
62
34
 
63
- ## Using from Rust
35
+ ## Installation
64
36
 
65
- Most users want the npm package above. If you're building a Rust
66
- application directly against the [`decibri`](https://crates.io/crates/decibri) crate on crates.io:
37
+ **Python** (recommended with [uv](https://docs.astral.sh/uv/)):
67
38
 
68
39
  ```bash
69
- cargo add decibri
40
+ uv pip install decibri
70
41
  ```
71
42
 
72
- The `vad` feature (enabled by default) uses ONNX Runtime via the
73
- [`ort`](https://crates.io/crates/ort) crate. From 3.1.0 onwards, `ort` is
74
- configured with `load-dynamic` by default, meaning ONNX Runtime is loaded
75
- from a shared library at runtime. Choose one of:
43
+ Or with pip:
44
+
45
+ ```bash
46
+ pip install decibri
47
+ ```
76
48
 
77
- - **Zero-config builds.** Opt into the download-binaries mode:
49
+ <br/>
78
50
 
79
- ```toml
80
- decibri = { version = "3.1", features = ["ort-download-binaries"], default-features = false }
81
- ```
51
+ **Node.js:**
82
52
 
83
- Add back any other features you need (`capture`, `output`, `vad`,
84
- `denoise`, `gain`). ORT is downloaded during `cargo build` and embedded
85
- in your binary (the 3.0.x behaviour).
53
+ ```bash
54
+ npm install decibri
55
+ ```
86
56
 
87
- - **Production deployments with bundled ORT.** Take default features,
88
- then either set `ORT_DYLIB_PATH=/path/to/libonnxruntime.{so,dylib,dll}`
89
- before first use, or call `ort::init_from(path).commit()` at startup.
90
- ONNX Runtime is initialized once per process. If your app creates
91
- multiple `SileroVad` instances with different paths, the first one
92
- wins and later paths are silently ignored. Pick one path and reuse it.
57
+ <br/>
93
58
 
94
- If you only need capture, output, or DSP (no Silero VAD), you won't pull
95
- in `ort` at all:
59
+ **Rust:**
96
60
 
97
- ```toml
98
- decibri = { version = "3.1", features = ["capture", "output"], default-features = false }
61
+ ```bash
62
+ cargo add decibri
99
63
  ```
100
64
 
101
- See the [`ort` crate linking docs](https://ort.pyke.io/setup/linking)
102
- for runtime-loading details.
103
-
104
- ---
65
+ <br/>
105
66
 
106
67
  ## Quick Start
107
68
 
108
- ### Capture audio
69
+ ### Python
109
70
 
110
- ```javascript
111
- const Decibri = require('decibri');
71
+ ```python
72
+ import decibri
112
73
 
113
- const mic = new Decibri({ sampleRate: 16000, channels: 1 });
114
- mic.on('data', (chunk) => { /* Buffer of Int16 PCM samples */ });
115
- 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
116
78
  ```
117
79
 
118
- ### Play audio
80
+ Full Python guide: [here](bindings/python/README.md).
119
81
 
120
- ```javascript
121
- const { DecibriOutput } = require('decibri');
122
-
123
- const speaker = new DecibriOutput({ sampleRate: 16000, channels: 1 });
124
- speaker.write(pcmBuffer);
125
- speaker.end();
126
- ```
82
+ <br/>
127
83
 
128
- ### Browser capture
84
+ ### Node.js
129
85
 
130
86
  ```javascript
131
- import { Decibri } from 'decibri'; // browser entry via conditional export
87
+ const Decibri = require('decibri');
132
88
 
133
89
  const mic = new Decibri({ sampleRate: 16000 });
134
- mic.on('data', (chunk) => { /* Int16Array of PCM samples */ });
135
- await mic.start(); // requires user gesture in Safari
136
- ```
137
-
138
- ### Pipe capture to playback (echo)
139
-
140
- ```javascript
141
- const mic = new Decibri({ sampleRate: 16000, channels: 1 });
142
- const speaker = new DecibriOutput({ sampleRate: 16000, channels: 1 });
143
- mic.pipe(speaker);
90
+ mic.on('data', (chunk) => console.log(`Got ${chunk.length} bytes`));
91
+ setTimeout(() => mic.stop(), 5000);
144
92
  ```
145
93
 
146
- ---
147
-
148
- ## API: Decibri (Capture)
149
-
150
- ### `new Decibri(options?)`
151
-
152
- Creates a `Readable` stream that captures from the microphone.
153
-
154
- | Option | Type | Default | Description |
155
- | --- | --- | --- | --- |
156
- | `sampleRate` | number | `16000` | Samples per second (1000–384000) |
157
- | `channels` | number | `1` | Input channels (1–32) |
158
- | `framesPerBuffer` | number | `1600` | Frames per chunk (64–65536). At 16kHz mono, 1600 = 100ms = 3200 bytes |
159
- | `device` | number \| string | system default | Device index or case-insensitive name substring |
160
- | `format` | `'int16'` \| `'float32'` | `'int16'` | Sample encoding |
161
- | `vad` | boolean | `false` | Enable voice activity detection |
162
- | `vadMode` | `'energy'` \| `'silero'` | `'energy'` | VAD engine: RMS threshold or Silero ML model |
163
- | `vadThreshold` | number | `0.01` / `0.5` | Speech threshold. Default depends on vadMode |
164
- | `vadHoldoff` | number | `300` | Silence holdoff in ms |
165
-
166
- Standard `ReadableOptions` (e.g. `highWaterMark`) are also accepted.
167
-
168
- ### Methods
169
-
170
- | Method | Description |
171
- | --- | --- |
172
- | `mic.stop()` | Stop capture and end stream. Safe to call multiple times |
173
- | `Decibri.devices()` | List available input devices |
174
- | `Decibri.version()` | Version info: `{ decibri: '3.0.0', portaudio: 'cpal 0.17' }` |
175
-
176
- ### Properties
94
+ Full Node.js and browser guide: [here](npm/decibri/README.md).
177
95
 
178
- | Property | Type | Description |
179
- | --- | --- | --- |
180
- | `mic.isOpen` | boolean | `true` while capturing |
96
+ <br/>
181
97
 
182
- ### Events
98
+ ### Rust
183
99
 
184
- | Event | Payload | Description |
185
- | --- | --- | --- |
186
- | `'data'` | `Buffer` | Audio chunk (Int16 LE or Float32 LE) |
187
- | `'backpressure'` | - | Internal buffer full, consumer too slow |
188
- | `'speech'` | - | VAD: audio crosses threshold |
189
- | `'silence'` | - | VAD: audio below threshold for `vadHoldoff` ms |
190
- | `'end'` | - | Stream ended |
191
- | `'error'` | `Error` | An error occurred |
100
+ ```rust
101
+ use decibri::capture::{AudioCapture, CaptureConfig};
192
102
 
193
- ---
194
-
195
- ## API: DecibriOutput (Playback)
196
-
197
- ### `new DecibriOutput(options?)`
198
-
199
- Creates a `Writable` stream for speaker playback.
200
-
201
- | Option | Type | Default | Description |
202
- | --- | --- | --- | --- |
203
- | `sampleRate` | number | `16000` | Playback sample rate (1000–384000) |
204
- | `channels` | number | `1` | Output channels (1–32) |
205
- | `format` | `'int16'` \| `'float32'` | `'int16'` | Sample encoding of incoming data |
206
- | `device` | number \| string | system default | Output device index or name substring |
207
-
208
- Standard `WritableOptions` (e.g. `highWaterMark`) are also accepted.
209
-
210
- | Method / Property | Description |
211
- | --- | --- |
212
- | `speaker.write(chunk)` | Write PCM data for playback |
213
- | `speaker.end()` | Signal end. Drains remaining audio, then emits `'finish'` |
214
- | `speaker.stop()` | Immediate stop. Discards remaining audio |
215
- | `speaker.isPlaying` | `true` while audio is being output |
216
- | `DecibriOutput.devices()` | List available output devices |
217
- | `DecibriOutput.version()` | Same as `Decibri.version()` |
218
-
219
- ---
220
-
221
- ## 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
+ ```
222
112
 
223
- 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).
224
114
 
225
- ### `new Decibri(options?)`
115
+ <br/>
226
116
 
227
- Same options as Node.js, plus:
117
+ ## Platform Support
228
118
 
229
- | Option | Type | Default | Description |
230
- | --- | --- | --- | --- |
231
- | `device` | string | system default | Device ID from `Decibri.devices()` (not index) |
232
- | `echoCancellation` | boolean | `true` | Browser echo cancellation |
233
- | `noiseSuppression` | boolean | `true` | Browser noise suppression |
234
- | `workletUrl` | string | inline blob | Custom worklet URL for strict CSP |
119
+ Supports:
235
120
 
236
- ### Key differences from Node.js
121
+ - Windows x64
122
+ - macOS arm64
123
+ - Linux x64
124
+ - Linux arm64
237
125
 
238
- | Aspect | Node.js | Browser |
239
- | --- | --- | --- |
240
- | Start | Automatic on first read | `await mic.start()` |
241
- | Base class | `Readable` stream | Custom `Emitter` |
242
- | Data type | `Buffer` | `Int16Array` / `Float32Array` |
243
- | `devices()` | Sync, returns array | Async, returns `Promise` |
244
- | Sample rate | Direct via cpal | Resampled from native rate |
245
-
246
- ---
126
+ <br/>
247
127
 
248
128
  ## Voice Activity Detection
249
129
 
250
- ### Energy mode (default)
251
-
252
- Lightweight RMS energy threshold. No model required.
130
+ Decibri ships two VAD modes:
253
131
 
254
- ```javascript
255
- const mic = new Decibri({ vad: true, vadThreshold: 0.01 });
256
- mic.on('speech', () => console.log('speaking'));
257
- mic.on('silence', () => console.log('silent'));
258
- ```
259
-
260
- ### 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.
261
134
 
262
- ML-based detection using the Silero VAD v5 ONNX model. More accurate than energy mode, especially in noisy environments.
135
+ ```python
136
+ import decibri
263
137
 
264
- ```javascript
265
- const mic = new Decibri({ vad: true, vadMode: 'silero', vadThreshold: 0.5 });
266
- mic.on('speech', () => console.log('speaking'));
267
- 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
268
142
  ```
269
143
 
270
- 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.
271
145
 
272
- ---
146
+ <br/>
273
147
 
274
- ## Device Selection
148
+ ## Integrations
275
149
 
276
- ```javascript
277
- // System default
278
- const mic = new Decibri();
279
-
280
- // By name (case-insensitive substring match)
281
- 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).
282
151
 
283
- // By index
284
- const devices = Decibri.devices();
285
- const mic = new Decibri({ device: devices[1].index });
286
- ```
287
-
288
- ```javascript
289
- Decibri.devices();
290
- // [
291
- // { index: 0, name: 'Microphone', maxInputChannels: 2, defaultSampleRate: 48000, isDefault: true },
292
- // { index: 1, name: 'USB Headset', maxInputChannels: 1, defaultSampleRate: 44100, isDefault: false }
293
- // ]
294
- ```
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 | ✅ | | | |
295
163
 
296
- ---
164
+ <br/>
297
165
 
298
- ## Examples
166
+ ## Architecture
299
167
 
300
- 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.
301
169
 
302
- ```bash
303
- # Capture to WAV file (no dependencies)
304
- 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.
305
171
 
306
- # Stream to WebSocket (requires: npm install ws)
307
- node examples/websocket-server.js # terminal 1
308
- node examples/websocket-stream.js # terminal 2
309
- ```
172
+ <br/>
310
173
 
311
- Integration guides for OpenAI, Deepgram, AssemblyAI, and other providers are at [decibri.com/docs](https://decibri.com/docs/).
174
+ ## Contributing
312
175
 
313
- ---
176
+ [Issues](https://github.com/decibri/decibri/issues) and PRs welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup.
314
177
 
315
- ## Platform Support
316
-
317
- | Platform | Architecture | Audio Backend |
318
- | --- | --- | --- |
319
- | Windows | x64 | WASAPI |
320
- | macOS | arm64 | CoreAudio |
321
- | Linux | x64 | ALSA |
322
- | Linux | arm64 | ALSA |
323
- | Browser | - | Web Audio API (AudioWorklet) |
324
-
325
- ---
326
-
327
- ## How It Works
328
-
329
- 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.
330
-
331
- 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.
332
-
333
- ---
178
+ <br/>
334
179
 
335
180
  ## License
336
181
 
337
- 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.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.3.2 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.3.2",
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.3.2",
73
- "@decibri/decibri-darwin-arm64": "3.3.2",
74
- "@decibri/decibri-linux-x64-gnu": "3.3.2",
75
- "@decibri/decibri-linux-arm64-gnu": "3.3.2"
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"