嗯,您应该按照该示例中的建议使用
engine.setProperty('voice',voice_id)(
voice_id作为系统中语音的ID;您可以从中获取可用语音的列表
engine.getProperty('voices')):
engine = pyttsx.init()voices = engine.getProperty('voices')for voice in voices: engine.setProperty('voice', voice.id) # changes the voice engine.say('The quick brown fox jumped over the lazy dog.')engine.runAndWait()
您不必循环,可以设置语音ID而无需
for循环。
像这样做:
engine = pyttsx.init()engine.setProperty('voice', voice_id) # use whatever voice_id you'd likeengine.say('The quick brown fox jumped over the lazy dog.')
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)