l radio: fix tts for long texts
This commit is contained in:
parent
63573a5fa0
commit
6ebc5693d6
@ -1,6 +1,31 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
|
|
||||||
|
tts = pkgs.writers.writeBashBin "tts" ''
|
||||||
|
set -efu
|
||||||
|
|
||||||
|
offset=0
|
||||||
|
OUTPUT=$(mktemp -d)
|
||||||
|
trap 'rm -rf "$OUTPUT"' EXIT
|
||||||
|
SPEAKER=$[ $RANDOM % 900 ]
|
||||||
|
while read line; do
|
||||||
|
echo "$line" |
|
||||||
|
${pkgs.larynx}/bin/larynx \
|
||||||
|
--model ${pkgs.fetchzip {
|
||||||
|
url = "https://github.com/rhasspy/piper/releases/download/v0.0.2/voice-en-us-libritts-high.tar.gz";
|
||||||
|
hash = "sha256-jCoK4p0O7BuF0nr6Sfj40tpivCvU5M3GHKQRg1tfIO8=";
|
||||||
|
stripRoot = false;
|
||||||
|
}}/en-us-libritts-high.onnx \
|
||||||
|
-s "$SPEAKER" \
|
||||||
|
-f "$OUTPUT"/"$offset".wav
|
||||||
|
|
||||||
|
((offset+=1))
|
||||||
|
done
|
||||||
|
|
||||||
|
${pkgs.sox}/bin/sox "$OUTPUT"/*.wav "$OUTPUT"/all.wav
|
||||||
|
cat "$OUTPUT"/all.wav
|
||||||
|
'';
|
||||||
|
|
||||||
send_to_radio = pkgs.writers.writeDashBin "send_to_radio" ''
|
send_to_radio = pkgs.writers.writeDashBin "send_to_radio" ''
|
||||||
${pkgs.vorbis-tools}/bin/oggenc - |
|
${pkgs.vorbis-tools}/bin/oggenc - |
|
||||||
${pkgs.cyberlocker-tools}/bin/cput news.ogg
|
${pkgs.cyberlocker-tools}/bin/cput news.ogg
|
||||||
@ -41,20 +66,16 @@ in
|
|||||||
systemd.services.newsshow = {
|
systemd.services.newsshow = {
|
||||||
path = [
|
path = [
|
||||||
newsshow
|
newsshow
|
||||||
|
tts
|
||||||
send_to_radio
|
send_to_radio
|
||||||
gc_news
|
gc_news
|
||||||
get_current_news
|
get_current_news
|
||||||
pkgs.retry
|
pkgs.retry
|
||||||
pkgs.larynx
|
|
||||||
];
|
];
|
||||||
script = ''
|
script = ''
|
||||||
set -efu
|
set -efu
|
||||||
retry -t 5 -d 10 -- newsshow | tr '\n' ' ' |
|
retry -t 5 -d 10 -- newsshow |
|
||||||
retry -t 5 -d 10 -- larynx --model ${pkgs.fetchzip {
|
retry -t 5 -d 10 -- tts |
|
||||||
url = "https://github.com/rhasspy/piper/releases/download/v0.0.2/voice-en-us-libritts-high.tar.gz";
|
|
||||||
hash = "sha256-jCoK4p0O7BuF0nr6Sfj40tpivCvU5M3GHKQRg1tfIO8=";
|
|
||||||
stripRoot = false;
|
|
||||||
}}/en-us-libritts-high.onnx -s $[ $RANDOM % 900 ] -f - |
|
|
||||||
retry -t 5 -d 10 -- send_to_radio
|
retry -t 5 -d 10 -- send_to_radio
|
||||||
'';
|
'';
|
||||||
startAt = "*:00:00";
|
startAt = "*:00:00";
|
||||||
|
Loading…
Reference in New Issue
Block a user