hotword
v1.0.9
Published
Hot Word Detection and EASY to build and use
Downloads
7
Maintainers
Readme
Hotword
Description
This is the project Porcupine (https://github.com/Picovoice/Porcupine)'s Node.js wrapper.
It's easy to use, and fit almost every platform because it run on WASM.
Usage
Following is the example (it is test.js in the package):
let fs=require("fs");
let wavdecoder=require("wav-decoder");
let pico=require(__dirname+"/pico.js");
wavdecoder.decode(fs.readFileSync("multiple_keywords.wav")).then((wav)=>{
let piko=new pico({
grapefruit:fs.readFileSync(__dirname+"/prekeywords/grapefruit_wasm.ppn"),
bumblebee:fs.readFileSync(__dirname+"/prekeywords/bumblebee_wasm.ppn")
},wav.sampleRate,(word)=>{
console.log(word);
})
piko.init().then(()=>{
for(let i=0;i<wav.channelData[0].length;i+=1024)
piko.feed(wav.channelData[0].slice(i,i+1024));
});
});
Just decode the wav and feed it to the 'pico' instance,
the we can get the keyword on callback function.
Additionally, if you want a live hot word detection,just start a
recorder then feed the 'pico' with audio frame data.
Run a test
npm run test
if success, you gonna get this
bumblebee
grapefruit
Get a keyword file
see
https://github.com/Picovoice/Porcupine/tree/master/tools/optimizer
Contacts
Wyatt Zheng (Yango University)
[email protected]