Converting text to speech in LibreOffice and OpenOffice
Conversationalist
Visually impaired users often find working with text and tables in office suites difficult. Pico TTS, a text-to-speech synthesizer, and the Read Text extension for LibreOffice and OpenOffice provide a solution.
Without special aids, people with vision impairments can find using a computer difficult. While icons can be sufficiently enlarged to make them readable, word processors and spreadsheets are a major hurdle. The fonts in the documents are almost always too small to be read and deciphering text is also difficult due to the smooth transitions in serif or cursive fonts.
In this case, programs that read the text out loud can help. These programs convert letters into linguistically adapted phonemes and then play them back via the computer's sound system with an installed voice.
On Linux, there are various screen readers for this purpose that are based on text-to-speech programs such as eSpeak or Festival. Solutions based on the popular eSpeak have the disadvantage of a synthetic computer voice: It is quite difficult to understand due to pronunciation that is typically very nasal and partly uses the wrong intonation.
Since software packages also need to be localized for the phonemes' linguistic modification, some packages are only usable for certain languages. For example, software only localized in German would render texts that are incomprehensible to Spanish-speaking listeners.
One of the most mature applications for text-to-speech synthesis is Pico TTS [1], a text-to-speech synthesizer originally developed by SVox and used by Google in Android. The command-line program can convert texts in several languages into .wav
files. With the help of an extension for LibreOffice and OpenOffice, Pico can read out text or tables without requiring the user to enter clumsy command sequences in the terminal.
Speech Synthesizer
On Debian, Ubuntu, and their derivatives, you install Pico with the command shown in Listing 1. For other distributions, you can find packages whose names usually start with the string svox-pico. These packages require several libttspico0 or lib64ttspico0 packages as dependencies. If Pico is not currently available for your particular distribution, packages from other derivatives of the same distribution base can often be used.
Listing 1
Installing Pico
$ sudo apt-get install libttspico0 libttspico-utils libttspico-data
To integrate the synthesizer into LibreOffice or OpenOffice, you need the Read Text extension for your choice of office suite. You can find the Read Text extension, suitable for almost all LibreOffice 6.x versions, on the LibreOffice Extensions page [2]. However, in testing, using Read Text 0.8.48 with the brand new LibreOffice 6.4.1 failed. There were no problems with the older 6.0.3 release.
To integrate the downloaded extension directly into LibreOffice, first open the Extras | Extension Manager dialog. In the dialog that opens (Figure 1), press the Add button and select the read_text.2020.03.07.oxt
extension in the file browser that appears. LibreOffice will then automatically include the extension. Upon closing the window, it will prompt you to restart the office package to activate the extension.
Reading Lesson
After the restart, you can continue working with LibreOffice as before. To have a section of text read aloud, select the Read Selection option in LibreOffice Writer via the Tools | Add-Ons menu, which opens the Read Text settings dialog (Figure 2).
First, define the speech synthesizer to be used. Festival always appears first, but it is grayed out if the software is not installed. The External program radio button is enabled if you are using Pico and eSpeak and lists the path to Python in an input field. Older distributions show /usr/bin/python
as the path, while newer distributions use /usr/bin/python3
as shown in Figure 2. You do not need to change this setting, because your system automatically determines the paths and the Python version used.
In the Command line options selection field, first click on the drop-down menu icon to the right and then select a speech synthesizer with the matching options. Even if only one synthesizer is installed, it is available for selection with several settings parameters. For some distributions, you can use the parameters in this field to define, for example, whether the system should save the speech output to an audio file. In some cases, various parameterized language settings can also be selected.
If the speech output is not satisfactory during a test, you can also call Google Translate in the web browser via the Use a web application radio button, which defaults to Google Translate. The selected text is then automatically sent to Google Translate. All you have to do is click on the speaker icon in the browser to start Google's speech synthesizer.
To get started with voice output, press the OK button in the bottom right-hand corner of the dialog. This closes the window, and the speech synthesizer starts to output the selected text.
OpenOffice
OpenOffice also supports speech output functions. The project even provides a Read Text extension for OpenOffice 2.x versions [3], which are more than 10 years old. With Pico, even older versions of OpenOffice can achieve usable speech output. However, the current 0.8.49 version of the Read Text extension is only compatible with the newer OpenOffice 4.x versions.
You install the extension similar to LibreOffice. You call the Extension Manager in the start window via the Tools menu. Although it offers far fewer setting options than its LibreOffice counterpart, it has the same basic functions. After setting up the extension, call up the settings dialog via the Tools | Add-Ons menu. The dialogs are the same as those in LibreOffice.
Unlike LibreOffice, OpenOffice lets you experiment with different language variants of the Pico synthesizer with older Read Text versions. To read English text aloud, for example, you can use one of the English language options offered by Read Text. The extension supports several English, French, Italian, German, and Spanish pronunciation options (Figure 3).
Google Translate can also be used as an alternative in OpenOffice by enabling the Use a web application option. If needed, you can also call another service provider to read the text by entering a new URL in the address line.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.