在 Pycharm 上使用 Pyttsx3 模块进行文本转语音期间未获得任何音频输出

问题描述 投票:0回答:2

我的python版本是3.7,Pyaudio版本是2.7 程序在引擎初始化期间完全运行,但我不能使用 sipas5 for windows 所以我使用了 dummy

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 program is running perfectly")
    print("End")

输出

On
Rex:This program is running perfectly
End

Process finished with exit code 0
python python-3.x pycharm text-recognition pyttsx
2个回答
0
投票

Dummy 不是语音引擎。它的tk只是测试。 pyttsx3 有 3 种类型。 Sapi5、nsss 和 espeak。这就是你放在 init () 中的内容。这是带有信息的官方 python 包的链接。

https://pypi.org/project/pyttsx3/


0
投票

字面意思就是做对 pip3 install pyttxs3 = 2.71

© www.soinside.com 2019 - 2024. All rights reserved.