pyttsx3 fails to work on my mac (python 11)
# sample code from the readme
import pyttsx3
engine = pyttsx3.init()
engine.save_to_file('Hello World', 'test.mp3')
engine.runAndWait()
Actually, pyttsx3 fails to work on mac and I found this issue Not working pyttsx3 on macos mentioned https://pypi.org/project/py3-tts/ and with py3-tts it can work on my mac.
But save_to_file fails to work, the code just stucks there and won't exit. After some trial and error I found that I can save tts to a wav file NOT mp3. But why is that?
I think it is because NSSS (the default MacOS speech engine) doesn't support exporting to
.mp3.I tried to install espeak-ng, the latest fork to original espeak, (check https://github.com/espeak-ng/espeak-ng?tab=readme-ov-file#history) to see if espeak-ng can be supported. But sadly it fails to run on macOS. So I have to save tts to
.wavfile and use other tool convert it to.mp3