Stake-And-Rope / dancho-voice-assistant

GNU General Public License v3.0
0 stars 0 forks source link

[Known Issue] pyttsx3 engine error in UNIX/Linux based OS #14

Open karastoyanov opened 1 year ago

karastoyanov commented 1 year ago

pyttsx3 throws a random error when trying to execute the engine. The issue is reproduced only under Linux based OS

engine = pyttsx3.init()

Current solution is to uninstall the python library, install it again and set dummy as engine

pip uninstall pyttsx3
pip install pyttsx3==2.71
engine = pyttsx3.init('dummy')

For Windows users, if you get engine.init() error try to change the engine to sapi5 Reference from official docs:

    sapi5 - SAPI5 on Windows
    nsss - NSSpeechSynthesizer on Mac OS X
    espeak - eSpeak on every other platform
karastoyanov commented 1 year ago

Another solution for Linux based operating systems is to install the espeak package and set it as value to the pyttsx engine.

engine = pyttsx3.init("espeak")
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[2].id)