This repository contains a way to use a custom hotword with google assistant.
It demonstrates: - Initialization of the Assistant - Basic event handling including hotword detection.
- Python >= 3.4
- Raspberry Pi 3 running Rasbian (or any other
linux-arm7l
SBC) - A Google API Console Project
- A Google account
-
Install Python 3
-
Ubuntu/Debian GNU/Linux:
sudo apt-get update sudo apt-get install python3 python3-venv
-
-
Create a new virtual environment (recommended):
python3 -m venv env env/bin/python -m pip install --upgrade pip setuptools source env/bin/activate
-
Follow the steps to configure the project and the Google account.
-
Download the
client_secret_XXXXX.json
file from the Google API Console Project credentials section and generate credentials usinggoogle-oauth-tool
:pip install --upgrade google-auth-oauthlib[tool] google-oauthlib-tool --client-secrets path/to/client_secret_XXXXX.json --scope https://www.googleapis.com/auth/assistant-sdk-prototype --save --headless
-
Install the sample dependencies using pip:
pip install --upgrade -r requirements.txt
-
Run the hotword sample. The sample waits for the “Ok Google” hotword, then records a voice query and plays back the Google Assistant’s answer:
python -m hotword
-
If that works, execute:
python3 -m jarvis
- The hotword can be changed in jarvis.py
-
If audio is not working, verify the ALSA setup:
# Play a test sound speaker-test -t wav # Record and play back some audio using ALSA command-line tools arecord --format=S16_LE --duration=5 --rate=16k --file-type=raw out.raw aplay --format=S16_LE --rate=16k --file-type=raw out.raw
See also the troubleshooting section of the official documentation.
Copyright (C) 2017 Google Inc, Kitt_ai And aycgit
See the LICENCE file distributed with this work for additional information regarding copyright ownership.