in reply to Changing the voice in MS Text to speech?
Download and install the latest Microsoft Speech SDK (currently it's Microsoft Speech SDK 5.1).
use Win32::OLE; talk("Hello user.", "microsoft sam"); talk("I like you."); # microsoft mary is the default for SAPI.SpVoice talk("Goodbye!", "microsoft mike"); sub talk { my $text = shift; my $voice = shift; my $speech = Win32::OLE->new("SAPI.SpVoice") or die("TTS failed"); $speech->{voice} = $speech->GetVoices("name = $voice")->Item(0) if $ +voice; $speech->{rate} = -2; # speaking rate has a valid range of -10..10 $speech->Speak($text); }
|
|---|