xtools-at / AssistantPi
- понедельник, 8 мая 2017 г. в 03:12:09
Python
Bring both Google Assistant and Alexa to yor RPi
AssistantPi is basically a tweak of AlexaPi allowing you to run Google Assistant and Amazon's Alexa on a Raspberry Pi. It includes the Google Assistant SDK and uses AlexaPi's hotword recognition to activate either Assistant or Alexa. The installer provides an easy way to get everything set up in just under an hour.
This is just an experimental proof-of-concept without broad support.
Credits / Further Resources:
You will need:
/home/pi/Downloads/client_secret.json
/opt
directory and rename the folder to AlexaPi (both important, it will fail otherwise):
cd /opt
sudo git clone https://github.com/xtools-at/AssistantPi.git AlexaPi
sudo /opt/AlexaPi/src/scripts/setup.sh
/opt/AlexaPi/env/bin/python -m googlesamples.assistant.auth_helpers --client-secrets /home/pi/Downloads/client_secret.json
python /opt/AlexaPi/src/main.py
. Otherwise, it will be started automatically when the setup finishes.Make sure you've been to sudo raspi-config
, Advanced Options > Audio and have set the desired audio output (i.e. 3.5mm Jack, not HDMI).
Please refer to the following guides if you encounter any audio problems:
Configure Google Assistant Audio Output
AlexaPi Audio Setup and Debugging
To change the hotwords (currently Alexa and Google), change both these files before running the setup:
.../src/config.template.yaml
(phrase and phrase_assistant) and .../src/keyphrase.list
In the latter, you can also tweak the sensitivity of the hotword recognition. See here for more information on this topic.
Also make sure that your new hotwords are included in the language model. Check the following directory for a file with .dict
or .dic
extension and add your hotwords if not already there: /usr/local/lib/python2.7/dist-packages/pocketsphinx/model/
If you want to change the language for the hotword recognition (which might be necessary if your hotwords aren't recognized well), head over to CMU Sphinx download page and get the model files for your language. In particular, you have to place the following files
in /usr/local/lib/python2.7/dist-packages/pocketsphinx/model/
and the contents of
in /usr/local/lib/python2.7/dist-packages/pocketsphinx/model/[lng-lng]
(where [lng-lng] is the language code of your imported language, e.g. 'de-de')
Make sure, that FILENAME.dic
contains your desired hotwords (i.e. Alexa and Google for default settings), if not, add them.
Afterwards, either
/opt/AlexaPi/src/config.template.yaml
language
and dictionary
attributes in pocketsphinx
configurationOR
/etc/opt/AlexaPi/config.yaml
the same way as aboveFor German, there's an language package coming with AssistantPi. During the installation steps, just after you've cloned the repository:
cd /opt
sudo git clone https://github.com/xtools-at/AssistantPi.git AlexaPi
config.yaml
:sudo git checkout feature/german
pip install pocketsphinx
sudo bash /opt/AlexaPi/src/german/install.sh