Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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 speak.pl , 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 :-)


Comment on Re: Text to Speech Win32::OLE Solution
Download Code
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!
    TROGDOR
      Do not ascribe to malice that which is easily explained by incompetence --Napolean

      ;-)

      -Jim

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://404470]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (23)
As of 2014-07-14 13:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (260 votes), past polls