我在pycharm中具有intsalle d pyttsx3 2.7v和python 3.7v
我的代码:说功能不返回音频输出
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
我在pycharm中安装了pyttsx3 2.7v和python 3.7v我的代码:说话功能未返回音频输出导入pyttsx3 engine = pyttsx3.init(“ dummy”)声音= engine.getProperty('voices')...] >
这非常容易,我与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()