changing synths on the fly

Chuck Hallenbeck chuckh at sent.com
Wed Oct 13 17:48:45 EDT 2004


Several months ago I posted a script to change synthesizers on the fly.
That script assumed that the synths you wished to use were all compiled
as modules. In reality, only sftsyn needs to be compiled as a module,
any others you wish to use could be compiled directly into the kernel or
compiled as modules, as you choose. Below is a revision of my earlier
script that works whichever way the speakup drivers were compiled,
either directly or as modules. I changed the name to "speakwith" on my
own system. This revision also takes advantage of the "speakupconf"
script for saving and loading speakup settings.
---------- start script ----------
#!/bin/bash
#
# speakwith -- switch speakup synthesizers on the fly
#
# written by Charles Hallenbeck
# May, 2004.
# Tested on a Slackware 10.0 Linux distribution with kernel 2.4.26
# Requires speech-dispacher and speechd-up for software synthesizers
# and speakupconf to load and save speakup settings
#
if [ "$1" = "" ] || [ "$2" != "" ] || \
[ "$1" = "-h" ] || [ "$1" = "--help" ]; then
echo "Usage: `basename $0` <synth_name>"
echo "You may use one of the following synthesizer names if the driver"
echo "has been selected and the corresponding device is available:"
echo "acntsa, acntpc, apollo, audptr, bms, dectlk, decext, decpc, dtpc,"
echo "keypc, ltlk, sftsyn, spkout, txprt, or none."
echo "Use speakupconf to save speech settings to load at startup"
exit
fi
#
if [ "$1" != "none" ] && \
# To disallow a particular device, comment out its line below:
[ "$1" != "acntsa" ] && \
[ "$1" != "acntpc" ] && \
[ "$1" != "apollo" ] && \
[ "$1" != "audptr" ] && \
[ "$1" != "bns" ] && \
[ "$1" != "dectlk" ] && \
[ "$1" != "decext" ] && \
[ "$1" != "decpc" ] && \
[ "$1" != "dtlk" ] && \
[ "$1" != "keypc" ] && \
[ "$1" != "ltlk" ] && \
[ "$1" != "spkout" ] && \
[ "$1" != "txprt" ] && \
# do not comment out the next line!
[ "$1" != "sftsyn" ]; then
echo "Unrecognized synthesizer type: \"$1\""
exit 1
fi
#
F1="`cat /proc/speakup/synth_name`"
if [ "$F1" != "none" ]; then
echo "none" > /proc/speakup/synth_name
if [ "$F1" = "sftsyn" ]; then
kill -9 `cat /var/run/speechd-up.pid`
fi
rmmod speakup_$F1 >/dev/null 2>&1
sleep 1
fi
#
if [ "$1" = "none" ]; then
exit
fi
#
echo "$1" >/proc/speakup/synth_name
if [ "$1" = "sftsyn" ]; then
speechd_up
fi
speakupconf load
---------- end script ----------


While I am at it, I include below a set of statements in my
/etc/rc.d/rc.local file which initiates software speech on system
bootup. These statements work for me. Your mileage may vary.

---------- added to /etc/rc.d/rc.local ----------
# start talking
export PATH=/usr/local/bin:$PATH
/usr/local/bin/speech-dispatcher
echo "sftsyn" >/proc/speakup/synth_name
sleep 1
/usr/local/bin/speakupconf load
/usr/local/bin/speechd_up
---------- end of statements ----------


There are surely other ways to get this done, no doubt some better ways.
Any suggestions for improvements are welcome.

HTH

Chuck


-- 
The Moon is New
Home page at http://www.mhcable.com/~chuckh
Speakfreely address 24.105.197.112:2074




More information about the Speakup mailing list