nateshmbhat / pyttsx3

Offline Text To Speech synthesis for python
Mozilla Public License 2.0
1.99k stars 321 forks source link

Resolves #142 for empty save_to_file() on darwin platform (NSSS driver) #276

Open skibblenybbles opened 1 year ago

skibblenybbles commented 1 year ago

I traced the empty file / hanging behavior to _busy state management in the driver proxy. The underlying NSSpeechSynthesizer object behaves similarly for say() and save_to_file(), but save_to_file() was not updating the busy and completion states before starting synthesis the way that say() does. The state mismanagement caused the second call to save_to_file() to start an event loop that would never be terminated.

The intentions of the state management in the driver proxy are not perfectly clear to me, so this may not be a completely robust fix, but it does resolve the hanging behavior. Please note that you still must save .aiff or .wav files with the NSSS driver, not .mp3.

Akul2010 commented 1 year ago

Since this is no longer being updated, would you like to join me as I try to maintain this project when I can? Link is here: https://github.com/Akul-AI/rlvoice-1

skibblenybbles commented 1 year ago

Since this is no longer being updated, would you like to join me as I try to maintain this project when I can? Link is here: https://github.com/Akul-AI/rlvoice-1

Hi @Akul2010 - I ended up publishing this single bugfix to PyPi as pyttsx3-alt. I didn't want to fracture the original pyttsx3 even more, but I needed to get this bugfix into production. I would actually prefer not to become a maintainer for pyttsx3 or any spinoff projects, but please feel free to incorporate this two-line bugfix in your project.

I'll consider replacing pyttsx3 with rlvoice for any future updates I make to my pyttsx3-dependent applications. Thank you!