About‎ > ‎

Linux

Select a speech synthesis tool, then install it following the instructions below. For English, French, Italian, German and Spanish, SVOX Pico is a good choice. For Czech, Finnish, Hindi, Marathi, Russian and Telugu, festival is recommended. You can use espeak to read many other languages as well.

Get the extension at the Extensions web site. Open the extension with the LibreOffice or Apache OpenOffice program. Approve the extension. Restart the program.

Read Text Extension dialogue
Dialog box

Pico


The Pico speech synthesizer speaks clearly and is simple to use. The pico speech description files are in binary format only, so unlike espeak, you can't edit the speech rules for localized pronunciation of particular words or place names. The SVOX Pico speech synthesizer uses Hidden Markov Model (HMM) algorithms to produce clear speech output in the form of an audio file. It works with German, English, Spanish, French and Italian text. Read Text Extension now includes a python script to read the SVOX Pico audio file aloud using an audio or movie player.

  • The SVOX Pico speech synthesizer packages are available in Debian's non-free repository and in Ubuntu's multiverse repository. Use a package manager like Synaptic or apt-get to install the following packages:
    • libttspico0
    • libttspico-utils
    • libttspico-data
  • If you want to try it with Linux, and your distribution includes apt-get, use these commands to install it:
    sudo apt-get install libttspico0 libttspico-utils libttspico-data
  • Other Linux distributions may make the SVOX Pico packages available with a different name. You need an up-to-date version of the Read Text Extension. Once you have installed the software, set up Read Text Extension's options with Tools - Add-ons - Read selection.... Use /usr/bin/python as the external program. Select a command line option that includes the token (PICO_READ_TEXT_PY).

Festival


Festival is an open source text to speech program. Festival text to speech is available for Catalan, Czech, English, Finnish, Hindi, Italian, Marathi, Spanish, Russian and Telugu. With Festival, custom voices will only work if they are installed. If you try to use a voice that is not installed, Festival will be silent. If you are using a Linux distribution that includes a package manager like Synaptic or apt-get, you can use it to install the necessary programs, lexicons and voices. If you want to hear English with Festival, and your distribution includes apt-get, use this command while connected to the Internet:

sudo apt-get install festival festlex-poslex festlex-cmu \
festlex-oald festvox-kallpc16k festvox-rablpc16k festvox-kdlpc16k

Your package manager might not be able to install all the voices listed in the Read Selection script dialog. Voices that include “mbrola” in the name may need to be installed manually if you want to use them. If you are using Festival, see the Festival web page or the Ubuntu forum for instructions how to install voices from the mbrola project.

The Festival package includes a tool for converting text to a wave sound file called text2wav. To use text2wav: 

  • Select some text in OpenOffice.org. 
  • Show the Read Selection dialog with Tools → Add-Ons → Read Selection... 
  • Select Read the Selection with another program - Browse to the path to text2wave 
  • in Ubuntu Linux, the location is /usr/bin/text2wave
  • In the command box, enter "(TMP)" -o (HOME)ooo_festival_(NOW).wav
  • Click OK to create a wave file in the OpenOffice.org document directory.

Espeak


Espeak includes languages that are not installed by default with Festival or with sox. It is available for Windows and Linux. The package includes a speech program that can run from a command line. It can be used with the Mbrola program to generate speech using high quality Mbrola voices. If you want to try it with Linux, and your distribution includes apt-get, use this command to install it:

sudo apt-get install espeak

Languages supported by espeak include Afrikaans, Albanian, Armenian, Cantonese, Catalan, Croatian, Czech, Danish, Dutch, English, Esperanto, Finnish, French, German, Greek, Hindi, Hungarian, Icelandic, Indonesian, Italian, Kurdish, Latvian, Lojban, Macedonian, Mandarin, Norwegian, Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Spanish, Swahili, Swedish, Tamil, Turkish, Vietnamese, and Welsh. For best results with Cantonese, Mandarin and Russian, see the eSpeak data page. Versions of eSpeak for other operating platforms are available at http://espeak.sourceforge.net/.

Use standard quality voices with Linux

  • Install espeak. Select some text in OpenOffice.org.
  • Show the Read Selection dialog with Tools → Add-Ons → Read Selection...
  • Select Read the Selection with another program
  • Browse to the path to the espeak application - /usr/bin/espeak
  • In the command box, enter -v english -f "(TMP)"
  • Click OK

Use different languages and high quality voices

The newest version of espeak allows you to specify an mbrola voice directly in the command line. With the newest version, you don't need to create a script to use mbrola voices.

  • Open a terminal.
  • Make sure espeak 1.44 or newer is installed. To check the version: espeak --help | grep "text-to-speech"
  • Install mbrola voices. In Ubuntu or Debian Linux, you have several options. For example,
    • You can search for mbrola using the Synaptic package manager
    • Open a terminal and type sudo apt-get install mbrola mbrola-en1 mbrola-fr4 mbrola-us1
  • To use the new voices with the Read Text extension,
    • Select some text in OpenOffice.org.
    • Show the Read Selection dialog with Tools → Add-Ons → Read Selection...
    • Select Read the Selection with another program
    • Browse to the path to the Espeak application - /usr/bin/espeak
    • For UK English, in the command box, enter -v mb-en1 -f "(TMP)"
    • For US English, in the command box, enter -v mb-us1 -f "(TMP)"
    • For French, in the command box, enter -v mb-fr4 -f "(TMP)"
    • Right - Click OK to check the voice.
    • Click OK

Not all mbrola voices are supported yet in eSpeak. Check the eSpeak web site for more information.

Using espeak and mbrola with pipes

If you are using an older version of Linux, you can still use espeak with mbrola and aplay to read different languages and use high quality voices. For this add-on, you need to get an mbrola voice and create a bash script that uses pipes to pass information between the programs.

The eSpeak program is used to convert words and phrases like manipulate or [[m@"nIpjUleIt]] to phonetic code:

m   65
@   40  0 179 80 190 100 190
n   65
I   106 0 206 80 152 100 152
p_h 77
j   65
U   36  0 158 80 152 100 152
l   65
EI  107 0 156 80 147 100 147
t_h 94
_   263
_   1

The Mbrola program converts the phonetic code to an audio file. The aplay program plays the audio file out loud.

Make sure espeak, mbrola and aplay are installed.

sudo apt-get install mbrola espeak espeak-data lib-espeak1 alsa-utils

For French, download the fr1: French Male (4.4Mb) voice from the mbrola web site. With administrator privileges, extract the contents into a directory accessible to all users and set the permissions of the subdirectories and files to allow read access for all. To use the example script below, extract the zip file to /usr/share/festival/voices/fr/, which creates a directory /usr/share/festival/voices/fr/fr1. The bash script below reads a plain text file in French, and will work as long as there are no spaces in the file name or file path. Name this script read_in_french.sh and save it to ~/.gnome2/nautilus-scripts. Be sure to set the file permissions to allow the script to execute.
(chmod a+rx ~/.gnome2/nautilus-scripts/read_in_french.sh)

#!/bin/sh
# Says the contents of a text file in French.
# See - http://doc.ubuntu-fr.org/synthese_vocale - 2010.08.08
# If mbrola is already running, then stop reading, otherwise read aloud.
# Try to locate the fr1 mbrola voice
if [ -f /usr/share/festival/voices/fr/fr1/fr1 ] ; then 
  VOICEFILE="/usr/share/festival/voices/fr/fr1/fr1"
elif [ -f /usr/share/mbrola/fr1/fr1/fr1 ] ; then
  VOICEFILE="/usr/share/mbrola/fr1/fr1/fr1"
elif [ -f /usr/share/mbrola/fr1/fr1 ] ; then
  VOICEFILE="/usr/share/mbrola/fr1/fr1"
elif [ -f /usr/local/share/mbrola/fr1/fr1/fr1 ] ; then
  VOICEFILE="/usr/local/share/mbrola/fr1/fr1/fr1"
elif [ -f /usr/local/share/mbrola/fr1/fr1 ] ; then
  VOICEFILE="/usr/local/share/mbrola/fr1/fr1"
elif [ -f /usr/local/share/mbrola/voices/fr1 ] ; then
  VOICEFILE="/usr/local/share/mbrola/voices/fr1"
else # debian default
  VOICEFILE="/usr/share/mbrola/voices/fr4"
fi

if [ ! -z $(ps -A | grep mbrola | awk '{ print $1 }' ) ]; then
kill $(ps -A | grep mbrola | awk '{ print $1 }' )
kill $(ps -A | grep aplay | awk '{ print $1 }' )
else
  espeak -v mb-fr1 -f $1 | mbrola -e $VOICEFILE - - | aplay -r16000 -fS16
fi
  • Download
  • Select some text in OpenOffice.org.
  • Show the Read Selection dialog with Tools → Add-Ons → Read Selection...
  • Select Read the Selection with another program
  • Browse to the path to the script – for example, ~/.gnome2/nautilus-scripts/read_in_french.sh. Note that if the file path includes a period as the first character, it is normally hidden in the file browser. You can either enable showing hidden files, or type CTRL + L, then enter the file path in the location bar.
  • In the command box, enter "(TMP)"
  • Click OK.

Use with Web Applications

Web applications let you do on-line translation, read multiple languages and try different voices. Some web applications require that you install Adobe Flash.

  • Select some text in OpenOffice.org.
  • Show the Read Selection dialog with Tools → Add-Ons → Read Selection...
  • Select Use a web application.
  • Choose or enter a web address with the appropriate parameters. -
    http://vozme.com/text2voice.php?lang=en&bookmarklet=1&gn=ml&default_language=en&text=(OOO_WEBTEXT)
  • Click OK

For more information about web applications, read Use With Web Applications.

Other Options

If you have difficulties reading the screen, consider a system-wide accessibility solution like Orca for the Gnome desktop or KTTS for the KDE desktop. If you have installed a system-wide accessibility solution, and it is activated, then you don't need this Add-On to read text aloud. However, you can use it with a script to save speech as an audio file.

Comments