Rhasspy Assistant Tips n Tricks

Snowboy-CustomMaker for Rhasspy Assistant.

Snowboy-CustomMaker

← Main page

Snowboy-CustomMaker is a set of python scripts and tips to help recording custom wakeword samples and generate pmdl file.

Installation

This tool require python 3 and four python packages to run:

SSH to your rhasspy device, on /home/pi folder.

Install python packages, download snowboyCustomMaker-list.txt, then download this list into SnowboyCustomMaker folder:

sudo apt-get install python3-numpy python3-pyaudio python3-soundfile python3-requests
wget https://raw.githubusercontent.com/KiboOst/jeedom_docs/master/other/Rhasspy/SnowboyCustomMaker/snowboyCustomMaker-list.txt
wget -P /home/pi/SnowboyCustomMaker -i snowboyCustomMaker-list.txt
cd SnowboyCustomMaker

You should get three python scripts:

You can have a look at these files here

snowboyRecord

This script is based on snips-record-personal-hotword.

It have been converted to python3, cleaned, enhanced and snowboyed!

It will guide you through recording three wave sample files to later generate your custom wakeword pdml file for Rhasspy (or whatever use snowboy wakeword).

Why not just record samples with arecord ?

Indeed, we can use arecord to get our three sample wav files:

arecord -D 'sysdefault:CARD=seeed2micvoicec' -r 16000 -f S16_LE -c 1 -t wav > 0.wav
ctrl C

snowboyRecord script check each recorded sample for noise, and if there is too much noise it will display a warning and record a new one. If there is too much noise in the room, you will simply be unable to validate your records. Which will avoid generating a pmdl file that will cause many false positive!

It will also check duration consistency between samples. So you can end up recording not three, but more ...

Finally, snowboyRecord will also automatically cut leading and trailing noise/silence in the wav file, to ensure better wakeword definition.

First you will have to free-up access to microphone, so shutdown Rhasspy: docker stop rhasspy-server

Then, run snowboyRecord:

cd SnowboyCustomMaker
python3 snowboyRecord.py --wakeword myhotword

myhotword is an identifier for your wakeword.

The three sample files with be saved into SnowboyCustomMaker/myhotword folder, and snowboyTrain will get them to generate myhotword.pmdl file.

You can use for example heyJarvis_Dady then later record heyJarvis_Mom, etc.

While running the script with a previously used identifier, it will delete previous saved folder!

At the end you will end-up with a myhotword folder with six wav files: three samples, two files per sample. For each sample you will have a x_uncut.wav which is the original recorded wav. The x.wav has been cut (leading and trailing noise/silence) by snowboyRecord.

Tips for recoding wakeword

Recording a custom wakeword is something sensible to get good detection without false positive detection.

Here are a few rules from my experience with both Snips and Snowboy:

Cut samples leading/trailing noise.

snowboyTrain

snowboyTrain will load your previously recorded samples and connect to snowboy.kitt.ai API to generate corresponding pmdl file.

You will need an API token for this : go to snowboy.kitt.ai and login (you can login with Github account), then get your token from your profile.

Get your API token.

Then, start snowboyTrain with your token and your previously recorded wakeword identifier (see above).

cd SnowboyCustomMaker
python3 snowboyTrain.py --token ccccc0000000ccccccccccccc --lang fr --gender M --age 30 --wakeword myhotword

run python3 snowboyTrain.py -h to see arguments options.

You should now have your pmdl file in /home/pi/SnowboyCustomMaker/myhotword/myhotword.pmdl.

Move it in your Rhasspy profile like /home/pi/.config/rhasspy/profiles/fr/snowboy/myhotword.pmdl and set it in Rhasspy settings (snowboy/myhotword.pmdl).

Don't forget to check Rhasspy official documentation on using snowboy wake word detector!