Close

ChromeVox Next offline TTS client, a sister project

A project log for Android offline speech recognition natively on PC

Porting the Android on-device speech recognition found in GBoard to TensorFlow Lite or LWTNN

biemsterbiemster 11/30/2020 at 15:232 Comments

In a large part my reason to start this speech recognition project was for home automation,  and to get some feedback from my home a logical companion project is the reverse of speech recognition: Text to Speech (TTS). The offline TTS on Android has quite a pleasant voice and seemed to be running on Chrome on Desktop as well, so it made a perfect combination with the recognition pipeline.

With the recognition project waiting for SODA to be released for Chrome, I had a bit of time to tackle this TTS, which turned out to be quite a bit easier, and definitely quicker!

I started with getting a copy of Chrome OS in a virtual machine, courtesy of neverware.com. Incidentally I also found a page in the Chrome source repo mentioning that the TTS part of Chrome OS can be downloaded separately.

After a weekend of getting ltrace running on chromeos, and tracing the calls to the googletts library, I wrote a tiny (~50 lines of C) client which pipes any Google voice (there are quite many languages available) to for example ALSA:

./gtts "Hello from Google Text to Speech!" | aplay -r22050 -fFLOAT_LE -c1

It's just a tiny proof of concept, which can easily be added to any C/C++ project out there. Also a python wrapper would be awesome, maybe I get to that someday (or maybe you want to pick that up?). Code lives on github, if you decide to use it don't forget to leave a comment below! 

Discussions

a1is wrote 12/09/2020 at 13:26 point

Thanks for you work, it's awesome!!!

May be it will be useful for someone: i use zvoice package from com.google.android.tts version 22.13.316510576 (apkpure.com) because my lang wasnt found in googletts-<version>.tar.xz (unzip apk and ulrs can be founded in /assets/superpacks_manifest.json)

Also for tempo and pitch you can use ffmpeg (and also for save after to file / change format)

./gtts "$text" | ffmpeg -f f32le -ar $((22050*100/100)) -ac 1 -i - -f s16le -ar 44100 -ac 2 -af atempo=100/110 - | paplay --raw

  Are you sure? yes | no

biemster wrote 12/10/2020 at 13:35 point

Nice find for the zvoice files! I tried some v23 zvoice files which did not work, good to know the v22 do work. Apparently the ChromeOS TTS is one version behind Android.

  Are you sure? yes | no