How can I add text-to-speech to GoldenDict?

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.


Solution 1:

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.

Solution 2:

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.