realtime-keyword-spotter
v1.0.1
Published
Realtime keyword spotter for NodeJS
Readme
realtime-keyword-spotter
Usage: realtime-keyword-spotter <model.onnx> [options]
Options:
--standardize Enable standardization of MFCC features [boolean] [default: false]
--threshold Detection threshold (default: 0.5) [number] [default: 0.5]
--hop, -h Hop duration in seconds (default: 0.10) [number] [default: 0.2]
--device, -d Audio input device (see `arecord -l`) [string]
--cooldown Detection cooldown in milliseconds [number] [default: 1000]
-h, --help Show help [boolean]
const KeywordSpotter = require('./keyword-spotter');
const spotter = new KeywordSpotter({
modelPath: 'path/to/model.onnx', // Path to your ONNX model
standardize: false, // Optional: enable feature standardization
threshold: 0.5, // Optional: detection threshold
hopSeconds: 0.1, // Optional: hop duration (in seconds)
device: undefined, // Optional: specify ALSA device
cooldown: 1000, // Optional: cooldown time in ms between detections
});
spotter.on('detection', ({ prob, timestamp }) => {
console.log(`[${new Date(timestamp).toLocaleTimeString()}] DETECT prob=${prob.toFixed(3)}`);
});
spotter.start();