Adds text to speech capabilities using piper as a backend
- Install piper on any device within your network using
pip install piper-tts>=1.3.0
I tried getting piper to work on my kindle, but did not succed, so I instead run it on my computer and connect to it via my local WiFi. It could in theory run on a phone in Termux, but the package is broken there right now - Download a piper voice and try it out with this guide
- Set up the piper web server with this guide
- Download this repo
- Change the
playfile to be able to play audio files on your target device. The default one uses the sox KUAL app from mobileread, so install it if you're on Kindle - Change the
stop_playingfile be able to interrupt playback. Again, the default file is made for sox on kindle - Drop the entire TTS.koplugin directory into koreader/plugins on your device
- Run the piper web server from before and remember the IP and port it gives you
- Open koreader, open a book, click on "Start TTS mode" in the typesetting menu, click on the settings icon, click on "TTS server URL" and input the ip you remembered
- You're done!
the play is invoked with the file name to play as the first argument and the volume as the second argument.
The plugin thinks the playback is finished when the script outputs any charachter,
so make sure to >/dev/null 2>/dev/null anything that can output text and add an echo at the end
the stop_playing is run to interrupt playback, so it should kill the program you used in the play script
the on_tts_start script is run when you click the "Start TTS mode" button in koreader.
You can put stuff like connecting to bluetooth headphones there