开发者

speech synthesis in perl

Is it possible to make computer (windows or linux, mac) speak in perl ? I know it is possible with VB script. But how about perl ?

In VB we just write

CreateObject("SAPI.SpVoice").Speak"I can speak开发者_StackOverflow "

How do we do this in perl ?


The Speech::Synthesis module can interface to Microsoft's SAPI 5 API, which it looks like you're using in VB. There's also Win32::SAPI5, which is Windows-specific but may offer more control, or you can just use Win32::OLE:

use Win32::OLE;

Win32::OLE->CreateObject('SAPI.SpVoice')->Speak('I can speak');

Of course, if you're going to speak multiple times, you'd probably want to create the object only once, store it in a variable, and call Speak multiple times on it.


A quick CPAN search shows that PerlSpeak, Speech::Synthesis, and Speech::eSpeak all are capable of speech synthesis.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜