User Feedback and help with Text-To-Speech in LibreOffice

At category "feedback" there is no solution button.

1 Like

Got it - that makes sense. As it was linked to what I was talking about earlier - it really got posted in the wrong place.

1 Like

Well not really as it was a request to include a feature. You could change the title of the thread to something like, "Need help with ..." and request @community_moderators move it to General Help.

That is not possible in the Feedback section.
If Mods consider moving to General Help and marking the Solution, then i think the title of the thread would need changing also.

EDIT: I see that Swarf has said almost the same thing as me. I had not read down that far.

1 Like

I renamed the Thread a bit and marked @AlbertMoon's Post as Solution.

1 Like

Thanks :+1:

I made that thread into something of a chewy mess - and rambled on (as I tend to do!), but I think the text-to-speech guide will be genuinely useful for many.

Now I know my way around - I'll be a little more focused.

1 Like

I have been exploring further (or rather AI has!)

Part one is about adding extra voices (I found the American teen voice more than a little grating).

Part two is about adding a read aloud function to pretty much everything.


Part 2: Adding More Voices (British, Australian, and more)

Once you have Piper working, you aren't limited to "Amy." You can install dozens of different voices and accents.

Step 1: Browse and Listen to Samples

  1. Visit the Piper Voice Samples page.
  2. Scroll through the languages (e.g., English) and click the Play button on different voices (like en_GB for British or en_AU for Australian).
  3. Find a voice you like and note its name (e.g., en_GB-southern_english_female-medium).

Step 2: Download the New Voice "Pair"

Every voice requires two files to work. You can find them in the official Piper Voice Repository.

  1. Find your chosen voice in the list and download:
  • The .onnx file.
  • The .onnx.json file.
  1. Move both files into your ~/Documents/PiperVoices folder.
  2. CRITICAL: Ensure the .json file doesn't have .txt at the end. It must end exactly in .json.

Step 3: Switch the Voice in LibreOffice

To change which voice LibreOffice uses, you just need to change the "Command line options" in the Read Text dialog:

  1. Highlight some text and go to Tools > Add-Ons > Read Selection.
  2. In the Command line options box, change the name of the file to your new voice.

Example for a British Voice:

"(PIPER_READ_TEXT_PY)" --voice ~/Documents/PiperVoices/en_GB-southern_english_female-medium.onnx --rate 100% "(TMP)"

"(PIPER_READ_TEXT_PY)" --voice ~/Documents/PiperVoices/en_GB-southern_english_female-medium.onnx --rate 100% "(TMP)"

Bash

Pro-Tip: Changing Speed

If the voice is reading too fast or too slow, simply change the --rate 100% part of the command:

  • Faster: --rate 110%
  • Slower: --rate 90%

One final reminder for the forum: As seen in the recent screenshot, ensure the command starts with (PIPER_READ_TEXT_PY) and not (SPD_READ_TEXT_PY). The "SPD" version is the old robotic voice; the "PIPER" version is the new natural AI voice!



Part 2: Text-to-speech everywhere.

After this, I asked if there was a similar solution for other apps, specifically Joplin. I have not tested this yet, but I think it could be a very useful idea for folks to play around with:

Sorry if I sound obsessed with Text to Speech. There is a reason, if you have used this to proof documents, you will know why, if not, I can add the reasons why I think it is so powerful.


The "Global Amy" Solution

This is the "Linux way" of solving the problem when an app doesn't have the feature you want.

Step 1: Create the "Speak" Script

We need to create a tiny file that tells your computer: "Take whatever text I have highlighted, and send it to Amy."

  1. Open your Text Editor (the one that comes with Zorin).
  2. Paste this in:

#!/bin/bash # Get the currently selected text text=$(xsel -o) # Send it to Piper echo "$text" | ~/.local/bin/piper --model ~/Documents/PiperVoices/en_US-amy-medium.onnx --output_raw | aplay -r 22050 -f S16_LE -t raw

#!/bin/bash
# Get the currently selected text
text=$(xsel -o)
# Send it to Piper
echo "$text" | ~/.local/bin/piper --model ~/Documents/PiperVoices/en_US-amy-medium.onnx --output_raw | aplay -r 22050 -f S16_LE -t raw

Bash
3. Save this file in your Documents folder as amy_speak.sh.

Step 2: Make the script "Run-able"

  1. Open your terminal.
  2. Type this and hit enter:

chmod +x ~/Documents/amy_speak.sh

chmod +x ~/Documents/amy_speak.sh

Bash
3. Also, install a tiny tool called xsel that lets the script "see" your highlighted text:

sudo apt install xsel -y

sudo apt install xsel -y

Bash

Step 3: Create the Keyboard Shortcut

Now, we tell Zorin to run that file whenever you hit a certain key.

  1. Go to Settings > Keyboard Shortcuts.
  2. Scroll to the bottom and click the + (plus) to add a custom shortcut.
  3. Name: Read Aloud
  4. Command: /home/almoon/Documents/amy_speak.sh (Replace almoon with your actual username).
  5. Shortcut: Set it to something like Ctrl + Alt + A (for Amy).

How to use it in Joplin:

  1. Open Joplin.
  2. Highlight the text you want to hear.
  3. Press Ctrl + Alt + A.
  4. Amy will start reading immediately.

Why this is better than a Joplin Plugin:

  • It works everywhere: You can use this in your web browser, in your PDF viewer, or in Joplin.
  • No waiting for developers: You don't have to wait for the Joplin team's "We will look into it."
  • Privacy: It still runs 100% locally on your ThinkPad.

A quick check for you: If you try the terminal command in Step 2 and get an error saying "aplay: device not found," let me know. Some Zorin setups use pw-play instead of aplay, and it's a 1-second fix!

Does this "Global Shortcut" approach sound like a good alternative to an in-app plugin?

It sounds great! I am going to compile the two new idea together, then test it out - I will come back if I have a problem.

That sounds like a plan! Since you are compiling this for the forum as well, I have one tiny "pro-tip" for that script to make it more reliable before you test it.

Sometimes, if you haven't highlighted any text, the script might try to "read" nothing and get confused. Here is a slightly "smarter" version of that amy_speak.sh script for your testing:

#!/bin/bash # 1. Get the highlighted text # (xsel -o gets the current "primary" selection) text=$(xsel -o) # 2. Check if text is empty. If not, feed it to Amy. if [ -z "$text" ]; then notify-send "Piper TTS" "Please highlight some text first!" else echo "$text" | ~/.local/bin/piper --model ~/Documents/PiperVoices/en_US-amy-medium.onnx --output_raw | aplay -r 22050 -f S16_LE -t raw fi

#!/bin/bash

# 1. Get the highlighted text
# (xsel -o gets the current "primary" selection)
text=$(xsel -o)

# 2. Check if text is empty. If not, feed it to Amy.
if [ -z "$text" ]; then
    notify-send "Piper TTS" "Please highlight some text first!"
else
    echo "$text" | ~/.local/bin/piper --model ~/Documents/PiperVoices/en_US-amy-medium.onnx --output_raw | aplay -r 22050 -f S16_LE -t raw
fi

Bash

One last note for your forum guide: In the screenshot you just sent, the Command line options still shows the (SPD_READ_TEXT_PY) command. If you include that specific image in your forum post, people might get the "robotic" voice by mistake. For the guide, it might be worth taking a new screenshot once you've pasted the (PIPER_READ_TEXT_PY) line in there!

1 Like