jasperproject/jasper-client — pull request #100 by astahlman (2014-06-21 22:08:07+00:00)
Title: Platform independent audio output. Stop hardcoding /home/jasper.

# Summary #
This commit includes changes to support platform independence. This implementation detects the current platform and chooses an appropriate system command for audio output. It also does not rely on a directory structure rooted at /home/pi

# Changes #
1. Use $JASPER_HOME as base directory instead of assuming that root is /home/pi. This change is backwards-compatible, as the boot script will export $JASPER_HOME=/home/pi if this directory exists. On OS X, I set this environment variable in my ~/.zshrc.
2. Abstracted out the 'say' functionality into the new speaker module. The speaker module will select one of two implementations based on the detected platform: RPi, which still uses espeak, or OS X, which uses the built-in say command.
3. Updated boot/test.py to validate the list of vocabulary words passed to g2p without respect to ordering.

# Testing #
* Manual verification on both OS X and the RPi.
* Unit tests in boot/test.py and client/test.py pass on the RPi.

# Notes #
I wanted to minimize the scope of the changes included in this pull request, so I didn't mess with the directory structure. I was uneasy, however, appending client/ to the path in order to import the speaker module from inside boot/boot.py. What do others think should be the right approach here?