我有intsalled pyttsx3 2.7v和python 3.7v in pycharm
我的代码: code功能不返回音频输出
import pyttsx3
engine = pyttsx3.init("dummy")
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)
def speak(text):
print('Rex:' + text)
engine.say(text)
engine.runAndWait()
print("On")
speak("This programe is runniing perfectly")
print("End")输出
On
Rex:This programe is runniing perfectly
End
Process finished with exit code 0发布于 2020-05-26 03:51:31
这很简单,我曾与Pyttsx3合作过。试试下面的程序。
import pyttsx3
engine = pyttsx3.init('sapi5') # <--- sapi 5 is for Windows
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id) # <--- voice id can be male(0) or female(1)
def speak(audio):
engine.say(audio)
engine.runAndWait()不需要打印语句。
https://stackoverflow.com/questions/61978527
复制相似问题