Ank*_*kur 3 python speech-recognition text-to-speech
我是这种编程的新手,涉及文本到语音或语音到文本的转换,这就是我在这里寻求一些初步帮助的原因.我已经在互联网上搜索过它并且我为ubuntu遇到了pyttsx,最初我无法开始使用它,但不知何故我设法做到了但现在问题是我键入这样的东西:
import pyttsx
engine=pyttsx.init()
Run Code Online (Sandbox Code Playgroud)
它给出了分段错误.我需要帮助,并告诉我是否使用正确的工具.提前致谢!
小智 9
espeak默认包含在ubuntu中.从python中试试这个.
import os
import datetime
def tts(text):
return os.system("espeak -s 155 -a 200 "+text+" " )
m = datetime.datetime.now().strftime("%I %M %S")
tts("'Sir the time is"+str(int(m[0:2]))+" "+str(int(m[3:5]))+" : ' ")
Run Code Online (Sandbox Code Playgroud)
$ sudo apt-get install sphinx2-bin libsphinx2-dev
# enter your password when prompted
$ python -i
>>> import pyttsx
>>> engine=pyttsx.init()
>>> engine.say('Sally sells seashells by the seashore.')
>>> engine.runAndWait()
Run Code Online (Sandbox Code Playgroud)