Skip to content

Instantly share code, notes, and snippets.

@Nailik
Created February 17, 2022 14:54
Show Gist options
  • Save Nailik/50c336f1896b7ad4d8ae8760a44ec486 to your computer and use it in GitHub Desktop.
Save Nailik/50c336f1896b7ad4d8ae8760a44ec486 to your computer and use it in GitHub Desktop.
HermesLedControl for Matrix Voice
#
#
# This is an installation guide how to use HermesLedControl https://github.com/project-alice-assistant/HermesLedControl
# with a Matrix Voice Device and Rhasspy
#
### This is NOT a script yet, use it step by step
#
#
#
## Because Matrix Voice does not support bullseye you need to use buster
## Go to https://www.raspberrypi.com/software/ and create an sd with buster
#
#
## 1. Install Matrixio Packages
# trusted is used because the current pgp key is invalid
echo "deb [trusted=yes] https://apt.matrix.one/raspbian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/matrixlabs.list
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y matrixio-creator-init libmatrixio-creator-hal libmatrixio-creator-hal-dev matrixio-kernel-modules
# reboot
sudo reboot
#
#
## 2. Install Rhasspy
# Use this guide https://rhasspy.readthedocs.io/en/latest/installation/
#
# Test installation: go to Rhasspy web ui and select microphone:
# Direct hardware device without any conversions (hw:CARD=MATRIXIOSOUND,DEV=0)
# Enable audio statistics and test if the energy changes as you speak
# you can either use MQTT or HTTP to your base station (or use this as your base station)
# setup other settings acoordingly.
#
# For Audio Playing you could choose aplay and:
# Direct hardware device without any conversions (hw:CARD=MATRIXIOSOUND,DEV=0)
# This worked only for Dialogue Management sounds in my case (seems to be an issue with rate https://community.matrix.one/t/use-speaker-connection-from-matrix-voice-whis-snips/2517/25? )
#
#
## 3. Install packages necessary for later Python 3.9
#
sudo apt-get install -y wget build-essential checkinstall
sudo apt-get install -y build-essential
sudo apt-get install -y checkinstall
sudo apt-get install -y libreadline-gplv2-dev
sudo apt-get install -y libncursesw5-dev
sudo apt-get install -y libssl-dev
sudo apt-get install -y libsqlite3-dev
sudo apt-get install -y tk-dev
sudo apt-get install -y libgdbm-dev
sudo apt-get install -y libc6-dev
sudo apt-get install -y libbz2-dev
sudo apt-get install -y zlib1g-dev
sudo apt-get install -y openssl
sudo apt-get install -y libffi-dev
sudo apt-get install -y python3-dev
sudo apt-get install -y python3-setuptools
sudo apt-get install -y wget
#
#
## 4. Download and setup python
#
wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tar.xz
tar xf Python-3.9.0.tar.xz
cd Python-3.9.0
sudo nano Setup/Modules
#
# setup up ssl, edit Modules/Setup file and find SSL lines:
#
SSL=/usr/local/ssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
#
# uncomment those lines and change /usr/local/ssl to /usr/
# this is because python will look into $(SSL)/include/openssl and this should be your ssl path
#
# check by going into /usr/include/openssl and check if there is a file named ssl.c
#
cd /usr/include/openssl
#
#
## 5. Build Python 3.9 into /usr
#
# configure
#
sudo ./configure --enable-optimizations --prefix=/usr --with-openssl=/usr/
#
# make and install
#
sudo make && sudo make altinstall
#
# This will take a while, on a Rhasspy 3B it takes around 1hr to 1:30hr
#
# Pretty early you can check if ssl works when you see this line (very important)
#
checking whether compiling and linking against OpenSSL works... yes
#
#
## 6. Setup that python 3.9 is used
#
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.9
#
# validate
#
sudo python --version
#
#
## 7. Installation of Hermes Led Control, download (cont execute yet) according to https://github.com/project-alice-assistant/HermesLedControl/wiki/Installation-&-update
#
#
sudo wget https://gist.githubusercontent.com/Psychokiller1888/a9826f92c5a3c5d03f34d182fda1ce4c/raw/d130b0c538424b9c70a3cacdfbd1bddd7605ab9c/hlc_download.sh
#
# comment the las lines where the install script is executed
#
sudo nano hlc_download.sh
#
# execute download
#
sudo chmod +x hlc_download.sh
sudo ./hlc_download.sh
#
# edit install script
#
sudo nano installers/matrixVoiceCreator.sh
#
# change echo "deb https://apt.matrix.one/raspbian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/matrixlabs.list tp
echo "deb [trusted=yes] https://apt.matrix.one/raspbian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/matrixlabs.list
#
# execute install script, be aware that when youÄre asked for path you need to input the correct path and not just click enter
#
# reboot accoring to script
sudo reboot
#
#
## 8. Testing
#
cd HermesLedControl
./venv/bin/python3 main.py --debug=True --engine=rhasspy --hardware=matrixvoice
#
# this should output successful reading of configuration.yml and rhasspy file
# if not check if cou need to change .config/HermesLedControl to .config/hermesLedControl
# and if you rhasspy path cant be read correctly
# edit (according to used profile)
pathToConfig: "/home/piz/.config/rhasspy/profiles/en/profile.json"
#
# Fix if MQTT is not working: Set in configuration.yml
mqttPort: "1883"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment