@nanoya-biz/rkd-noise-suppression (0.1.6)
Installation
@nanoya-biz:registry=npm config set @nanoya-biz:registry=npm install @nanoya-biz/rkd-noise-suppression@0.1.6"@nanoya-biz/rkd-noise-suppression": "0.1.6"About this package
rkd-noise-suppression-napi
Node.js native bindings for rkd-noise-suppression-core. Loadable from
Electron, Node, or any Node-compatible runtime via N-API.
Status — Phase 3a-1
- ✓ Builds for the developer's host platform via
napi build --platform --release - ✓ Exposes
DenoiserwithprocessFrame(input: Float32Array, output: Float32Array),reset(),frameSizeAt48k - ✓ Smoke test in
test.mjscovers passthrough + real-model paths - ✓ Real-model SNR validated at -18.1 dB attenuation in silent regions (synthesized noisy signal)
- ⨯ Multi-platform CI matrix → Phase 3a-2
- ⨯ Bundled
onnxruntimeshared lib → Phase 3a-2 (today:ORT_DYLIB_PATHenv var) - ⨯ npm publish → Phase 3a-2
Build
cd crates/napi
npm install
npm run build # release build
npm run build:debug
Produces rkd-noise-suppression.<platform-triple>.node plus auto-generated
index.js and index.d.ts.
Test
Passthrough only (no model required):
npm test
With real model — requires models/dfn2/ populated and ORT_DYLIB_PATH set
(see models/README.md at the workspace root):
ORT_DYLIB_PATH=<path-to-onnxruntime> npm test
The Denoiser constructor reads ORT_DYLIB_PATH at startup and pre-loads
the ONNX Runtime library before deepfilter-rt's bare-name init runs.
On Windows this avoids picking up stale onnxruntime.dll from System32.
Use from Node / Electron
const { Denoiser } = require("rkd-noise-suppression");
// Passthrough (no real inference; output ≈ input)
const passthrough = new Denoiser(null, 48000);
// Real DFN2 inference (set ORT_DYLIB_PATH first)
const real = new Denoiser("/abs/path/to/models/dfn2", 48000);
const input = new Float32Array(real.frameSizeAt48k); // 480 samples
const output = new Float32Array(real.frameSizeAt48k);
// fill input with mic samples...
real.processFrame(input, output);
// output now contains denoised samples
The 480-sample frame size is fixed (10 ms @ 48 kHz). Buffer arbitrary-length inputs to align on frame boundaries — same contract as the Rust core. For an Electron app, run the napi binding on a Worker thread; the audio capture worklet pushes 128-sample quanta into a shared ring (Phase 3c).
Sample rate
Currently sampleRate must equal 48000. processFrame is only valid at
48 kHz; non-48k pipelines must resample first (e.g. via Web Audio's
AudioContext({ sampleRate: 48000 })). Exposing the Rust core's
arbitrary-rate process() is a future enhancement.
License
Apache-2.0. See workspace root.
Dependencies
Development dependencies
| ID | Version |
|---|---|
| @napi-rs/cli | ^2.18.0 |
Optional dependencies
| ID | Version |
|---|---|
| @nanoya-biz/rkd-noise-suppression-darwin-arm64 | 0.1.6 |
| @nanoya-biz/rkd-noise-suppression-darwin-x64 | 0.1.6 |
| @nanoya-biz/rkd-noise-suppression-linux-x64-gnu | 0.1.6 |
| @nanoya-biz/rkd-noise-suppression-win32-x64-msvc | 0.1.6 |