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

[MacPerl] MacPerl sings a scale



#!perl -w

use Mac::Speech;

#                C  D  E  F  G  A  B  C
$scalePitches = "48,50,52,53,55,57,59,60";
@scalePitches = split(",",$scalePitches);

$scaleWords = "dough,ray,me,fa,soul,la,tee,dough";
@scaleWords = split(",",$scaleWords);
$pitches = @scalePitches;

$count = CountVoices();
for ($i = 0; $i++ < $count; ) {
 	$voice = GetIndVoice($i);
 	$desc  = ${GetVoiceDescription($voice)};
	if ($desc =~ /Cello/) {
		$channel = NewSpeechChannel($voice)         or die $^E;

		for ($pitchX = 0; $pitchX<$pitches; $pitchX++) {
			$pitch = $scalePitches[$pitchX];
			$speech = $scaleWords[$pitchX];

			SetSpeechPitch $channel, $pitch;
			SpeakText $channel, $speech             or die $^E;
			while (SpeechBusy()) {}
		}
		DisposeSpeechChannel $channel;
	}
}



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch