hotword

1.0.9 • Public • Published

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)
yuxon@qq.com

Package Sidebar

Install

npm i hotword

Weekly Downloads

9

Version

1.0.9

License

ISC

Unpacked Size

2.93 MB

Total Files

15

Last publish

Collaborators

  • zhyjs