johnfactotum / foliate

Read e-books in style
https://johnfactotum.github.io/foliate/
GNU General Public License v3.0
6.3k stars 288 forks source link

TTS #354

Closed ramnath-1998 closed 3 years ago

ramnath-1998 commented 4 years ago

can you explain how to enable the TTS feature using any of the tools that are available, in detail.

johnfactotum commented 4 years ago

You need to specify a command in the preferences.

If you have espeak-ng installed, you can use espeak-ng as the command.

For Festival, the command is festival --tts.

You can choose different voices or languages, as well as other options, by changing the command. Run man espeak-ng or man festival in the terminal to see detailed instructions on how to configure these programs.

From the wiki:

How to use text-to-speech?

Foliate supports espeak/espeak-ng and festival. The exact command can be configured in the preference dialog.

Other speech synthesis programs can be used, but Foliate expects the following interface:

  1. The program would read text from stdin and speak them
  2. Return when finished speaking
  3. Stop speaking when SIGINT is received

If the program doesn't support this, one can write a wrapper script and set it as the TTS command. For example, to use gTTS, the following script can be used:

#!/bin/bash
gtts-cli --file /dev/stdin | play -t mp3 - &
trap 'kill $!; exit 0' INT
wait
tttranquilooo commented 4 years ago

@ramnath-1998 For Debian based systems I suggest using festival.

  1. You need to install festival(TTS engine) and some festvox-* packages(other voices, the default voices are unbearable).
  2. Then go to your home and create a .festivalrc and set a default voice with (set! voice_default voice_name).
  3. And you need to type your TTS command in Foliate's preferences. Once you typed, a headphone icon will appear in the bottom bar. Click to start TTS.

For example, I want to use festival with 'en1_mbrola' voice. I will type in Terminal:

sudo apt install festival festvox-en1
echo "(set! voice_default en1_mbrola)" >> .festivalrc

Then type: festival --tts in Foliate-->preferences-->Text-to-speech command.

Happy reading :smile:

ramnath-1998 commented 4 years ago

I tried. But its not working.

On Thu, May 14, 2020 at 11:56 AM Blanc Chan notifications@github.com wrote:

@ramnath-1998 https://github.com/ramnath-1998 For Debian based systems I suggest using festival.

  1. You need to install festival(TTS engine) and some festvox-* packages(other voices, the default voices are unbearable).
  2. Then go to your home and create a .festivalrc and set a default voice with (set! voice_default voice_name).
  3. And you need to type your TTS command in Foliate's preferences. Once you typed, a headphone icon will appear in the bottom bar. Click to start TTS.

For example, I want to use festival with 'en1_mbrola' voice. I will type in Terminal:

sudo apt install festival festvox-en1

echo "(set! voice_default en1_mbrola)" >> .festivalrc

Then type: festival --tts in Foliate-->preferences-->Text-to-speech command.

Happy reading 😄

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/johnfactotum/foliate/issues/354#issuecomment-628416295, or unsubscribe https://github.com/notifications/unsubscribe-auth/APSILV2XNK6YBV3TRKIUR5LRROFIPANCNFSM4NAARH4A .

tttranquilooo commented 4 years ago

@ramnath-1998 can you provide more detailed information? Such as your OS type, what tts engine you installed? and if possible, any terminal info or screenshot?

lelinhtinh commented 4 years ago

Make sure gtts-cli and sox are installed:

gtts-cli --version
sox --version

Try again with bash -c, Preferences -> Text-to-speech command:

bash -c "gtts-cli -l $FOLIATE_TTS_LANG_LOWER --file /dev/stdin | play -t mp3 - &
trap 'kill $!; exit 0' INT
wait"
johnfactotum commented 3 years ago

Closing due to inactivity. Feel free to comment if you have any further questions.