Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to change Foliate's TTS client? #723

Closed
ebulutt opened this issue May 3, 2021 · 12 comments
Closed

Is it possible to change Foliate's TTS client? #723

ebulutt opened this issue May 3, 2021 · 12 comments
Labels
question Further information is requested

Comments

@ebulutt
Copy link

ebulutt commented May 3, 2021

Question:
I am not a fan of reading books from a computer screen.

I install Foliate to listen to my epub books while I am working on the PC. It uses festival tts by default.

I have Glate on Ubuntu 20.04. And they say that Glate has Google TTS included. Can I and how can I use Google TTS on Foliate instead of festival tts?

Thank you in advance!

Version:

  • Foliate version: 2.6.3
  • OS/Distribution and version: Ubuntu 20.04
  • DE - Gnome 3
  • Installation method: I don't remember. Maybe snap?
@ebulutt ebulutt added the question Further information is requested label May 3, 2021
@johnfactotum
Copy link
Owner

@ebulutt
Copy link
Author

ebulutt commented May 3, 2021

(use man espeak-ng or man festival to see all the options)
what options and where? because I have tried both "man" but nothing has changed. I want to listen in Turkish language without a robotic voice.

@johnfactotum
Copy link
Owner

(use man espeak-ng or man festival to see all the options) what options and where? because I have tried both "man" but nothing has changed.

You can run man espeak-ng, etc., in your terminal emulator to see the available command line options. Then you can specify those options in Foliate, if desired.

I have Glate on Ubuntu 20.04. And they say that Glate has Google TTS included. Can I and how can I use Google TTS on Foliate instead of festival tts?

I think Glate is a GUI program. If you'd like to use Google's TTS with Foliate, I'd recommend using gTTS. Once gTTS is installed, save the following script (as described in the FAQ) to any location, say /home/user/gtts.sh:

#!/bin/bash
gtts-cli -l $FOLIATE_TTS_LANG_LOWER --file /dev/stdin | play -t mp3 - &
trap 'kill $!; exit 0' INT
wait

Then, in Foliate, set /home/user/gtts.sh as the TTS command.

@archisman-panigrahi
Copy link
Contributor

archisman-panigrahi commented May 3, 2021

In Ubuntu, in addition to gtts, one may have to install the packages sox and libsox-fmt-mp3 for this script to work.

pip3 install --user gTTs
sudo apt-get install libsox-fmt-mp3 sox

@ebulutt
Copy link
Author

ebulutt commented May 3, 2021

Now I am almost there. I installed gtts (since there was some problem with my pip command I solve it with this.) Then install that libsox as @apandada1 said. Now, where and how I will "save" that script? Did you mean in .sh file on text editor? Sorry if I am silly. :)

@johnfactotum
Copy link
Owner

Yeah, pasting it into a text editor and saving the file should work.

@ebulutt
Copy link
Author

ebulutt commented May 3, 2021

I did everything you've said and preferences look like that now:
https://ibb.co/VCzhXZV
and no sound on test or book.

@ebulutt
Copy link
Author

ebulutt commented May 3, 2021

ops sorry user shouldn't be folder name but mine :)
but still don't work.

@archisman-panigrahi
Copy link
Contributor

archisman-panigrahi commented May 3, 2021

Try marking the script as executable.

chmod +x /home/user/gtts.sh

The script works for me in KDE Neon 20.04. It is hard to debug why it is not working for you.

First check if gtts works in terminal.
Does this command say hello?

gtts-cli 'hello' | play -t mp3 -

If not, does it produce any error?

@ebulutt
Copy link
Author

ebulutt commented May 3, 2021

@apandada1 yes it says hello with that command.
after chmod command there is no action. nothing.

@archisman-panigrahi
Copy link
Contributor

Run foliate from the Terminal, and check the output when you run a text to speech in it.

@varlesh
Copy link

varlesh commented May 7, 2021

sox not good worked for me and not play first line.
But popular players worked fine. Try it!
cvlc:

gtts-cli -l $FOLIATE_TTS_LANG_LOWER --file /dev/stdin | cvlc --play-and-exit - &
trap 'kill $!; exit 0' INT
wait

mpv:

gtts-cli -l $FOLIATE_TTS_LANG_LOWER --file /dev/stdin | mpv --really-quiet - &
trap 'kill $!; exit 0' INT
wait

Repository owner locked and limited conversation to collaborators Jun 30, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants