Tag Archives: Snowboy

How To Train A Custom Wake Word For Google Assistant Using Snowboy

Following up to my primer on using Snowboy for custom Google Assistant wake words, in this video, I’ll walk you through using Snowboy’s “Hotword As A Service” to train your own wake words.

PARTS/TOOLS:

Google AIY Voice Kit

Raspberry Pi 3B+ (with appropriate SD card and power supply)

RESOURCES:

Snowboy

How To Use A Custom Wake Word With Google Assistant

The new voice assistants like Siri, Cortana, Alexa, and Google (itself?) are becoming more and more ubiquitous as we race toward a “Star Trek”-style omnipresent computing interface, but what if you don’t like invoking the name of your chosen corporate overlord when you use the assistant’s features? What if you could speak “Okay, Computer” into an Apple mouse like Scotty did? In this video, I’ll show you how to set up a custom wake word with your voice assistant using a platform called “Snowboy”.

 

PARTS/TOOLS:

Google AIY Voice Kit

Raspberry Pi 3B+ (with appropriate SD card and power supply)

RESOURCES:

Snowboy

Snowboy GitHub

GassistPi GitHub

How To Set Up Google AIY

How To Set Up Google Assistant On The Matrix Creator Development Board

Google Actions Console

Google Developer Console

How To Set Up Snowboy On Raspberry Pi:

Install the Sox, PortAudio, and PyAudio dependencies
sudo apt-get install python-pyaudio python3-pyaudio sox
pip install pyaudio

Install Swig by compiling from source
wget http://downloads.sourceforge.net/swig/swig-3.0.10.tar.gz
tar -xvf swig-3.0.10.tar.gz
sudo apt-get install libpcre3 libpcre3-dev
cd swig-3.0.10
./configure --prefix=/usr\
--without-clisp \
--without-maximum-compile-warnings &&

make
make install &&
install -v -m755 -d /usr/share/doc/swig-3.0.10 &&
cp -v -R Doc/* /usr/share/doc/swig-3.0.10

Install the Atlas library
sudo apt-get install libatlas-base-dev

Verify audio recording and playback work
arecord -f cd -d 5 test.wav
aplay test.wav

Clone the Snowboy repo
https://github.com/Kitt-AI/snowboy.git

Compile the Snowboy Python wrapper
cd snowboy/swig/Python
make

Run the Snowboy demo with the “Snowboy” wake word
cd snowboy/src/examples/Python
python demo.py /home/pi/snowboy/resources/models/snowboy.umdl

How To Set Up GassistPi On Google AIY:

Clone the GassistPi repo
git clone https://github.com/shivasiddharth/GassistPi

Install the AIY hat configuration
sudo chmod +x ./GassistPi/audio-drivers/AIY-HAT/scripts/configure-driver.sh
sudo ./GassistPi/audio-drivers/AIY-HAT/scripts/configure-driver.sh
sudo reboot
sudo chmod +x ./GassistPi/audio-drivers/AIY-HAT/scripts/install-alsa-config.sh
sudo ./GassistPi/audio-drivers/AIY-HAT/scripts/install-alsa-config.sh

Confirm that your audio still works
speaker-test -t wav

From here, you’re going to use the credentials as well as the project and device IDs created when you first set up the Google AIY kit. Refer to the how-tos above if you haven’t gotten this far yet.

Run the installer script (this will take a while)
sudo chmod +x ./GassistPi/scripts/gassist-installer.sh
sudo ./GassistPi/scripts/gassist-installer.sh

As the script finishes, you will be presented with a unique URL for authentication. Copy that URL into a browser, sign in to Google, copy the authentication code, and paste that at the prompt in the terminal.

You can now run Google Assistant via GassistPi which allows intricate customization options as well as custom wake words via Snowboy. Configure these options by using a text editor with ~/GassistPi/src/config.yaml

Run Google Assistant with the following command:
/home/${USER}/env/bin/python -u /home/${USER}/GassistPi/src/main.py --project_id [your project ID] --device_model_id [your device ID]