Phonlet Wake for Node.js.

A native add-on with the engine built in, for services, tools, and Linux apps.

The Node.js SDK is a Node-API add-on with the engine compiled in. Installing it compiles nothing and downloads nothing. It is tested on Node 24 on Linux x64.

Example

wake.mjs
import { Wake } from '@phonlet-ai/wake-node'; // A phrase is its pronunciations and two calibrated thresholds.const heyKettle = {  name: 'hey kettle',  pronunciations: [[16, 13, 20, 11, 31, 3, 21]],  threshold_loose: -1.21875,  threshold_strict: -0.8740234375,  endpoint: true,}; // One engine and one model for every phrase.const wake = await Wake.create({  model: 'en-1.pwake',  keywords: [heyKettle],  sensitivity: 0.5,}); // Push 16 kHz mono Int16 PCM in chunks of any size.export function onAudio(pcm) {  for (const hit of wake.process(pcm)) {    console.log('Wake word:', hit.keyword);  }} // Release native memory when you are done.export function close() {  wake.close();}

How it works

  1. Make a keyword file for your phrases with the generator: each phrase gets its pronunciations and its loose and strict thresholds, calibrated for this model.
  2. Create one Wake with the model and your phrases, each with its own sensitivity if you like. Pass the keyword file from the generator as a path, as the parsed object, or as phrases written in code; a file that names its model is checked against it by SHA-256.
  3. Call process() with Int16Array chunks; it returns the detections in that chunk.
  4. Call close() when you are done. finish() and close() are safe to call twice.

Good to know

  • Audio is mono, 16 kHz, signed 16-bit PCM. Push chunks of any size; the engine buffers them into 512-sample (32 ms) frames.
  • A phrase always comes with its thresholds: they are calibrated for that phrase and that model, and the engine needs them to decide when it was said. The generator makes them from text (phonletai.com/generator, or the wake-threshold command) and writes them into your keyword file.
  • process() is synchronous. Run the instance in a worker thread if your application cannot block the event loop.
  • Each detection carries the phrase, its index, the frame, and a timestamp at the end of the frame.
  • CommonJS and ES modules expose the same exports, with TypeScript declarations included.

Get the Node.js SDK

The Node.js SDK, the en-1 model and the threshold generator are in release v0.1.0, free for non-commercial use. For a product you sell, get a commercial licence.

Terminal
npm install --ignore-scripts \  https://github.com/phonlet-ai/wake/releases/download/v0.1.0/phonlet-ai-wake-node-0.1.0.tgz \  https://github.com/phonlet-ai/wake/releases/download/v0.1.0/phonlet-ai-wake-node-linux-x64-gnu-0.1.0.tgz \  https://github.com/phonlet-ai/wake/releases/download/v0.1.0/phonlet-ai-wake-model-en-0.1.0.tgz

The SDK, its Linux x64 add-on and the model package. In the example, en-1.pwake is the model: english.model from @phonlet-ai/wake-model-en, or phonlet-wake-en-1.pwake from the release.