On Windows, text-to-speech is easy. Windows has a builtin text-to-speech service. Even Windows XP has it.

If you save the following code as a text file and rename it to SPEAK.VBS and then call it from Perl...your Windows PC will speak! The first argument should be a number between 1 and 100. The second argument should be some English words enclosed with double quotes. (If you omit the double quotes, then it will only read the first word.)

IF Wscript.Arguments.length > 1 THEN SET VOICE = CreateObject("SAPI.SpVoice") VOICE.Volume = Wscript.Arguments(0) VOICE.Speak Wscript.Arguments(1) WScript.Quit 1 ELSE WScript.Echo "Usage: speak.vbs <VOLUME> <TEXT>" END IF WScript.Quit 0

(Note: Don't send too much text all at one time, because the computer will freeze up while it speaks. At least, that's what happens in Windows XP. So, if you have a bunch of things you want the computer to read, then call SPEAK.VBS with just a few words at a time. That way if you want to press CTRL+BREAK, you can interrupt your program, and it will stop speaking. But if you call SPEAK.VBS with a whole paragraph, it will not stop until it has finished reading the entire paragraph.)


In reply to Re: text2speech and speech recognition for perl in 2023 by harangzsolt33
in thread text2speech and speech recognition for perl in 2023 by Discipulus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.