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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |