jaxcore / bumblebee-hotword

A minimalist hotword / wake word for the web, based on Porcupine
Other
56 stars 6 forks source link

How to add custom wake words #15

Closed jbflow closed 3 years ago

jbflow commented 3 years ago

How is it possible to add custom wake words?

I have a wasm model aquired from Pico Voice which is in .ppn format but am having trouble understanding how to integrate this.

dsteinman commented 3 years ago

You need the "xxd" command line program. It comes available on Mac by default, maybe Linux also. I added a bash script to do the conversion to a JS array:

https://github.com/jaxcore/bumblebee-hotword/blob/master/tools/convert_ppn.sh

Just name your ppn file ending with "_wasm.ppn" and then do:

./convert_ppn.sh yourhotword_wasm.ppn

And will create a file named "yourhotword.js". Then load that into Bumblebee/Porcupine.

The API to add the hotword to Bumblebee is:

addHotword(name, data, sensitivity)

So make sure the JS file is loaded into your web page and do:

var yourhotword = require('yourhotword.js');
bumbebee.addHotword('yourhotword', yourhotword, 0.5);

The sensitivity number may or may not have much effect. It's very inconsistent.

The PPN file will also work on the NodeJS version:

https://github.com/jaxcore/bumblebee-hotword-node

jbflow commented 3 years ago

Perfect thanks for your help, I'm running on Windows but I was able to convert to a JS array in Python.

It is now working.