Open liudashang opened 1 year ago
i have changed the code and commit to:https://github.com/Jiangshan00001/pyttsx4 you can have a try if you need:
pip install pyttsx4
import pyttsx4
engine = pyttsx4.init()
engine.save_to_file('Hello World' , 'test.wav')
engine.runAndWait()
My suggestion, change the source code pyttsx3\drivers\sapi5.py 'save_to_file'. add a 'try except' like this
Adding the try except works perfect on a windows virtual machine - thank you!
Pretty sure we’ve fixed this. Will double check.
I'm writing a flask web which using the pyttsx3. the server's OS is win server 2019, it is a vmware virtualmachine. The virtualmachine does not have an audio card. When I using RDP(mstsc) to connect the server, server 2019 will create a audio output device by “Remote audio playback”. I login the web by myself computer, and create a tts job. The program writing a wav file is OK. But, when I disconnect the server, I create a tts job, the program writing a empty wav file. And the pyttsx3's debug info display:
The reason for this situation is, win server 2019 dose not have an audio output device, SpVoice AudioOutputStream Object will raise an exception.
My suggestion, change the source code pyttsx3\drivers\sapi5.py 'save_to_file'. add a 'try except' like this: