use strict; use warnings; use Data::Dumper; use Win32::OLE; my $speech = Win32::OLE->new("SAPI.SpVoice") or die ("Error with TTS"); #trying to get installed voices my $AvailableVoices = $speech->GetVoices(); print Dumper $AvailableVoices; say ("Hello user."); # I am using the default voice say ("Hello user.", "Microsoft David Desktop"); # I am setting a different voice which is installed on the machine sub say { my ($text, $voice) = @_; $speech->{voice} = $speech->GetVoices("name = $voice")->Item(0) if $voice; $speech->Speak($text); } #### $VAR1 = bless( { 'Count' => 5 }, 'Win32::OLE' );