If you use text-to-speech (TTS) tools for accessibility, language learning (like Anki), or to read on-screen notifications, you're probably used to the classic robotic Linux voices.
Fortunately, Piper TTS is a modern, fast neural voice synthesis engine that works 100% locally (protecting your privacy), offering incredibly natural voices.
It has recently been packaged in the official Fedora 45 repositories.
I want to show how I installed Piper TTS and how I was able to configure it as the default engine for Speech Dispatcher, the central system that manages text-to-speech audio on the Linux desktop.
Step 1: Install system dependencies Open your terminal and run:
sudo dnf install -y python3-piper-tts speech-dispatcher alsa-utils
Step 2: Download a voice model Piper needs voice models (.onnx and .json files) to work.
There are hundreds of voices available in different languages for free at this link https://huggingface.co/rhasspy/piper-voices/tree/main.
In my case, I downloaded a highly fluent Spanish voice from Mexico (es_MX-claude-high), that is, I downloaded the following files:
es_MX-claude-high.onnx
es_MX-claude-high.onnx.json
Assuming the browser downloaded the files to the system's downloads folder, we run the following in the terminal to create the directory where they will be moved:
mkdir -p ~/.local/share/piper/voices/
mv "$(xdg-user-dir DOWNLOAD)/es_MX-claude-high.onnx" \
"$(xdg-user-dir DOWNLOAD)/es_MX-claude-high.onnx.json" \
~/.local/share/piper/voices/
Step 3: Create the Audio Bridge (Wrapper) Speech Dispatcher will send text, but we need to pipe the audio generated by Piper directly to the speakers.
To avoid latency issues or format errors, we will extract the sampling frequency from the model and pipe the raw audio directly to aplay.
Copy and paste this complete block into the terminal to generate the script automatically:
mkdir -p ~/.local/bin
cat << 'EOF' > ~/.local/bin/piper_wrapper
#!/bin/bash
# $1=Text, $2=Language, $3=Voice name
model="$HOME/.local/share/piper/voices/$3.onnx"
# Extract the sample rate from the json file in a clean way
rate=$(grep sample_rate "${model}.json" | tr -d -c 0-9)
# Send raw audio and tell aplay exactly how to interpret it
echo "$1" | /usr/bin/piper --model "$model" --output-raw 2>/dev/null | aplay -q -t raw -r $rate -c 1 -f S16_LE
EOF
chmod +x ~/.local/bin/piper_wrapper
Step 4: Create the module for Speech Dispatcher Now we must teach Speech Dispatcher how to use the script we just created. The following command will generate the correct configuration file for your user, enabling UTF-8 support:
mkdir -p ~/.config/speech-dispatcher/modules
cat << EOF > ~/.config/speech-dispatcher/modules/piper.conf
GenericExecuteSynth "$HOME/.local/bin/piper_wrapper \"\$DATA\" \$LANGUAGE \$VOICE"
GenericDefaultCharset "utf-8"
AddVoice "es" "female1" "es_MX-claude-high"
DefaultVoice "es_MX-claude-high"
EOF
Important: the parameters “es” and "es_MX-claude-high" must be replaced with the language and the name of the downloaded voice respectively.
Step 5: Activate Piper as the main engine Finally, we will modify the global Speech Dispatcher configuration so it ignores the old robotic engine and uses our new neural module by default. Run this block of commands:
mkdir -p ~/.config/speech-dispatcher
# Copy the global configuration if it does not exist locally
if [ ! -f ~/.config/speech-dispatcher/speechd.conf ]; then
cp /etc/speech-dispatcher/speechd.conf ~/.config/speech-dispatcher/ 2>/dev/null || touch ~/.config/speech-dispatcher/speechd.conf
fi
# Preventive cleanup to avoid duplicate modules
sed -i '/^DefaultModule/d' ~/.config/speech-dispatcher/speechd.conf
sed -i '/AddModule "piper"/d' ~/.config/speech-dispatcher/speechd.conf
# Activate Piper
echo 'AddModule "piper" "sd_generic" "piper.conf"' >> ~/.config/speech-dispatcher/speechd.conf
echo 'DefaultModule piper' >> ~/.config/speech-dispatcher/speechd.conf
# Restart the service to apply the changes
systemctl --user restart speech-dispatcher
Everything is configured.
Although it's not necessary, I restarted the system because if there were applications open that use text-to-speech (like Firefox, Anki, or Foliate), they must be fully closed and reopened in order to detect the new Speech Dispatcher engine.
If in the future you want to add more voices or languages, simply download the .onnx files to your voices folder and add a new AddVoice line to your piper.conf file.