11

How can I add a text to speech service or any other similar services to GoldenDict for offline use?

I am using Ubuntu 13.10 and I want to learn how to pronounce English words I don't know.

Glutanimate
  • 21,393
Mohammed Talat
  • 111
  • 1
  • 1
  • 5

8 Answers8

13

You can use the Programs tab to plug a text to speech software (espeak for example) into the GoldenDict.

Here are the steps:

  1. Install espeak:

    sudo apt-get install espeak
    
  2. Open GoldenDict and hit F3 to bring up the Dictionaries window (or select Edit/Dictionaries menu).

  3. On the Sources tab, select Programs tab.

  4. Click the Add button, select Audio for the Type column, enter espeak for the Name, and espeak -v en %GDWORD% for the Command Line column.

  5. Don't forget to check the Enabled box.

  6. Click OK

  7. Close the GoldenDict window and reopen it.

Now you have an item named espeak in your dictionaries and your translation results. Clicking the speaker icon in front of the word in espeak result, reads the word for you.

Moha Dehghan
  • 231
  • 2
  • 7
  • 1
    most people want to use en-us after -v so my command is espeak -v en-us %GDWORD% to use the American accent. if you want more options such as speed, etc. espeak --help tell every thing. – Amiri Apr 07 '17 at 16:41
  • IMO, it is worth to mention that for icon column you can use its original logo located at /usr/share/doc/espeak/docs/images/lips.png in Debian-based systems. – cartoonist Dec 28 '18 at 11:24
6

Recent versions of GoldenDict have a Programs tab in the settings menu where you can add custom commands to be run on your search term.

This forum post by wissam describes how to set up Google TTS with GoldenDict using the method described above:

if u want to use Google tts in GD u can do that following these steps:

  1. Edit -> Dictionaries -> Programs.

  2. click on Add and choose "Audio" in type field .

  3. in "Command Line" field copy and paste this command:

    bash -c "p=$(echo "%GDWORD%" |sed 's/ /+/g'); wget -q -U Mozilla -O - translate.google.com.vn/translate_tts?ie=UTF-8\&q=$p\&tl=en\&client=tw-ob | mpg123 -"
    
  4. click ok

    for languages other than english change tl=en in the command ,for example fr for french or es for spanish

Now this is online TTS of course and not necessarily what you are looking for but you can use the same method to add any type of TTS software to GoldenDict (e.g. espeak %GDWORD% as the command line).

Check this Q&A out for good TTS apps on Linux.

MortezaE
  • 463
  • 3
  • 7
Glutanimate
  • 21,393
  • i did as you said why it doesn't work i copied and paste the command to the command line and the speaker showed up and when i click on it nothing happens what the problem? – Mohammed Talat May 02 '14 at 21:53
  • @mohammed Yep, you're right. Not working for me, either. Strange thing is: It did work a few months ago when I first tried it out. An update might have broken it. Sorry :/ – Glutanimate May 03 '14 at 17:57
  • no problem sir just notify me if you found a solution, thanks. – Mohammed Talat May 06 '14 at 20:39
  • @mohammed You can see my answer. It works fine. – Moha Dehghan Apr 09 '15 at 19:27
  • change the command to this:

    bash -c "p=$(echo "%GDWORD%" |sed 's/ /+/g'); wget -q -U Mozilla -O - translate.google.com/translate_tts?tl=en&q=$p | mpg123 -"

    also be sure mpg123 is installed.

    – Ali Jul 17 '15 at 06:46
  • 1
    change the command to this: bash -c "p=$(echo "%GDWORD%" |sed 's/ /+/g'); wget -q -U Mozilla -O - https://translate.google.com.vn/translate_tts?ie=UTF-8&q=$p&tl=en&client=tw-ob | mpg123 -" – Mostafa Nov 27 '17 at 04:47
  • Don't forget to install mpg123. By default, it may be not there. – Karioki Jul 13 '18 at 14:44
3
bash -c "p=$(echo "%GDWORD%" |sed 's/ /+/g'); wget -q -U Mozilla -O - https://translate.google.com.vn/translate_tts?ie=UTF-8\&q=$p\&tl=en\&client=tw-ob | mpg123 -"

this worked for me.

Make sure you have installed mpg123: sudo apt install mpg123

Mostafa
  • 171
3

Google Text-To-Speech (TTS)

Don't forget make a symlink for simple_google_tts to your PATH (e.g. ~/bin or /usr/local/bin) to make it easier to access.

abu_bua
  • 10,783
Ridalm
  • 31
1

What worked for me:

  1. Install Crow Translate
  2. In GoldenDict, add crow -s en -u “%GDWORD%” to the "Programs" tab. The type should be "Audio". See figure below.

enter image description here

You can change the language of the TTS by changing the part -s en to another code like it for italian, fr for french, etc. See Crow translate documentation for details.

Kevin Bowen
  • 19,615
  • 55
  • 79
  • 83
Rick
  • 11
1

If you want native woman accent like google download from here (+500K words ~ 2GB): https://github.com/yousefvand/pronunciations

Xaqron
  • 1,272
1
  • Install translate-shell (https://github.com/soimort/translate-shell) with sudo apt install translate-shell
  • Go to goldendict program section and use bash trans -b -p :en %GDWORD% in the command section, type audio.

This will translate anything that you search to English and then speak the English translation. You can change the en in the code to say it in another language. Internet conection is required to work propearly.

Pablo J
  • 11
0

You can use swift program.

Example:

padsp /opt/swift/bin/swift -p "speech/rate=150,voice/cache-size=240000,audio/deadair=100" -n Diane "%GDWORD%"

fig

Kulfy
  • 17,696