This script calls the Windows OLE for the built in TTS. Type what you want the computer to say at the prompt and hit enter. To quit type ":q" (minus the quotation marks).
use Win32::OLE qw( EVENTS );
get_text();
sub get_text{
$output_speech = <STDIN>;
chomp($output_speech);
if($output_speech ne ":q"){
say_this();
get_text();
}
}
sub say_this{
my $myTTS = new Win32::OLE( "Sapi.SpVoice" );
$myTTS->Speak( "$output_speech" );
while( $myTTS->{Speaking} )
{
Win32::OLE->SpinMessageLoop();
Win32::Sleep( 100 );
}
}