When it comes to an offline Screen Reader there are options on Parrot like Orca or Festival, which are Accessibility-focused but normally this type of software is pointed towards usability -and over-complicated extensibility- more than voice quality, in this case we aim to a more Natural Voice, so articles, emails or chats can be heard without a so robotic tone.
apt install libmp3-info-perl libmp3-tag-perl libsox-fmt-mp3 libunicode-string-perl sox xsel mpg321 python3-pip
This is why you require
pip (Python Package Installer) also
gTTS (Google Text-to-Speech), library and CLI tool to interface with Google Translate’s text-to-speech API, that’s what makes most of the job.
pip install gTTS
There are two ways to do this, the Manual way and the Manuel way.
CLI-ready, Select, Execute: Select a text placed anywhere on your desktop,
xsel will pipeline the order on the CLI and you’ll hear the voice reading.
xsel | gtts-cli --nocheck - | mpg321 -
xsel | gtts-cli --nocheck --lang es - | mpg321 -
Just create a keyboard shortcut or keybinding: Parrot comes with MATE so you can just Add another one to the existing list, it’ll do the same work. Bind the command to a key combination e.g., Ctrl + Shift + R.
bash -c "xsel | gtts-cli --nocheck - | mpg321 -"
bash -c "xsel | gtts-cli --nocheck --lang es - | mpg321 -"
What’s next? Well, I would say being able to control the playing, like pause and resume functions, a GUI maybe? However, if you know an existing implementation (or have made one) for such things you can PM me anytime here or over the Telegram groups and make great things with this one.