A system that listens for a hotword and begins audio capture. Configured to run on a Raspberry Pi 3, may work on other platforms. Makes use of the Snowboy Hotword Detection system.
The CVR is used in the following publications:
- Martin Porcheron, Joel E. Fischer, Stuart Reeves, and Sarah Sharples. 2018. Voice Interfaces in Everyday Life. In Proceedings of the 2018 ACM Conference on Human Factors in Computing Systems (CHI '18). ACM, New York, NY, USA. https://doi.org/10.1145/3173574.3174214
If you use the CVR in your project or publication, we'd be grateful if you could create an 'issue' on this repository to include the reference here
- The CVR features to LEDs and 1 button, all connected to the GPIO pinout of the Raspberry Pi
- Each LED and button should be connected to a normal pin and a ground pin
- You can customise which pins are used in
cvr.py
, although by default they are listening (15), recording (18), running cvr code (24), and button (27)
- Follow the steps to install the required pre-requisites from the GitHub repository
- You may need to install PIP at some point (not currently given in the setup instructions):
curl https://bootstrap.pypa.io/get-pip.py | python
(need to run as SU if not already) - Download a release of [Snowboy])(https://github.com/Kitt-AI/snowboy/releases)
- Install the following to compile the python library:
apt-get install python-dev
- Install python-config:
pip install python-config
- The directory to build the Python library is 'swig/Python' (i.e.
cd
there now) - Execute this bash script to get SWIG - you may
need to update the versions for SWIG and PCRE (check the directories manually), and then add the binary to the PATH
- You could alternatively fix the 'Makefile' by changing the line
SWIG := swig
toSWIG := swig3.0
, however at time of writing, the Debian stable version of SWIG was not up-to-date enough
- You could alternatively fix the 'Makefile' by changing the line
- Build the Python SWIG library by running
make
The following is the circuits for the various components (by default):
- 6 (gnd) -> listening led -> resister (yellow, purple, brown gold) -> 10 (gpio 15)
- 12 (gpio 18) -> recording led -> resister (yellow, purple, brown gold) -> 14 (gnd)
- 18 (gpio 24) -> running cvr code led -> resister (yellow, purple, brown gold) -> listening led -> 20 (gnd)
- 13 (gpio 27) -> button -> 9 (gnd)
- Download/Generate a hotword model from the Snowboy Website (this requires Chrome or Firefox), or find an existing file elsewhere on the Internet
- Move the
<name>.pdml
file in theexamples/Python
directory and callpython demo.py <name>.pdml
- Once you've confirmed the demo works, move onto the setup of the hotword detector
- Download the code from GitHub repository and
cd
into the directory - Create symlinks to the compiled versions of
snowboydetect.py
and_snowboydetect.so
, e.g.ln -s /home/pi/snowboy-1.1.0/swig/Python/snowboydetect.py snowboydetect.py
andln -s /home/pi/snowboy-1.1.0/swig/Python/_snowboydetect.so _snowboydetect.so
- Also use the default snowboy resources:
ln -s /home/pi/snowboy-1.1.0/resources resources
- Copy your model to the directory
- Run the code
python cvr.py <name>.pdml
- This file also provides help information for the built-in configurations, accessible with a
-h
or--help
flag
- This file also provides help information for the built-in configurations, accessible with a
- This script starts, stops, and restarts the CVR automatically
- Edit the variable
DIR
in the file to the correct directory for the CVR - Copy the file
utils/cvr.sh
to/etc/init.d/cvr
, and make sure it is owned by root and has user execute permissions - Optionally add
@reboot /etc/init.d/cvr start
to root's crontab to start the detector on boot - Run
update-rc.d cvr defaults
after doing this - Optionally, run
ln -s /etc/init.d/cvr /etc/rc0.d/K01cvr
to stop the system safely on shutdown