Skip to main content

Sysadmin, interested in new technologies, communications, multimedia, accessibility, better Linux than Windows, better Android than IOS and similar.

twitter.com/pvagner

www.facebook.com/pvdeejay

mastodon.sk/@pvagner

Peter Vágner

Building eSpeak-ng for Android with libsonic built-in

2 min read

By a popular demand I have written a few steps how I am building espeak-ng for android.
ESpeak-ng has a optional dependency on a library called libsonic.
It's not critical for its functionality but it allows speeding up synthesised voice so we can get eSpeak-ng speaking at very very fast speech rates.
On linux the build system is configured to take advantage of system wide installation of all the required libraries. This does not nicely apply to the cross compilation for Android as all the libraries have to be prebuilt for the target platform.
And since there is no other distribution channel for the libsonic library other than its git repository with its source code, there are no prebuilt libraries for android.
To workaround this I am cloning libsonic repository, linking its files to the eSpeak-ng source tree and then patching eSpeak-ng source code to include the libsonic files as if these were part of eSpeak-ng it-self.

I am running all this on arch linux, but debian, ubuntu and any other linux distro with gradle, Android-SDK 26, android-sdk-build-tools 28.0.3, recent enough version of android-ndk will work fine.
I like to install all these components via the linux distro package manager.
Espeak-ng Readme has even more details I can write here. There are also some android specific dependencies

If everything is installed here are the commands I can run from the terminal:
mkdir ~/espeak # create a working folder
cd ~/espeak # enter that folder
git clone https://github.com/espeak-ng/espeak-ng.git # clone espeak-ng git repo
git clone https://github.com/espeak-ng/sonic.git # clone libsonic repository
ln -s ../../../sonic/sonic.{c,h} espeak-ng/src/libespeak-ng/ # link sonic files to eSpeak-ng source tree
wget https://files.pvagner.tk/f/e9c6874015fd4241b6c2/?dl=1 -O espeak-ng-libsonic-android.patch # download a patch
cd espeak-ng # change directory to the espeak-ng repo
patch -p1 < ../espeak-ng-libsonic-android.patch # apply the changes from the patch
./autogen.sh # prepare the configure script
./configure --prefix=/usr --with-gradle=gradle --with-extdict-ru --with-extdict-zh --with-extdict-zhy # run the configure script
make apk-debug # build the actual apk

The resulting app is placed in the path android/build/outputs/apk/debug/espeak-debug.apk
You can install this on your device and enjoy fast rates up to 800 WPM.

Peter Vágner

Essential reading if you can dive more into reproducible builds https://nico.dorfbrunnen.eu/posts/2019/reproducibility-fdroid/

Peter Vágner

radio app for is now at v3.2.0. Except of things listed in the changelog it features a few improvements and slovak translation. Enjoy a simple but powerfull app with Talkback or any other screen reader of choice. Gplay: https://play.google.com/store/apps/details?id=org.y20k.transistor F-Droid (coming soon): https://f-droid.org/repository/browse/?fdid=org.y20k.transistor

Peter Vágner

hmmm. I feel we all users relying on its shal start looking for a different platform of choice to the future. https://gitlab.gnome.org/GNOME/gtk/issues/1739

Peter Vágner

oh damn! v18 does not handle keyboard input when playing games via built-in https://forum.kodi.tv/showthread.php?tid=340080

Peter Vágner

Peter Vágner

Peter Vágner

Peter Vágner

Peter Vágner