├── uninstall.sh ├── README.md ├── wyoming-satellite-android └── install.sh /uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/data/data/com.termux/files/usr/bin/sh 2 | 3 | echo "Deleting files and directories related to the project..." 4 | rm -f ~/tmp.wav 5 | rm -f ~/pulseaudio-without-memfd.deb 6 | rm -rf ~/.termux/boot/wyoming-satellite-android 7 | rm -rf ~/wyoming-satellite 8 | rm -rf ~/wyoming-openwakeword 9 | 10 | echo "Uninstalling custom pulseaudio build if it is installed..." 11 | if command -v pulseaudio > /dev/null 2>&1; then 12 | export ARCH="$(termux-info | grep -A 1 "CPU architecture:" | tail -1)" 13 | echo "Architecture: $ARCH" 14 | if [ "$ARCH" = "arm" ] ; then 15 | pkg remove -y pulseaudio 16 | fi 17 | fi 18 | 19 | echo "Done" 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Wyoming Satellite on Android 2 | 3 | This project provides a simple way of setting up Wyoming Satellite and OpenWakeWord on Android. 4 | 5 | ### Prerequisites 6 | 7 | - Install [Termux](https://github.com/termux/termux-app) (open source terminal emulator app) 8 | - Install [Termux:API](https://github.com/termux/termux-api) (necessary to get mic access) 9 | - (Optional) Install [Termux:Boot](https://github.com/termux/termux-boot) and [open it once + disable battery optimization for Termux & Termux:Boot](https://wiki.termux.com/wiki/Termux:Boot) (only required if you want wyoming-satellite to autostart when your device restarts) 10 | 11 | ### How to install 12 | 13 | Open Termux and run: 14 | 15 | ``` Bash 16 | (command -v wget > /dev/null 2>&1 || (echo "Installing wget..." && pkg install -y wget)) && bash <(wget -qO- https://raw.githubusercontent.com/T-vK/wyoming-satellite-termux/refs/heads/main/install.sh) 17 | 18 | ``` 19 | 20 | ### How to uninstall 21 | 22 | Open Termux and run: 23 | 24 | ``` Bash 25 | wget -qO- https://raw.githubusercontent.com/T-vK/wyoming-satellite-termux/refs/heads/main/uninstall.sh | bash 26 | ``` 27 | 28 | ### Integrate into HomeAssistant 29 | 30 | - Open Home Assistant go to Settings → Integrations → Add Integration → Wyoming Protocol 31 | - It should ask you for a host and a port now. Enter the IP address of your Android device into the host-field (if unsure what you IP is, run `ifconfig` in Termux and check the output, it will most likely start with `192.`) and enter 10700 in the port-field. 32 | -------------------------------------------------------------------------------- /wyoming-satellite-android: -------------------------------------------------------------------------------- 1 | #!/data/data/com.termux/files/usr/bin/sh 2 | export OWW_ENABLED=false 3 | 4 | wlog() { 5 | local message="$1" 6 | echo "$message" 2>&1 | tee -a "$HOME/wyoming-satellite.log" 7 | } 8 | 9 | echo "" > "$HOME/wyoming-satellite.log" 10 | #echo "" > "$HOME/wyoming-openwakeword.log" 11 | wlog "$(date)" 12 | 13 | wlog "Ensure sox is available..." 14 | if ! command -v rec > /dev/null 2>&1 || ! command -v play > /dev/null 2>&1; then 15 | wlog "sox was not found, installing it now..." 16 | pkg install sox -y 17 | if ! command -v rec > /dev/null 2>&1 || ! command -v play > /dev/null 2>&1; then 18 | wlog "ERROR: Failed to install sox" >&2 19 | exit 1 20 | fi 21 | fi 22 | 23 | export TERMUX_INFO="$(termux-info)" 24 | export MANUFACTURER_NAME="$(echo "$TERMUX_INFO" | grep -A 1 "Device manufacturer:" | tail -1)" 25 | export MODEL_NAME="$(echo "$TERMUX_INFO" | grep -A 1 "Device model:" | tail -1)" 26 | if [ "$MANUFACTURER_NAME $MODEL_NAME" = " " ]; then 27 | export SATELLITE_NAME="Android Satellite" 28 | else 29 | export SATELLITE_NAME="Android Satellite - $MANUFACTURER_NAME $MODEL_NAME" 30 | fi 31 | 32 | if [ "$OWW_ENABLED" = "true" ]; then 33 | export OWW_FLAGS="--wake-uri tcp://127.0.0.1:10400 --wake-word-name ok_nabu" 34 | wlog "Enter wyoming-openwakeword directory..." 35 | cd "$HOME/wyoming-openwakeword" 36 | stdbuf -oL -eL python3 ./script/run --uri 'tcp://0.0.0.0:10400' --preload-model 'ok_nabu' --debug 2>&1 | tee -a "$HOME/wyoming-satellite.log" & 37 | else 38 | export OWW_FLAGS="" 39 | fi 40 | 41 | wlog "Enter wyoming-satellite directory..." 42 | cd "$HOME/wyoming-satellite" 43 | 44 | wlog "Ensure module-sles-source is loaded..." 45 | if ! pactl list short modules | grep "module-sles-source" ; then 46 | pactl load-module module-sles-source 47 | fi 48 | 49 | stdbuf -oL -eL python3 ./script/run \ 50 | --name "$SATELLITE_NAME" \ 51 | --uri 'tcp://0.0.0.0:10700' \ 52 | --mic-command 'rec -r 16000 -c 1 -b 16 -e signed-integer -t raw --no-show-progress -' \ 53 | --snd-command 'play -r 22050 -c 1 -b 16 -e signed-integer -t raw --no-show-progress -' \ 54 | --awake-wav ./sounds/awake.wav \ 55 | --done-wav ./sounds/done.wav \ 56 | --timer-finished-wav ./sounds/timer_finished.wav \ 57 | --timer-finished-wav-repeat 5 0.5 \ 58 | $OWW_FLAGS \ 59 | --debug 2>&1 | tee -a "$HOME/wyoming-satellite.log" -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/data/data/com.termux/files/usr/bin/sh 2 | 3 | echo "Enter home directory" 4 | cd ~ 5 | 6 | echo "Update packages and index" 7 | pkg up 8 | 9 | echo "Ensure wget is available..." 10 | if ! command -v wget > /dev/null 2>&1; then 11 | echo "Installing wget..." 12 | pkg install wget -y 13 | if ! command -v wget > /dev/null 2>&1; then 14 | echo "ERROR: Failed to install wget" >&2 15 | exit 1 16 | fi 17 | fi 18 | 19 | echo "Clean up potential garbage that might otherwise get in the way..." 20 | wget -qO- https://raw.githubusercontent.com/T-vK/wyoming-satellite-termux/refs/heads/main/uninstall.sh | bash 21 | 22 | echo "Ensure sox is available..." 23 | if ! command -v rec > /dev/null 2>&1; then 24 | echo "Installing sox..." 25 | pkg install sox -y 26 | if ! command -v rec > /dev/null 2>&1; then 27 | echo "ERROR: Failed to install sox (rec not found)" >&2 28 | exit 1 29 | fi 30 | if ! command -v play > /dev/null 2>&1; then 31 | echo "ERROR: Failed to install sox (play not found)" >&2 32 | exit 1 33 | fi 34 | fi 35 | 36 | echo "Ensure termux-api is available..." 37 | if ! command -v termux-microphone-record > /dev/null 2>&1; then 38 | echo "Installing termux-api..." 39 | pkg install termux-api -y 40 | if ! command -v termux-microphone-record > /dev/null 2>&1; then 41 | echo "ERROR: Failed to install termux-api (termux-microphone-record not found)" >&2 42 | exit 1 43 | fi 44 | fi 45 | 46 | echo "Checking if Linux kernel supports memfd..." 47 | KERNEL_MAJOR_VERSION="$(uname -r | awk -F'.' '{print $1}')" 48 | if [ $KERNEL_MAJOR_VERSION -le 3 ]; then 49 | echo "Your kernel is too old to support memfd." 50 | echo "Installing a custom build of pulseaudio that doesn't depend on memfd..." 51 | export ARCH="$(termux-info | grep -A 1 "CPU architecture:" | tail -1)" 52 | echo "Checking if pulseaudio is currently installed..." 53 | if command -v pulseaudio > /dev/null 2>&1; then 54 | echo "Uninstalling pulseaudio..." 55 | pkg remove pulseaudio -y 56 | fi 57 | echo "Downloading pulseaudio build that doesn't require memfd..." 58 | wget -O ./pulseaudio-without-memfd.deb "https://github.com/T-vK/pulseaudio-termux-no-memfd/releases/download/1.1.0/pulseaudio_17.0-2_${ARCH}.deb" 59 | echo "Installing the downloaded pulseaudio build..." 60 | pkg install ./pulseaudio-without-memfd.deb -y 61 | echo "Removing the downloaded pulseaudio build (not required after installation)..." 62 | rm -f ./pulseaudio-without-memfd.deb 63 | else 64 | if ! command -v pulseaudio > /dev/null 2>&1; then 65 | pkg install pulseaudio -y 66 | fi 67 | fi 68 | 69 | if ! command -v pulseaudio > /dev/null 2>&1; then 70 | echo "ERROR: Failed to install pulseaudio..." >&2 71 | exit 1 72 | fi 73 | 74 | echo "Starting test recording to trigger mic permission prompt..." 75 | echo "(It might ask you for mic access now. Select 'Always Allow'.)" 76 | termux-microphone-record -f ./tmp.wav 77 | 78 | echo "Quitting the test recording..." 79 | termux-microphone-record -q 80 | 81 | echo "Deleting the test recording..." 82 | rm -f ./tmp.wav 83 | 84 | echo "Temporarily load PulseAudio module for mic access..." 85 | if ! pactl list short modules | grep "module-sles-source" ; then 86 | if ! pactl load-module module-sles-source; then 87 | echo "ERROR: Failed to load module-sles-source" >&2 88 | fi 89 | fi 90 | 91 | echo "Verify that there is at least one microphone detected..." 92 | if ! pactl list short sources | grep "module-sles-source.c" ; then 93 | echo "ERROR: No microphone detected" >&2 94 | fi 95 | 96 | echo "Ensure git is available..." 97 | if ! command -v git > /dev/null 2>&1; then 98 | echo "Installing git..." 99 | pkg install git -y 100 | if ! command -v git > /dev/null 2>&1; then 101 | echo "ERROR: Failed to install git" >&2 102 | exit 1 103 | fi 104 | fi 105 | 106 | echo "Cloning Wyoming Satellite repo..." 107 | git clone https://github.com/rhasspy/wyoming-satellite.git 108 | 109 | echo "Enter wyoming-satellite directory..." 110 | cd wyoming-satellite 111 | 112 | echo "Running Wyoming Satellite setup script..." 113 | ./script/setup 114 | cd .. 115 | 116 | echo "Write down the IP address (most likely starting with '192.') of your device, you should find it in the following output:" 117 | ifconfig 118 | 119 | echo "Setting up autostart..." 120 | mkdir -p ~/.termux/boot/ 121 | wget -P ~/.termux/boot/ "https://raw.githubusercontent.com/T-vK/wyoming-satellite-termux/refs/heads/main/wyoming-satellite-android" 122 | chmod +x ~/.termux/boot/wyoming-satellite-android 123 | 124 | echo "Setting up widget shortcut..." 125 | mkdir -p ~/.shortcuts/tasks/ 126 | ln -s ../../.termux/boot/wyoming-satellite-android ./wyoming-satellite-android 127 | 128 | 129 | echo "Successfully installed and set up Wyoming Satellite" 130 | echo "Install Wyoming OpenWakeWord as well? [y/N]" 131 | read install_oww 132 | if [ "$install_oww" = "y" ] || [ "$install_oww" = "Y" ]; then 133 | echo "Ensure python-tflite-runtime, ninja and patchelf are installed..." 134 | pkg install python-tflite-runtime ninja patchelf -y 135 | echo "Cloning Wyoming OpenWakeWord repo..." 136 | cd ~ 137 | git clone https://github.com/rhasspy/wyoming-openwakeword.git 138 | echo "Enter wyoming-openwakeword directory..." 139 | cd wyoming-openwakeword 140 | echo "Allow system site packages in Wyoming OpenWakeWord setup script..." 141 | sed -i 's/\(builder = venv.EnvBuilder(with_pip=True\)/\1, system_site_packages=True/' ./script/setup 142 | echo "Running Wyoming OpenWakeWord setup script..." 143 | ./script/setup 144 | sed -i 's/^export OWW_ENABLED=false$/export OWW_ENABLED=true/' ~/.termux/boot/wyoming-satellite-android 145 | cd .. 146 | echo "Launch Wyoming OpenWakeWord and Wyoming Satellite now? [y/N]" 147 | else 148 | echo "Launch Wyoming Satellite now? [y/N]" 149 | fi 150 | 151 | read launch_now 152 | if [ "$launch_now" = "y" ] || [ "$launch_now" = "Y" ]; then 153 | echo "Starting it now..." 154 | ~/.termux/boot/wyoming-satellite-android 155 | fi --------------------------------------------------------------------------------