Converting text to speech in LibreOffice and OpenOffice

Conversationalist

© Lead Image © warangkana bunyarittongchai, 122RF.com

© Lead Image © warangkana bunyarittongchai, 122RF.com

Article from Issue 237/2020
Author(s):

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.

Figure 1: The extension is installed via the Extension Manager.

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).

Figure 2: You can enable voice output via an easy-to-use dialog.

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).

Figure 3: The speech output settings in OpenOffice 3.2.1 are less extensive than LibreOffice, but they are just as useful.

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

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • The Clear Choice

    While LibreOffice and OpenOffice have a shared past, LibreOffice outstrips OpenOffice in contributors, code commits, and features.

  • Read ODF Documents on Android with OpenOffice Document Reader
  • writer2ePub

    The writer2ePub plugin for OpenOffice Writer converts formatted files to compatible data for many of the popular e-book readers at the press of a button.

  • LibreOffice 5

    The Document Foundation released LibreOffice 5.0.0 at the beginning of August, and the first update 5.0.1 appeared just three weeks later. In addition to several fixes and new features under the hood, Version 5 provides some very visible improvements.

  • Office Suites

    In the office, the interoperability and cooperation of a few programs play an important role. We take the four big Linux office suites to task and see how well they cope with non-native formats.

comments powered by Disqus