You can hear voice samples here
https://rhasspy.github.io/piper-samples/
Easiest to use the binary
https://github.com/rhasspy/piper#installation
Needs jq installed
sudo apt install jq
put this script in the same directory as the binary
Code: Select all
#!/bin/bash
cd "$(dirname "$0")"
while true; do
TEXT_IN=$( zenity --entry --title="piper_tts" --text="enter/paste text to read" --cancel-label=exit --ok-label=read --extra-button "read clipboard" --extra-button pause --extra-button resume --extra-button kill)
if [ $? = 0 ] # check if the user click ok on the zenity form
then
echo "$TEXT_IN" | ./piper --model en_GB-vctk-medium.onnx --length_scale 1.9 --noise_scale 0.333 --noise_w 0.33 --output-raw | aplay -r 20000 -f S16_LE -t raw - &
elif [[ $TEXT_IN = "read clipboard" ]]
then
echo $(xclip -o) | ./piper --model en_GB-vctk-medium.onnx --length_scale 1.9 --noise_scale 0.333 --noise_w 0.33 --output-raw | aplay -r 20000 -f S16_LE -t raw - &
elif [[ $TEXT_IN = "pause" ]]
then
pid=$(pidof piper); kill -STOP $pid;
elif [[ $TEXT_IN = "resume" ]]
then
pid=$(pidof piper); kill -CONT $pid;
elif [[ $TEXT_IN = "kill" ]]
then
killall piper;
else
exit
fi
done
# x_low - 16Khz audio, 5-7M params
# low - 16Khz audio, 15-20M params
# medium - 22.05Khz audio, 15-20 params
# high - 22.05Khz audio, 28-32M params
Code: Select all
#!/bin/bash
cd "$(dirname "$0")"
while true; do
sleep 0.4 &&
wmctrl -F -a "piper_tts" -b add,above &&
wmctrl -r "piper_tts" -e 0,2300,90,100,100 &
TEXT_IN=$( zenity --entry --title="piper_tts" --text="enter/paste text to read" --cancel-label=exit --ok-label=read --extra-button "read clipboard" --extra-button pause --extra-button resume --extra-button kill)
if [ $? = 0 ] # check if the user click ok on the zenity form
then
echo "$TEXT_IN" | ./piper --model en_GB-vctk-medium.onnx --length_scale 1.9 --noise_scale 0.333 --noise_w 0.33 --output-raw | aplay -r 20000 -f S16_LE -t raw - &
elif [[ $TEXT_IN = "read clipboard" ]]
then
# xclip -o > ~/piper.txt
# sed -i 's/~/-/g' ~/piper.txt
# cat ~/piper.txt | xclip;
echo $(xclip -o) | ./piper --model en_GB-vctk-medium.onnx --length_scale 1.9 --noise_scale 0.333 --noise_w 0.33 --output-raw | aplay -r 20000 -f S16_LE -t raw - &
elif [[ $TEXT_IN = "pause" ]]
then
pid=$(pidof piper); kill -STOP $pid;
elif [[ $TEXT_IN = "resume" ]]
then
pid=$(pidof piper); kill -CONT $pid;
elif [[ $TEXT_IN = "kill" ]]
then
killall piper;
else
exit
fi
done
# x_low - 16Khz audio, 5-7M params
# low - 16Khz audio, 15-20M params
# medium - 22.05Khz audio, 15-20 params
# high - 22.05Khz audio, 28-32M params