来自命令行的ms语音

Mas*_*erZ 27 cmd text-to-speech

有没有办法从命令行使用MS Speech实用程序?我可以在Mac上执行此操作,但在Windows XP上找不到任何对它的引用.

谢谢.

Ban*_*cid 35

关于这个主题的2美分,命令行单行:

  • 哇,这是一个很棒的答案 (2认同)

Chr*_*ars 24

有一个很好的开源程序可以在Windows上执行你所要求的名为Peter的Text to Speech的内容:http://jampal.sourceforge.net/ptts.html

它包含一个名为ptts.exe的二进制文件,它将从标准输入中说出文本,因此您可以像这样运行它:

echo hello there | ptts.exe
Run Code Online (Sandbox Code Playgroud)

或者,您可以使用以下三行VBS脚本来获得类似的基本TTS:

'say.vbs
set s = CreateObject("SAPI.SpVoice")
s.Speak Wscript.Arguments(0), 3
s.WaitUntilDone(1000)
Run Code Online (Sandbox Code Playgroud)

你可以从命令行调用它,如下所示:

cscript say.vbs "hello there"
Run Code Online (Sandbox Code Playgroud)

如果你去脚本路由,你可能想要找到一些带有变量超时和错误处理的更广泛的代码示例.

希望能帮助到你.


小智 5

还有Balabolka: http: //www.cross-plus-a.com/bconsole.htm 它有一个命令行工具balcon.exe。你可以这样使用它:

  1. 列出声音:

     balcon.exe -l
    
    Run Code Online (Sandbox Code Playgroud)
  2. 讲文件:

     balcon.exe -n "IVONA 2 Jennifer" -f file.txt
    
    Run Code Online (Sandbox Code Playgroud)
  3. 从命令行说话:

     balcon.exe -n "IVONA 2 Jennifer" -t "hello there"
    
    Run Code Online (Sandbox Code Playgroud)

有更多命令行选项可用。我在 Ubuntu 上尝试过,并在 Wine 中安装了 SAPI5。它工作得很好。