tts.txt (1219B)
1 Install Piper on archlinux: 2 3 yay -S piper-tts-bin 4 5 Install voices: 6 7 yay -S piper-voices-en-us 8 yay -S piper-voices-en-gb 9 yay -S piper-voices-zh-cn 10 11 How to use it to play audio directly: 12 13 cat test.txt | piper-tts \ 14 --model /usr/share/piper-voices/en/en_US/bryce/medium/en_US-bryce-medium.onnx \ 15 --output-raw | aplay -r 22050 -f S16_LE -t raw - 16 17 ==================================================================== 18 19 Speech Dispatcher 20 21 /etc/speech-dispatcher/modules/piper-tts-generic.conf 22 23 Here you set up the default voice for reading PDFs which can 24 integrate with Okular or Calibre 25 26 Restart: 27 28 systemctl --user status speech-dispatcher 29 30 Test saying sth: 31 32 spd-say "This is a test" 33 34 Read a txt file: 35 36 cat transcript.txt | spd-say -e 37 38 ==================================================================== 39 Kokoro 40 41 Spin up a dockerized kokoro: https://github.com/hwdsl2/docker-kokoro/ 42 43 and then try it: 44 45 jq -n --rawfile t ~/transcript.txt \ 46 '{model:"tts-1", input:$t, voice:"af_heart", response_format:"wav"}' \ 47 | curl -s http://127.0.0.1:8880/v1/audio/speech \ 48 -H "Content-Type: application/json" \ 49 -d @- \ 50 --output /tmp/speech.wav \ 51 && ffplay -nodisp -autoexit /tmp/speech.wav