Back to the Command-line
For some reason, MS Edge for Linux does not have the Read Aloud feature which is the only reason I would like to use Edge. The TTS engine made by Microsoft sounds incomparable to those poorly made chrome extensions.
Therefore, I found a work around with edge-tts. This is a CLI tool uses Edge TTS service. The instruction on its Github repo is very good.
After installation, use edge-tts --list-voices | grep US
to show English speaking characters and now I can locate a text file in the terminal to be read.
edge-playback --voice en-US-AriaNeural --file "tts.txt"
This command would read aloud the entire text file with subtitles output in the terminal, very cool.
edge-tts --voice en-US-AriaNeural --file "tts.txt" --write-media "tts.mp3"
This command would generate a mp3 file from the text file.
I tried to make offline audiobook by this and found out it would run into a connection issue if the text is too long. This might be an API protection mechanism against abuse.
Thus, when I need to make a long book, I have to separate it into pieces and consolidate them by using ffmpeg.
ffmpeg -i "concat:part1.mp3|part2.mp3" -c copy output.mp3
or
(for %i in (*.mp3) do @echo file '%i') > mylist.txt
ffmpeg -f concat -i mylist.txt -c copy output.mp3
Either would work depending how many files I want to merge.
I have tried different GUI tools and none of those works reliably. This is by far the most reliable yet easy way if you’re comfortable with the command-line.
GrapheneOS
Because GrapheneOS doesn’t provide any TTS engine by default. I use Feeder regularly for RSS and sometimes I want to listen instead of read. This tool brings Edge TTS into Android which is very cool.
It compromises some privacy by using TTS engines. That’s why it’s not something out-of-the-box for a hardened Android build. This is a trade-off and I’d rather use Edge TTS than Google’s.