From 7eb79f6564f498163a670fb3bc503dfcaace0ab5 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 2 Sep 2013 17:53:45 +0200 Subject: refactor naturalvoices util/lib/naturalvoices/att.sh contains functions to grab and play att text-to-speech from the servers god/ivan/naturalvoices_cached.sh and util/lib/naturalvoices/att.sh are using the new lib --- util/lib/naturalvoices/att.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 util/lib/naturalvoices/att.sh (limited to 'util/lib') diff --git a/util/lib/naturalvoices/att.sh b/util/lib/naturalvoices/att.sh new file mode 100755 index 00000000..5e966c79 --- /dev/null +++ b/util/lib/naturalvoices/att.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# The cached version of naturalvoices +# This should prevent us from being pwned again ... + + + +get_tts(){ + # ENV: + # OUTFILE - path to outfile (required) + # voice - voice to use (default: klara) + # INP: + # $@ - input text + + : ${OUTFILE?please provide OUTFILE} + text=$(echo $* | sed -e 's/ /+/g' -e 's/\//%2F/g') + voice="${voice:-klara}" + ip=192.20.225.36 + base_url="http://$ip" + wget $base_url$( curl -Ss -H 'Host:$ip' \ + -H 'Origin:http://www2.research.att.com' \ + -e "http://www2.research.att.com/~ttsweb/tts/demo.php" \ + -A "Mozilla/5.0 (X11; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0" \ + -d "voice=$voice" -d "txt=$text" -d "speakButton=SPEAK" \ + -H 'Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \ + $base_url/tts/cgi-bin/nph-nvttsdemo | \ + grep HREF|sed 's/.*\(".*"\).*/\1/' | \ + sed -e 's/"//g' ) -O "$OUTFILE" 2>/dev/null +} + +play_file(){ + aplay "$*" >/dev/null +} -- cgit v1.2.3