The personal Wake Word allows you to define your own word to wake your assistant and initiate a conversation. To do so, the algorithm needs some samples of you saying this particular word. In this tutorial, a script will guide you through the recording of those samples and in a second part, we will show you how to test your model and incorporate it in your assistant.
Connect to the pi by ssh:
$ ssh username@hostname
Clone the repo (install git before if needed).
$ sudo apt-get install git$ git clone https://github.com/snipsco/snips-record-personal-hotword.git$ cd snips-record-personal-hotword/
Use the following command to install the repository dependencies
$ sudo apt-get install python-numpy python-pyaudio python-soundfile
Enter the following command to record your wake word samples (where you can put your own wake word name instead of
$ sudo systemctl stop snips-audio-server; python script_recording.py your_hotword_name
The prompt will then guide you through the different steps.
This script also performs some postprocessing on your samples, in order to remove silence at the beginning and the end of each record. For this postprocessing to perform well, you have to be sure not to make any noise between the "recording..." and the "finished recording" messages in the prompt for each wake word (the duration between those two messages should be 2 seconds, which lets you time to pronounce your wake word).
Once you are finished, take note of the place your model has been saved in the last prompt message (this will be the
path_to_your_model in the next step). You are now ready to test and adjust its sensitivity.
In order to test you model first run the following commands.
$ sudo systemctl stop snips-hotword; sudo systemctl stop snips-dialogue; sudo systemctl start snips-audio-server;
Then run the following one to launch the wake word detector:
$ snips-hotword --model <path_to_your_model>=<sensitivity>
sensitivity is a number between 0 and 1 that allows you to adjust the model sensitivity (the higher the sensitivity the higher the false alarm rate, e.g cases where it is triggered when it shouldn't) and
path_to_your_model is the path to your model. By default the sensibility is set to
0.5. You can play with different values of the sensitivity to find the best value for your model (usually between
Once you are satisfied with your model, move the model directory (containing the waves and the
config.json file) to
/etc/snips/ (still with your own
$ sudo mkdir -p /etc/snips/; sudo mv <path_to_your_model> /etc/snips/
Your model now has a new path which we denote
<new_path_to_your_model> exemple: /etc/snips/personal_2018_10_00A00_00_00
Then edit the
/etc/snips.toml file with
sudo nano /etc/snips.toml by updating the
model entry in the
[snips-hotword] section with the following line:
[snips-hotword]model = ["<new_path_to_your_model>=<sensitivity>"]
Note that the
# symbol must be erased in front on the model line.
If you want to run several models simultaneously, you first have to launch the script at step 3 as many times as you want personal hotwords (use a different
your_hotword_name for each one) and declare them one after the other in the model entry (
model = ["<new_path_to_your_model_1>=<sensitivity_1>", "<new_path_to_your_model_2>=<sensitivity_2>"]).
Important: If you want the universal Wake Word model attached to your assistant to run simultaneously, add its path to the model entry:
/usr/share/snips/assistant/custom_hotword. Note that if you do not provide
sensivity the model will take 0.5 by default.
Finally, restart your assistant's wake word by running:
$ sudo systemctl restart snips-hotword; sudo systemctl restart snips-dialogue
You can then check that it works by running
snips-watch -vvv (if not installed, run
sudo apt-get install snips-watch).
You can find a short video about this full process just right here.