[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Re: Voice Lister (was: Chorus)



At 09:11 -0500 9/7/99, Greenblatt & Seay wrote:
> Is there a more efficient technique of generating a list of the Mac's
> built-in voices than the code at the bottom of this message?

I don't know about more efficient, but I thought "What fun is a lister that
only prints the voices?!"

#!perl

# "Voice Lister" v1.0
# by David Seay <g-s@navix.net>
# with addition by Vicki Brown, shamelessly stolen from other samples
#
use Mac::Speech;

#!perl

# Prints alphabetized list of Mac's voices.

$count = CountVoices();
for $i (1..$count) {
 	$voice = GetIndVoice($count - $i + 1);
 	$desc  = ${GetVoiceDescription($voice)};
 	$nameLength = ord(substr($desc,16,1));
 	$name = substr($desc,17,$nameLength);
    $channel = NewSpeechChannel($voice) or die $^E;
 	print "$name\n";
	SpeakText $channel, "$name";
	while (SpeechBusy()) {}
	DisposeSpeechChannel $channel if $channel;
}
-- --
       |\      _,,,---,,_       Vicki Brown <vlb@cfcl.com>
 ZZZzz /,`.-'`'    -.  ;-;;,_   Journeyman Sourceror: Scripts & Philtres
      |,4-  ) )-,_. ,\ (  `'-'  P.O. Box 1269  San Bruno  CA  94066
     '---''(_/--'  `-'\_) http://www.cfcl.com/~vlb  http://www.macperl.com

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org