[SLUG] text-to-speech script

From: Eben King (eben01@verizon.net)
Date: Wed Oct 01 2008 - 23:46:57 EDT


Yes, there are other ways of doing this, so in some respect I'm reinventing
the wheel. My initial goal (when I wrote this in (pd)ksh) was to get it
done, since there was no other way (that I saw) of doing this without
incurring a significant amount of overhead. Now there probably is, but
since some scripts depend on it, I'll rewrite it in sh.

Festival isn't particularly lightweight, but I guess you can use whatever
you want. It acts as a daemon, accepting festival-language commands (LISP,
I think) over TCP port 1314. This script sends $* as one statement. If
that fails, it sends one word at a time. If a word fails, it resends that
word as l e t t e r s.

#!/bin/sh
# eben wrote this

saytext () {
     netcat -c "echo '(SayText \"$*\")' ;
         while read line ; do
             case \"z\$line\" in
                 *OK) exit ;;
                 zER) exit 1 ;;
             esac
         done
         echo '(quit)'" localhost 1314
}

saytext "$@" || {
         echo -E "`date`" "$*" >> /tmp/say.errors
         set $*
         for word in "$@" ; do
                 saytext "$word" || saytext "$(echo "$word" | sed 's/\(.\)/\1 /g')"
         done
}

I call at "say".

-- 
-eben      QebWenE01R@vTerYizUonI.nOetP      royalty.mine.nu:81
      If you need someone to blame
      Throw a rock in the air
      You'll hit someone guilty -- U2, _Zooropa_, "Dirty Day"
-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS).  Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 17:14:12 EDT