#!/usr/bin/perl -w
use strict;
use warnings;
use Win32::OLE;

# A quick CPAN search shows that PerlSpeak, Speech::Synthesis, and Speech::eSpeak 
# all are capable of speech synthesis.

# uncomment the next line if you want the script to write a wave file for you
# &SAPIwave("This is the wave file created by Phil's sapi Perl script","0","c:\\temp\\mary.wav");
# &SAPItalk("Hello, and welcome to Phil's sapi perl script",0);

# simple tests 
# say one line
# Win32::OLE->CreateObject('SAPI.SpVoice')->Speak('I can speak');
# create pesistent object for mutliple items...
my $strText = "You need to input what you want me to say.";
my $objVoice = Win32::OLE->CreateObject("SAPI.SpVoice");
# no methods $objVoice->Volume(100);
my ($cnt,$i);
$cnt = scalar @ARGV;
for ($i = 0; $i < $cnt; $i++) {
    if ($i == 0) {
        $strText = $ARGV[$i];
    } else {
        $strText .= ' ';
        $strText .= $ARGV[$i];
    }
}

$objVoice->Speak($strText);

# eof
