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
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.
-
Fedora 41 Released with New Features
If you're a Fedora fan or just looking for a Linux distribution to help you migrate from Windows, Fedora 41 might be just the ticket.
-
AlmaLinux OS Kitten 10 Gives Power Users a Sneak Preview
If you're looking to kick the tires of AlmaLinux's upstream version, the developers have a purrfect solution.
-
Gnome 47.1 Released with a Few Fixes
The latest release of the Gnome desktop is all about fixing a few nagging issues and not about bringing new features into the mix.
-
System76 Unveils an Ampere-Powered Thelio Desktop
If you're looking for a new desktop system for developing autonomous driving and software-defined vehicle solutions. System76 has you covered.
-
VirtualBox 7.1.4 Includes Initial Support for Linux kernel 6.12
The latest version of VirtualBox has arrived and it not only adds initial support for kernel 6.12 but another feature that will make using the virtual machine tool much easier.
-
New Slimbook EVO with Raw AMD Ryzen Power
If you're looking for serious power in a 14" ultrabook that is powered by Linux, Slimbook has just the thing for you.
-
The Gnome Foundation Struggling to Stay Afloat
The foundation behind the Gnome desktop environment is having to go through some serious belt-tightening due to continued financial problems.
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.