Hi. I will tell you how to convert text to speech in OpenMandriva using modern offline TTS engines in different languages. This can be useful when creating audio books or to avoid eye fatigue when reading long texts.
Installing the program and the English engine:
I assume your username is user.
wget https://github.com/rhasspy/piper/releases/download/v1.2.0/piper_amd64.tar.gz
tar -xf piper_amd64.tar.gz
mkdir piper/jenny_dioco
cd piper/jenny_dioco
wget https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_GB/jenny_dioco/medium/en_GB-jenny_dioco-medium.onnx
wget https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_GB/jenny_dioco/medium/en_GB-jenny_dioco-medium.onnx.json
Let’s compile YAD (Yet Anoter Dialog) to support some GUI:
You may need other devel packages not listed here to compile. If you encounter a bug, look for similar packages in dnfdragora or ask on the forum.
Perhaps soon yad will be added to repositories and compilation will not be necessary.
cd ~
sudo dnf install clang make nano vlc intltool lib64gtk+3.0-devel lib64espeak1
wget https://github.com/v1cont/yad/releases/download/v13.0/yad-13.0.tar.xz
tar -xf yad-13.0.tar.xz
cd yad-13.0
./configure --help
./configure --prefix=/opt/yad --enable-silent-rules --enable-standalone --disable-html --disable-sourceview --disable-icon-browser --disable-schemas-compile
make -j1
sudo make install
Create a text file in your home folder, in the piper folder named ui.sh with the following contents:
#!/bin/bash
if [ "$#" -ne 2 ]; then
echo "start wo 2 args"
cd /tmp
rm says*.txt
rm says*.wav
rnd=$RANDOM
rfnt="/tmp/saysf$rnd.txt"
rfns="/tmp/saysf$rnd.wav"
if /opt/yad/bin/yad --text-info --editable --file-op --wrap \
--title="I'll tell you!" \
--text="Enter text:" \
--entry-text "" \
--width=600 --height=240 > $rfnt
then
echo "RUN $0 $rfnt $rfns"
$0 $rfnt $rfns
else
echo "EXIT"
exit 0
fi
else
echo "start with 2 args $1 $2"
for ((i=1; i<=3; i++)) {
echo "# $((i*33))%"
echo $i
#sleep 1
if [ "$i" -eq 1 ]; then
cat $1 | taskset -c 1 /home/user/piper/piper --model /home/user/piper/jenny_dioco/en_GB-jenny_dioco-medium.onnx --speaker 0 --output_file $2
fi
if [ "$i" -eq 2 ]; then
vlc $2
fi
} | /opt/yad/bin/yad --progress \
--text="Progress..." \
--width=300 \
--auto-kill \
--enable-log="Progress" \
--log-expanded \
--auto-close
echo "start new scrip and exit"
$0 &
fi
exit 0
Make it executable:
chmod +x piper/ui.sh
taskset limits the use of cores to 1, optional.
Create a shortcut in /usr/local/share/applications or /usr/share/applications
sudo nano /usr/share/applications/ui.desktop
[Desktop Entry]
Encoding=UTF-8
Name=Piper
Comment=Piper
Categories=Utility;
Exec=bash /home/user/piper/ui.sh
Icon=/opt/yad/share/icons/hicolor/128x128/apps/yad.png
Terminal=false
Type=Application
StartupNotify=false
Path=/tmp
Ctrl+O - save
Ctrl+X - exit
Console control:
/home/user/piper/piper --help
echo "Text" | /home/user/piper/piper --model /home/user/piper/jenny_dioco/en_GB-jenny_dioco-medium.onnx --speaker 0 --output_file - | aplay
echo "Text" | /home/user/piper/piper --model /home/user/piper/jenny_dioco/en_GB-jenny_dioco-medium.onnx --speaker 0 --output_file output.wav
cat input.txt | /home/user/piper/piper --model /home/user/piper/jenny_dioco/en_GB-jenny_dioco-medium.onnx --speaker 0 --output_file - | aplay
cat input.txt | /home/user/piper/piper --model /home/user/piper/jenny_dioco/en_GB-jenny_dioco-medium.onnx --speaker 0 --output_file output.wav
You can use the Universal UI utility to convert txt to wav.
However, the utility uses GTK2, but Lazarus in OpenMandriva is built with Qt5.
So you can install Lazarus from the official site or compile the UI on another system.