How to: Run Wyoming Satellite and OpenWakeWord on Android

i don’t know what you change, but it seems to work for the wake word part, no stt is recognized for now but it’s a huge step forward !!! thanks a lot i will update my findings later

I’m a bit confused. Did you make my suggested debugging modifications and that in itself fixed it? That would seem very odd to me.
Or did the modifications help finding the actual problem?

just the debugging suggestions i guess, i have to go for now but i will test without the debugging part, and it is fully working i have to tweak some settings in whisper /home assistant part :wink: thanks again fo sur it will be a game changer for using (old) android devices !

Glad to hear to it’s working for you now. I hope we can figure out what was wrong so that I can fix the install script in that regard for other users with the same issue in the future.

Hello, I’ve found this amazing repo which allows you to run docker containers in Termux.

I’ve forked it and I was able to run wyoming-microwake-word container in Termux. My goal is to run Wyoming satellite and micro wake word on NS Panel Pro. Currently I don’t have much free time. So I’m at first stage. In theory it could be possible to run Wyoming satellite in way discribed above and just point it to the micro wake word. This is what I plan to test next week.

I’d like to share my current progress with you, if you guys want to try it sooner. I made a pull request to the original repo, but it’s pending. So meanwhile you can clone my fork GitHub - kasparmir/HomeAssistant-Termux: Host Home Assistant Docker Container in Android Device..

It’s really easy to run it. Just run install_udocker.sh script and then the wyoming-microwake-word.sh script.

Docker is probably the easiest way to get wake word detection to run on Android at the moment and it’s great to hear you’ve got it running.

At first I was actually considering running Ubuntu inside of Termux using a proot, so that I could run the official wyoming docker images inside of it, but I ended up deciding against it because I’d expect it to be a lot of work to pass through the audio devices or connect the pulseaudio server through a proot into multiple docker containers.
I’m sure it is possible, but getting tflite or Tensorflow to work on Android might be easier because then we could simply install openwakeword directly.

I mostly agree with you. Running it directly would be the best option. I tried the same thing like you few months ago. Like you I was able to run satellite. Never get wake word engine to work because of tflite.

Running the Docker in Termux is hard, almost impossible. You have to compile your own kernel, root the device, etc.

This variant with udocker implementation works best for me. My vision is to run only the wake word engine in the container and a satellite directly. So I am gonna avoid problems with pulseaudio. At least for now. Until someone makes tflite work in Termux.

I see, yeah udocker sounds like a promising option.
Standard docker is indeed not easy to install on Termux, but inside a proot I think it’s not that difficult given that your kernel isn’t too old. I’ve read multiple reports of people who managed to get it to work without custom kernels. But I haven’t actually tried it myself.

I think the difficult thing with udocker will be to get the shared mic access to work.
But definitely keep us posted when you make progress. :slight_smile:

So I just spent some more time researching and trying to get wyoming-openwakeword to run natively and after some tweaking, I finally manged to get both wyoming-openwakeword and wyoming-satellite to run together on Termux:

I’ll properly document the required steps taken soon and provide a proper script to automate the setup, but it was sth. close to this:

pkg i -y python-tflite-runtime ninja patchelf
git clone https://github.com/rhasspy/wyoming-openwakeword.git
cd wyoming-openwakeword
sed -i 's/\(builder = venv.EnvBuilder(with_pip=True\)/\1, system_site_packages=True/' ./script/setup
./script/setup
script/run --uri 'tcp://0.0.0.0:10400' --preload-model 'ok_nabu'

I tried without the debugging part and its still work, may be i did not installed correctly some componoment.
I have a bug when the device had a reboot its ask me for add a wyoming device throught home assistant, how can i store an “identification” which does not ask me to add a new device every time i reboot the device ?

I’m not sure to be honest. For me autodiscovery for wyoming in HA has never worked. Maybe if you can disable it if you add --no-zeroconf to the run command of wyoming-satellite.

I looked at the source code of the UI and we would have to rewrite huge parts of it order to make it work with Termux because it was written with Raspberry Pi in mind only, depending on stuff like systemd and ALSA.

Updated the install script to ask if you want to install Wyoming OpenWakeWord as well. Install script need to be run a this way now:

bash <(wget -qO- https://raw.githubusercontent.com/T-vK/wyoming-satellite-termux/refs/heads/main/install.sh)

I have to reinstalled because my device didn’t work properly.
can you add a check for python and git packages ? i did install the script from scratch but didn’t install sox, pulseaudio git and python packages.
The “pkg i -y wget” didn’t work for me may be you could use “pkg install wget -y” instead, same things for other termux commands in the script i guess

Okay, I pushed a fix accordingly. Try again now.

it worked but i was still have my previous error with SIGSYS :31
I just add the lines you provided in the /wyoming-satellite/wyoming-satellite/main.py and it’s working now, don’t know why !
For the termux boot part we need to turn off the battery optimization in android settings, even if there is no battery in the device :wink:
https://wiki.termux.com/wiki/Termux:Boot

very strange, it is again not working anymore, does the script use some storage ? It s not lookig full except for /dev/block/dm-3, a df -h command looks like this

> Filesystem                                      Size  Used Avail Use% Mounted on
> /dev/block/dm-3                                 586M  584M     0 100% /
> tmpfs                                           491M  1.5M  489M   1% /dev
> tmpfs                                           491M     0  491M   0% /mnt
> tmpfs                                           491M     0  491M   0% /apex
> /dev/block/dm-4                                 111M  111M     0 100% /vendor
> /dev/block/dm-5                                 417M  416M     0 100% /product
> /dev/block/platform/bootdevice/by-name/userdata 4.2G  1.9G  2.3G  46% /data
> /dev/block/platform/bootdevice/by-name/cache    103M  1.8M   98M   2% /cache
> /data/media                                     4.2G  1.9G  2.3G  46% /storage/emulated

when i try play awake.wav it work, it seems like the microphone dont

I wrote the script to log to ~/wyoming-satellite.log
That is the only source for storage problems I can think of right now. Check the file size. If it’s too big, I will try to implement a size limit for the log.

I have found an ugly workaround using proot-dist but it is working, before I was getting exactly the same error as you were, my device is a samsung S8+.this is what I did:
(voice transcription isn’t perfect doing this method)
Directly on termux update packages and install termux api, pulseaudio and proot-distro
pkg install -y termux-api pulseaudio proot-distro
Now edit a file called default.pa, comment # a line that says load-module module-suspend-on-idle
nano /data/data/com.termux/files/usr/etc/pulse/default.pa
After that I started a pulseaudio “server”
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1
Installed ubuntu
proot-distro install ubuntu
and logged in
proot-distro login ubuntu
in ubuntu I have installed git, pulseaudio, sox and python3-venv
apt install -y git pulseaudio sox python3-venv
edited the same pulseaudio file, this time in ubuntu, again commenting the same line as above #load-module module-suspend-on-idle
nano /etc/pulseaudio/default.pa
Connected to the “pulseaudio server” from termux:
export PULSE_SERVER=127.0.0.1:4713
Verified that it was working:
pactl list short sources | grep "module-sles-source.c"
should say IDLE not SUSPENDED
And followed the instructions from the manual install listed on the first post, starting at “git clone …”

Ugly workaround but it finally works, voice detection isn’t the best, now I have to create a system service to run at boot…