DIY Voice Assistant based on the GLaDOS character from Portal video game series.
๐ Hackday - Tech blog ๐ Tom's Hardware - Technology news ๐ฎ PCGamer - Online magazine ๐ซ๐ฎ Ilta-Sanomat - The second largest newspaper in Finland ๐ซ๐ฎ Muropaketti - Finnish computing website ๐บ YouTube - GLaDOS Voice Assistant playlist |
๐ GLaDOS Voice Assistant - henrirantanen.fi
- Written mostly in Python
- Work in progress
โ New versions of the voice assistant will not work on Raspberry Pi due to missing CPU instruction sets needed by some AI scripts. If you are looking to play along with the old version on your Raspberry Pi, check the raspberry branch.
- YouTube ๐บ GLaDOS Voice Assistant | Introduction
- YouTube ๐บ GLaDOS Voice Assistant | Software - Python tutorial
- Twitter ๐ GLaDOS Voice Assistant project build
- Local Trigger word detection using PocketSphinx
- Local GLaDOS Text-to-Speech engine using glados-tts model by R2D2FISH
- Speech-to-text processing using Google's API (for now)
- Local TTS cache of generated common audio samples locally for instant answers in the future
- Animatronic eye control using servos
- Round LCD for an eye to display display textures
Tight integration with Home Assistant's local API:
- Send commands to Home Assistant
- Read and speak sensor data
- Notification API, so Home Assistant can speak out notifications through GLaDOS
- Clock
- Control lights and devices
- Weather and forecast
- Add things to shopping list
- Read sensor information
- Random magic 8-ball answers
- Tell jokes
- Judge you and be mean
- Advanced fat-shaming
- Log stuff and gather training data locally
Note: The code is provided as reference only.
sudo apt-get update
sudo apt-get upgrade
sudo apt install python3-pip
PyAudio is needed to play audio files.
sudo apt-get install portaudio19-dev
Used for trigger word detection for now.
sudo apt-get install -y build-essential swig libpulse-dev libasound2-dev
Used to turn audio into text for now.
sudo apt-get install flac
Install python modules from requirements.txt file
cd ~/glados-voice-assistant
sudo pip3 install -r requirements.txt
See here: https://pytorch.org/get-started/locally/#start-locally
cd ~
This will download GLaDOS Voice Assistant and the TTS submodule.
git clone --recurse-submodules https://github.com/nerdaxic/glados-voice-assistant/
After this you can play around with the TTS, this works as stand-alone.
cd ~/glados-voice-assistant/glados_tts/
python3 glados.py
Find the sound card ID:
python3 -m sounddevice
Generate and edit the settings.env file:
cp ~/glados-voice-assistant/settings.env.sample ~/glados-voice-assistant/settings.env && nano ~/glados-voice-assistant/settings.env
Launch the voice assistant:
python3 ~/glados-voice-assistant/glados.py
You can add glados.py to your crontab file or run it manually.
crontab -e
@reboot python3 /home/username/glados-voice-assistant/glados.py
To make Home Assistant integration work, you need to enable the API in the home assistant configuration file and generate a long-lived access token. Add access token and IP-address of the home assistant server into the settings.env file.
# This will enable rest api
api:
# This will add GLaDOS as a notification provider. Replace with correct IP of GLaDOS.
notify:
- name: glados
platform: rest
resource: http://192.168.1.XXX:5000/notify
List of reference hardware what nerdaxic is developing on, models might not need to be exact. Not a full bill of materials.
Item | Description |
---|---|
Main board | Basic i7 laptop with 16 gigs of RAM |
Operating system | ubuntu-20.04.3-desktop-amd64 |
Microcontroller | Teensy 4, to control the eye LCD and NeoPixels |
Eye lights | Adafruit NeoPixel Diffused 5mm Through-Hole for the "REC" light |
Eye lights | Adafruit 16 x 5050 NeoPixel Ring |
Eye LCD | 1.28 Inch TFT LCD Display Module Round, GC9A01 Driver SPI Interface 240 x 240 |
Audio amp is powered from Raspberry GPIO 5V line and ReSpeaker board from USB to avoid ground loops and noise issues.
Item | Description |
---|---|
Audio amplifier | Adafruit Stereo 3.7W Class D Audio Amplifier |
Speakers | Visaton FRS 7 |
Microphone & Audio interface | ReSpeaker Mic Array V2.0 |
Mechanics are powered from their own power supply to allow more power for the servos and prevent brown-outs.
Item | Description |
---|---|
Power supply | MeanWell LRS-50-5 5V |
Servo controller | Pololu Micro Maestro |
Servo: Eye movement | 35 kg DS3235 (Control Angle 180) |
Servo: Eyelids | 25 kg DS3225 (Control Angle 180) |
Screws | Various M3 and M4 screws |
Jumper wires | 0.32 mmยฒ/22 AWG assortment |