Start with a fresh install of Raspbian (Lite or Regular, this guide assumes Lite)
- Update
sudo apt update && sudo apt -y upgrade && sudo apt-get -y auto-remove && sudo reboot
- Install dependencies:
sudo apt -y install python-pyaudio python3-pyaudio sox python3-pip python-pip libatlas-base-dev
- Install PortAudio’s Python bindings:
python2
sudo pip install pyaudio
python3
sudo pip3 install pyaudio
- Create ~/.asoundrc with correct hw settings. use
aplay -l
&arecord -l
to find out hw cards. "card 0, device 0" is "hw:0,0" In the attached sample, playback is through onboard jack & input is through usb mic - If using RESTful API Calls via python script (per snowboy instructions) need to install "requests" module for python:
pip install requests
- Download pre-packaged Snowboy binaries and their Python wrappers for Raspberry Pis: https://s3-us-west-2.amazonaws.com/snowboy/snowboy-releases/rpi-arm-raspbian-8.0-1.1.1.tar.bz2
- Extract to Pi & rename directory to "snowboy"
- Use
speaker-test -c 2
to test audio out - Use
arecord -d 3 test.wav
to record a 3 second test clip. Useaplay test.wav
to verify - If you need to tweak some alsa settings, use alsamixer & then run the following to keep the settings
sudo alsactl store
- copy training_service.py to the snowboy directory
- log into https://snowboy.kitt.ai, click on “Profile settings”, and copy your API token
- change the appropriate fields (token, hotword, etc.) in training_service.py
- use the following to record 3 wav files of your hotword to the same directory
rec -r 16000 -c 1 -b 16 -e signed-integer FILENAME.wav
- run the following to generate a pmdl
python training_service.py 1.wav 2.wav 3.wav saved_model.pmdl
- move saved_model.pmdl to ~/snowboy/resources/ (rename for easier recall later)
- run the demo to make sure everything is working:
python demo.py ~/snowboy/resources/saved_model.pmdl
- copy snowboy.py to the snowboy directory
- copy the curl requeset from thinger.io to ~/thingeriocurl.sh and make it executable. be sure to replace the "bearer" information with the static device token
- run snowboy.py to make sure everything is working:
python snowboy.py
- copy snowboy.service to /lib/systemd/system/
- you may need to run this:
sudo systemctl daemon-reload
- start the snowboy.service to make sure everything is working:
sudo systemctl start snowboy.service
Use training_service.py to train more voice models and add pmdl files to ~/snowboy/snowboy.py (comma separated)
- incorporate ~/thingeriocurl.sh into ~/snowboy/snowboy.py