Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Text to Speech

by mdog (Pilgrim)
on Jan 10, 2001 at 02:21 UTC ( #50795=perlquestion: print w/replies, xml ) Need Help??
mdog has asked for the wisdom of the Perl Monks concerning the following question:

So I'd really like to be able to do Text to Speech on a Windows machine.

I found an article on Winmag that talks about implementing a TTS (Text to Speech) engine and then making calls to the engine via perl. All I get it to do is make a popping noise.

Plus, I found Bruce Winter's explanation of TTS for misterhouse -- it pretty much matches up with the Winmag example.

I, also, found Kevin Lenso's article from The Perl Journal on text to speech but the complete code isn't anywhere that I can find.

The best I can do so far is take a commercial product that takes command line text and use perl to exec the commercial product with text that I format in Perl. This is obviously super-weak.

Does anyone have any expierence with TTS on Windows machines and could someone please post an example?

Thanks in advance,

Replies are listed 'Best First'.
Re: Text to Speech
by lzcd (Pilgrim) on Jan 10, 2001 at 04:01 UTC
    My suggestion would be either the aforementioned MS Agent or the slightly more cross platform choice of the Festival Speech System.
    It has an interface it seems for just about every language or setup known to man.

    Neither option sounds as funky as AT & T's groovy little *nix system but that's what you get for 'free as in beer'. :)

Re: Text to Speech
by elwarren (Curate) on Jan 10, 2001 at 02:54 UTC
    Does your soundcard work with any other program? I had a similar problem and the popping noise was caused by an irq conflict between my soundcard and the parallel port. Changing the irq from 7 to 5 fixed it in that case.

    If your soundcard works, are you sure you installed the MS-Agent software correctly? The article says some people had problems until they installed the entire package.

    Can you get any other program to speak?

    Last (but not least) is the code you're trying to run. We can't do much to help until we see what you're trying to run. Post a snippet here if you could, please.

      Yes, my soundcard works...

      When I use the SpeechControlPanel to modify the properties of each speech engine, I can get the text to speech to work fine in there.

      I am pretty sure that I install MS-Agent properly as I get the engines to work fine in the Control Panel. I don't see on the MS-Agent download page a place to install the entire package. I just see individual components to add in. I added all of them hoping that would fix it.

      As for the code that I am running:

      use strict; use Win32::OLE; my $voice; $voice = Win32::OLE->new("Speech.VoiceText") or die("TTS failed"); $voice->Register("", "perl"); $voice->{Enabled} = 1; $voice->speak("hello world", 1);

      I appreciate the input and if anyone has any more suggestions, that would be great. Thanks!

Re: Text to Speech
by Rudif (Hermit) on Jan 11, 2001 at 03:34 UTC
    #!perl -w use strict; use warnings; use Win32::OLE; # Set up speech. my $voice = Win32::OLE->new("Speech.VoiceText") or die("TTS failed"); $voice->Register("", "$0"); $voice->{Enabled} = 1; # optional my $question = <<__EOS__; mdog has asked for the wisdom of the Perl Monks concerning the fol +lowing question: So I'd really like to be able to do Text to Speech on a Windows ma +chine. __EOS__ my $answer = <<__EOS__; Hello, mdog! This example works for me on Win2k, perl 5.6.0. It is based on the javascript from article Rudif __EOS__ $voice->Speak($question, 1); $voice->Speak($answer, 1); while ($voice->IsSpeaking()) { sleep 1; } __END__

      RUDIF --

      YOU RULE!!!

      That worked like a going to have to see where the differences lie between yours and mine?

      Thanks a ton!


Re: Text to Speech
by t0mas (Priest) on Jan 10, 2001 at 12:11 UTC
    You could have a look at my chatterbox client AgentChat. It uses MS Agents to speak the contents of the chatterbox.

    /brother t0mas
      Thanks t0mas...that worked great!!!
Re: Text to Speech
by myocom (Deacon) on Jan 10, 2001 at 02:27 UTC

    I've used Misterhouse for a while now, and haven't had any problems with the TTS... Can you get it to work with the MS software that comes with it?

      No, I can't...just get the popping noise.

      I was wondering if the text was reading at too fast a speed but I checked the speed and it was at a normal setting.

      Are people getting this to work on NT 4 or Win2K (that's what I am trying on -- using perl 5.6)?


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://50795]
Approved by root
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2018-02-18 09:05 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (252 votes). Check out past polls.