Conditional Voice Recorder (CVR) used to capture interactions with the Amazon Echo in the home
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
utils
.gitignore
LICENSE
README.md
__init__.py
audio.py
beep.py
cvr.py
detector.py
led.py
log.py
recorder.py

README.md

Conditional Voice Recorder (CVR)

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.

Publication using the CVR

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

Setup

  • 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)

Build Instructions

  • 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 to SWIG := swig3.0, however at time of writing, the Debian stable version of SWIG was not up-to-date enough
  • Build the Python SWIG library by running make

PIN layout

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)

Running an Snowboy Example

  • 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 the examples/Python directory and call python demo.py <name>.pdml
  • Once you've confirmed the demo works, move onto the setup of the hotword detector

Running the CVR

  • 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 and ln -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

Init Script

  • 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