How to: Run Wyoming Satellite and OpenWakeWord on Android

Yeah, I recently added the UI installer. But that makes sense because it starts with an empty file before appending the parameters in the installer. The configure command pretty much skips all the install aspect, apart from running the config commands.

Huge thank you to you (and to randomuser123) for the work on this. I’ve got it running on a couple devices so far and it’a fantastic in so many ways.

Was trying to tweak it to stop getting as many false positive wakeword detections though and am having trouble finding how to modify the vad_threshold, any thoughts?

It needs to be set in the service file, open up $PREFIX/var/service/wyoming/run and you can set it pretty much at the bottom of the file as an extra parameter (wyoming-satellite-termux/services/wyoming-satellite-android at c2f10985011ecd1b86fdbd8c9921e5ab05b64512 Ā· pantherale0/wyoming-satellite-termux Ā· GitHub)

New line and --vad-threshold value \ after this line above will do the trick.

Forgive my ignorance, but I’m not seeing those directories in the termux home directory. I did find a threshold value in the setting.py file in the ~/wyoming-satellite/wyoming_satellite/ directory, I tried modifying it to see if that has the same effect.

Edit: I didn’t realize you could go above the home directory in termux, went one level higher and found the usr directory with the folders & files you mentioned, thanks for your help!

1 Like

No problem, $PREFIX is kind of the equivalent of / within a termux session. Although you can cd to / this is the root of the android system itself and not the termux data directories.

Even after adjusting the vad threshold to 1.0 I’m still getting way too many false activations and it’s hurting the WAF, going to try swapping in a more complicated wakeword to see if I can reduce them. Is changing it as simple as dropping a new tflite file in the ~/wyoming-openwakeword/wyoming_openwakeword/models directory and modifying the wyoming.conf file to show "SELECTED_WAKE_WORD=ā€œname-of-tflite-fileā€?

what wake word are you using at the moment? Alexa has been pretty bad in my view. Improved slightly by changing the threshold to 0.7 but it still goes off if you breathe the wrong way or a dog barks.

I’ve been using ā€œhey jarvisā€, I’d assume that some others like ā€œokay nabuā€ are probably better trained, but figured if I’m going to change it up I will try something with more syllables, since that feels like an obvious way to get less false activations.

I’ve loaded in some of the longer options from the unofficial wakeword repository here:

I’m away from home at the moment though, so hard to test it over a VPN lol.

FWIW, changing the vad threshold did not seem to have any noticable effect on the false positive activations, which makes me wonder if the change actually carried through.

Edit: tried running it with a new tflite model and got an error in handler.py line 244, presumably when it tries to validate/process the model filename. I kinda expected it wouldn’t be that easy, haha.

Thanks heaps for this amazing project! I was able to get it up and running on my FireHD 10" Tablet, after I did the modification above.
I was trying to run /script/run (expecting it to start the satellite after the modification) but it threw an error. I did then reboot the Tablet and thanks to Termux-boot, it started without probs.

(How could I start it from the console without a reboot?)

My question: I noticed the pick-up range of the microphone of this Amazon Tablet is quite low, @randomuser123 is it possible to select a microphone via Termux? I am thinking to add an USB-C microphone to the tablet to increase the pick-up range. But I’m not sure if Termux can handle different microphones…

I haven’t tried that, but if the OS just picks it up automatically like a Bluetooth headset, then maybe it will just automatically default to that mic.

Chiming back in to mention that the config script expects the tflite filename to have a version number, adding one to the filename of additional models fixes the issue I was seeing and allows other models to be used.

thank you @randomuser123 and @pantherale0
I was able to set up my Lenovo Smart Clock 2, I also got the error:
wyoming-eventsL unable to change to service directory: file does not exist
but just ignored it.
One other issue I encountered was with termux services autostart which i believe was fixed by enabling termux and termux.boot in DuraSpeed.

Yes, that error can be ignored, I’ve not accounted for cases where certain services aren’t installed in my cli / install scripts.

I actually haven’t noticed any autostart issues, but I use wallpanel’s / FSK’s autostart feature to launch Termux so hasn’t been a problem.

Hey, just wanted to put a quick correction to this item in case anyone else stumbles across this. The ā€œā€“vad-threshold <value 0-1>ā€ is a flag for the wyoming-satellite service thats meant to be used when handling wakeword detection centrally on your HA server. It has no impact when you’re using on-device wakeword detection.

Easy mistake to make and documentation is very confusing on this. The argument you need is just ā€œā€“threshold <value 0-1>ā€ and it needs to be put at the end of the wyoming-wakeword service file, not the wyoming-satellite service file.

Took me a long time to realize this is why my wakeword false detection rate wasn’t improving lol.

2 Likes

@pantherale0 I haven’t been able to get the events functionality to work. I setup the Home Assistant URL and access token, and I see the log file created but nothing is added after the initial startup line and ā€œroot - INFO - Readyā€

I see the process running in termux, but no connections to my home assistant server on port 8123

Any suggestions?

Have you tried to trigger something? It won’t output or make a connection to HA unless something is actually triggered.

Yeah I interacted with the satellite and watched all events, didn’t see anything from wyoming_*

I did see the extended openai events and tts events.

I solved the problem by reinstalling. Nice work on the installer, a very slick package!

1 Like

Wanted to report here that I got this running via the scripts on a Lenovo Smart Tab M8 TB-8505FS.

I did notice that the sound quality seems less than when I set this up using the Stream Assist pipeline.

My last 2 items I’m looking to complete for this setup is;

  1. Now that it is set up, how can I go about switching the Wake Sound before and after the assistant starts speaking. I already have the file / sound / chime I want to use in my Home Assistant install.

  2. How can I easily switch the wake word from ā€œOk Nabuā€ to ā€œHey Jarvisā€ now that it’s set up already.

**Update

After bouncing my 2 brain cells against each other I managed to solve the 2 changes above.

  1. Send the sound file to the device (SSH or even just email it)
  2. Move the .wav file to the folder /wyoming-satellite/sounds
  3. Locate and edit the file .termux/boot/wyoming-satellite-android (I used Acode editor for my android device but you can probably open/edit via nano)
  4. Edit line(s) starting at 54 depending on which sound you want to change.
  5. Bonus : Since you are already in here, you can also change the wake word prompt from "Ok Nabu" to one of the others by editing lines 33 and 36 replacing "ok_nabu" with your prompt of choice.
  6. Reboot the device

This is HUGE! Wow! I set this up on a Lenovo ThinkSmart View (TSV) last night running lineageOS 15.1, and only ran into a few hiccups.

  1. Your instructions/script didn’t include installing python3, so I had to do a pkg install python3 and re-run the install.sh
  2. I also ran into the same error as @mterry63, where when it ran pactl load-module module-sles-source I got Failure: Module initialization failed, probably for the same reasons you did, but doing the export change you recommended didn’t help but running pulseaudio --start resolved the issue
  3. I had to run the install.sh a few times, there were a few errors that popped up that resolved after either just re-running, or applying the fixes I cited above (/shrug)

A couple of notes:

  1. After doing all this installation, without OpenWakeWord (I use the add-on), Termux ends up using ~750MB of space. Not horrible, but something to be aware of as the TSV is pretty constrained on disk space. If there are ways to cut down on the footprint I’d love to hear them.
  2. If your network is slow to connect on boot, then when this tries to launch too early with Termux:Boot, it fails in the wyoming launch because there’s no available network device to use, so you have to launch it manually after connecting. I’ll sort out a modification to the script to wait for network connectivity, but I want to get the test as precise as possible to the launch requirements.
  3. The difference between something like this and something like StreamAssist is that because it’s not using an HA media player, I think your only useful volume control is the device volume control, so keep that in mind.

With all of that said, this was a vast improvement in experience for me, as I’ve found the durability of this solution is MUCH higher than I what got with the StreamAssist audio output running through StreamAssist->MusicAssistant->Snapcast->Tablet Snapdroid Client (High latency to start, and cutting off the beginning of audio sometimes) or BrowserMod (Had persistent issues with the browser audio player being unavailable, and poor muxing of music and voice commands). I went from fiddling with it 1-2 times a day to ā€œIt just worksā€, and haven’t had an issue other than the reboot/network connectivity bit I mentioned.