#!/bin/sh # Speak a phrase, locking so that you can run multiple copies of this at the # same time and they won't talk over each other or jumble up fragments. # Used with saymail in my (old) .procmailrc so that it'd announce incoming # messages. # This requires this in your .festivalrc: # (Parameter.set 'Audio_Command "cat $FILE >>~/.speech-$SPEAKPID") # (Parameter.set 'Audio_Method 'Audio_Command) if ps aux | grep -v grep | grep -q esd ; then PLAYER="esdcat -r 8000 $HOME/.speech-$$" else PLAYER="sox -r 16000 -w -s -t raw $HOME/.speech-$$ -t ossdsp /dev/dsp" fi lockfile -4 ~/.speaklock export SPEAKPID=$$ if [ $# -eq 0 ] ; then nice -20 festival --tts else echo $* | nice -20 festival --tts fi $PLAYER rm -f ~/.speech-$$ ~/.speaklock