相关疑难解决方法(0)

如何改变pyttsx3中的声音?

这段代码正在运行,但我只能在Microsoft Windows中预先安装的声音之间切换.这些声音是"Microsoft David Mobile"和"Microsoft Zira Mobile".

后来我安装了"Microsoft Kalpana Mobile"并将其设置为默认的Windows语音.但我仍然无法切换到"Microsoft Kalpana Mobile".代码是 -

import pyttsx3
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id) #changing index changes voices but ony 0 and 1 are working here
engine.say('Hello World')
engine.runAndWait()
Run Code Online (Sandbox Code Playgroud)

只有0和1作为声音[]内的索引.

我想要"微软Kalpana Mobile"发言.我在这个项目上工作了2个月.如果这不起作用,我所有的努力都将继续下去.请帮忙:(

提前致谢.

python text-to-speech speech-synthesis python-3.x pyttsx

3
推荐指数
2
解决办法
1万
查看次数