Massyn has asked for the wisdom of the Perl Monks concerning the following question:

#!/fellow/monks.pl

I've been using Microsoft TTS within perl for quite some time, however, I've never been able to get it to dump the speech into a WAV file, rather than playing out on the sound card. The idea is to pass this to a voice modem application.

Any ideas on how to do it would be greatly appreciated.

This is the code I'm currently using

sub talk { local $txt = $_[0]; use Win32::OLE; local $voice = Win32::OLE->new("Speech.VoiceText") or die("TTS + failed"); $voice->Register("", "$0"); $voice->{Enabled} = 1; # optional $voice->Speak($txt, 1); while ($voice->IsSpeaking()) { sleep 1; } }

Thanks!

#!/massyn.pl The early worm gets caught by the bird.

Replies are listed 'Best First'.
Re: Text-to-Speech in WAV
by PodMaster (Abbot) on Apr 02, 2003 at 06:58 UTC
    You should look into Win32::MSAgent and Win32::Sound. You should be able to use Win32::Sound to save stuff in a file (i've not tried it yet, but looks doable).


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    I run a Win32 PPM repository for perl 5.6x+5.8x. I take requests.
    ** The Third rule of perl club is a statement of fact: pod is sexy.