script to switch synths

Chuck Hallenbeck chuckh at sent.com
Fri May 7 16:23:03 EDT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Well, I cannot promise this will work for anyone else, but for me
it works reliably and conveniently. Assumptions: kernel compiled
with speakup and its drivers as modules. Subdirectories under
/etc/speakup for each synthesizer you wish to use, where files
exist to be copied to /proc/speakup when the synth is begun. For
instance, /etc/speakup/ltlk with files "rate" and "pitch". The
name to be used for the speakup_sftsyn driver is not sftsyn, but
softsynth. The speech-dispatcher is loaded in the system startup
scripts. Mine is in /etc/rc.d/rc.local, where it is followed gby
a "sleep 1".

The following script should be made executable and stored in
/usr/local/sbin. Mine is called "speakwith" and takes an argument
such as these:

speakwith ltlk
speakwith sftsyn
speakwith bns
speakwith none
speakwith dectlk

and so on. To see the official list, make a mistake! "speakwith
caution" for instance.

- --------- script starts here --------
#!/bin/bash
if [ "$1" != "acntsa" ] && [ "$1" != "acntpc" ] && [ "$1" != "apollo" ] && \
[ "$1" != "audptr" ] && [ "$1" != "bns" ] && [ "$1" != "dectlk" ] && \
[ "$1" != "decext" ] && [ "$1" != "decpc" ] && [ "$1" != "dtlk" ] && \
[ "$1" != "keypc" ] && [ "$1" != "ltlk" ] && [ "$1" != "none" ] && \
[ "$1" != "sftsyn" ] && [ "$1" != "spkout" ] && [ "$1" != "txprt" ]; then
echo "Unrecognized synthesizer type: \"$1\""
echo "Select one of the following:"
echo "acntsa, acntpc, apollo, audptr, bms, dectlk, decext, decpc, dtpc,"
echo "keypc, ltlk, sftsyn, spkout, txprt, or none."
exit 1
fi
F1="`cat /proc/speakup/synth_name`"
if [ "$F1" != "none" ]; then
echo "none" > /proc/speakup/synth_name
if [ "$F1" = "softsynth" ]; then
kill -9 `cat /var/run/speechd-up.pid`
rmmod speakup_sftsyn
else
rmmod speakup_$F1
fi
sleep 1
fi
if [ "$1" = "none" ]; then
exit
fi
modprobe speakup_$1
if [ "$1" = "sftsyn" ]; then
speechd_up
fi
cp /etc/speakup/`cat /proc/speakup/synth_name`/* /proc/speakup
- ---------- script ends here --------

Any comments or suggestions are appreciated. I have used this
thing with good results on my Slackware 9.1 system with kernel
2.4.26 for a while now. I have been unable to eliminate the sleep
command it contains, nor move it elsewhere in the script.

Standard disclaimer: Your mileage may vary, you get to keep the
pieces if it breaks, and so on.

Chuck



- -- 
The Moon is Waning Gibbous (87% of Full)
My home page is now at http://www.mhcable.com/~chuckh
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iQCVAwUBQJvwNDVdG8M9x9tGAQLsWgP/YeipJo2acE2MZ4BOasAD3AZwtDOyCBCu
fWB0B2fEE1RKbfeRq/D0TF5Op9zcZZuDWhHnF6bnSc7A9pVRFt4ZX6KmocqrGAWV
ZE1ZSr798uRG5rYnQm789mZ5RjiMOgB7fzqVX4oFjNbB+GKyaI2SuEp0FPjOBgm+
Rvzs339q8uA=
=wTYX
-----END PGP SIGNATURE-----





More information about the Speakup mailing list