in reply to text2speech and speech recognition for perl in 2023
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.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: text2speech and speech recognition for perl in 2023
by marto (Cardinal) on Jan 20, 2023 at 10:45 UTC |