commit 5c02fc218b3a880c8a3e3802c9cacf7b8fe100ce
parent bf78bb4f429c50fc42c37fcde71e6277300e989b
Author: sin <sin@2f30.org>
Date: Tue, 7 Oct 2014 18:31:42 +0100
Decode text in voice-enabled oracle + choose synth engine
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/rat-weather-voice b/rat-weather-voice
@@ -1,11 +1,16 @@
#!/bin/sh
# Voice based weather oracle script
+#SYNTH="espeak --stdout" # from espeak
+SYNTH=text2wave # from festival
+
tail -n0 -f text_out | while read line; do
address=${line:17:${#line}} # strip off date time
echo "Predicting weather at $address. Wait a moment and pick up the call!.." > text_in
curl -s --get --data-urlencode "query=$address" \
http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml | \
perl -ne '/<title>([^<]+)/&&printf "%s: ",$1;/<fcttext>([^<]+)/&&print $1,"\n"' | \
- text2wave | sox -t wav - -r 48000 -c 1 -e signed -b 16 -L -t wav - > call_in
+ perl -MHTML::Entities -pe 'binmode(STDOUT, ":encoding(utf8)"); decode_entities($_);' | \
+ perl -MHTML::Entities -pe 'binmode(STDOUT, ":encoding(utf8)"); decode_entities($_);' | \
+ $SYNTH | sox -t wav - -r 48000 -c 1 -e signed -b 16 -L -t wav - > call_in
done