简体   繁体   English

如何在python中使用espeak

[英]How to use espeak with python

I want to use espeak( http://espeak.sourceforge.net ) with python2.7.0-32 bit in windows7.我想在 windows7 中使用带有 python2.7.0-32 位的 espeak( http://espeak.sourceforge.net )。

Additionally, I also want to save the audio files generated by espeak.另外,我还想保存espeak生成的音频文件。

I tried to install this package in Windows 8 but couldn't really get it in the first few attempts.我试图在 Windows 8 中安装这个,但在最初的几次尝试中无法真正得到它。

But this is what i did to get espeak to work with python但这就是我为让 espeak 与 python 一起工作所做的工作

  1. Download and Install espeak for Windows from here这里下载并安装 espeak for Windows
  2. Add the eSpeak/command-line folder to PATH so that the command espeak is availableeSpeak/command-line文件夹添加到PATH以便命令espeak可用
  3. Call espeak commands using python module subprocess similar to how it is done in the example below使用 python 模块subprocess espeak调用espeak命令类似于它在下面的示例中的完成方式

http://machakux.appspot.com/blog/44003/making_speech_with_python http://machakux.appspot.com/blog/44003/making_speech_with_python

Im using this at the moment which is working well...on my Raspberry Pi我现在正在使用它,它运行良好......在我的 Raspberry Pi 上

from subprocess import call

call(["espeak","-s140 -ven+18 -z","Hello From Mike"])

How about something like this.这样的事情怎么样。

import subprocess

def execute_unix(inputcommand):
   p = subprocess.Popen(inputcommand, stdout=subprocess.PIPE, shell=True)
   (output, err) = p.communicate()
   return output

a = "Some amazing words of wisdom."

# write out to wav file 
b = 'espeak -w temp.wav "%s" 2>>/dev/null' % a  

# speak aloud
c = 'espeak -ven+f3 -k5 -s150 --punct="<characters>" "%s" 2>>/dev/null' % a #speak aloud

execute_unix(b) 
execute_unix(c) 

What are you asking exactly?你具体问什么?

Here there is documentation:这里有文档:

eSpeak Documentation eSpeak 文档

And samples:和样品:

eSpeak samples eSpeak 示例

If you have a specific doubt we can help you.如果您有具体的疑问,我们可以为您提供帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM