Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Text to Speech Win32::OLE Solution

by elwarren (Curate)
on Nov 02, 2004 at 00:07 UTC ( #404470=note: print w/replies, xml ) Need Help??

in reply to Text to Speech Win32::OLE Error

Every version of windows seems to do this different. Microsoft broke TTS when XP came out. Broken as far as I'm concerened because my code that worked on win2k doesn't on XP. I've given up on asking why. Try this , it works on my XP machine. I pipe things into it via STDIN.
#!/usr/bin/perl use strict; use warnings; use Win32::OLE; my $v=Win32::OLE->new('SAPI.SpVoice'); while (<>) { # space out numbers so they'll # be spoken individually my $single = s/(\d)/$1 /g; $v->Speak($_); }
haha, and ++ for "Would you like to play a game", the "Hello, World" of text to speech :-)

Replies are listed 'Best First'.
Re^2: Text to Speech Win32::OLE Solution
by TROGDOR (Scribe) on Nov 02, 2004 at 00:43 UTC
    Thanks elwarren, that worked. Can you recommend a reference for the OLE interface? How did you find out about this change?

    Leave it to MS to hose backward compatibility. I'm never quite sure if this kind of stuff happens due to incompetence, or intentional marketing strategy.

    Anyhow, it worked. And I've learned that "Invalid class string" means OLE didn't recognize the request.

    Thanks Wise Ones!
      Do not ascribe to malice that which is easily explained by incompetence --Napolean



Re^2: Text to Speech Win32::OLE Solution
by Jouke (Curate) on Nov 02, 2004 at 10:54 UTC
    See my reply to the previous thread. The 'why' is that XP has SAPI5 (which you are using in your example), and you probably used VoiceText on your Win2K machine (which is SAPI4). These two are incompatible

    Jouke Visser
    Using Perl to enable the disabled: pVoice

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://404470]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2017-08-20 13:48 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (316 votes). Check out past polls.