0

Had a need to use pyttsx3 on Windows Server 2016, Python version 3.11.1. If the speakers are not connected (via connection before virtual desktop), an error occurs:

line 69, in save_to_file
    temp_stream = self._tts.AudioOutputStream
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ctypes.CMError: (-2147200966, None, (None, None, None, None, 0, None))

Code:

import pyttsx3

engine = pyttsx3.init("sapi5", debug=True)
voices = engine.getProperty("voices")
engine.setProperty("voice", voices[3].id) #2

temp_file = "temp.wav"

engine.save_to_file("Hello World!", temp_file)
engine.runAndWait()

Almost always the server will run without a connection to the virtual desktop. Tried different ways to fix it, nothing helps. Maybe someone knows how to fix it?

I've tried using programs to simulate connected speakers, but haven't found anything worthwhile. Ideally, the system should synthesize speech without speakers connected.

Tiaranso
  • 1
  • 1

0 Answers0