const record = require('node-record-lpcm16');
const Detector = require('snowboy').Detector;
const Models = require('snowboy').Models;
const models = new Models();
models.add({
file: 'resources/snowboy.umdl',
sensitivity: '0.5',
hotwords : 'snowboy'
});
const detector = new Detector({
resource: "resources/common.res",
models: models,
audioGain: 2.0,
applyFrontend: true
});
detector.on('silence', function () {
console.log('silence');
});
detector.on('sound', function (buffer) {
// <buffer> contains the last chunk of the audio that triggers the "sound"
// event. It could be written to a wav stream.
console.log('sound');
});
detector.on('error', function () {
console.log('error');
});
detector.on('hotword', function (index, hotword, buffer) {
// <buffer> contains the last chunk of the audio that triggers the "hotword"
// event. It could be written to a wav stream. You will have to use it
// together with the <buffer> in the "sound" event if you want to get audio
// data after the hotword.
console.log(buffer);
console.log('hotword', index, hotword);
});
const mic = record.start({
threshold: 0,
verbose: true
});
mic.pipe(detector);
After running node index.js I'm getting error: Error in `node': munmap_chunk(): invalid pointer: 0x00007ffea82bed00
Environment: VirtualBox 5.6.2 Host: Windows10, Guest: Linux Ubuntu 16.04.4 LTS node: 9.11.1 npm: 5.6.0 snowboy: 1.3.1
I've installed snowboy from npm, copied node example to index.js and provided resource files.
File structure:
my index.js looks like this:
After running
node index.js
I'm getting error:Error in `node': munmap_chunk(): invalid pointer: 0x00007ffea82bed00
Full stacktrace:
EDIT: After downgrading snowboy to
1.2.0
everything works as intended.