Open lout33 opened 1 year ago
Hey there, thanks a lot for reporting that issue.
It is quite much all pyttsx3 related and a fix for this is out of scope for RealtimeTTS. I think I can integrate the pyobjc installation for mac.
The - quite rough - suggested solution I found online was to just edit the nsss.py file of pyttsx3 and remove the attr['VoiceAge'] part. So it can be solved by editing your /opt/anaconda3/lib/python3.9/site-packages/pyttsx3/drivers/nsss.py at the 64 line and remove the attr['VoiceAge'] at this location
Hey there, thanks a lot for reporting that issue.
It is quite much all pyttsx3 related and a fix for this is out of scope for RealtimeTTS. I think I can integrate the pyobjc installation for mac.
The - quite rough - suggested solution I found online was to just edit the nsss.py file of pyttsx3 and remove the attr['VoiceAge'] part. So it can be solved by editing your /opt/anaconda3/lib/python3.9/site-packages/pyttsx3/drivers/nsss.py at the 64 line and remove the attr['VoiceAge'] at this location
deleting the attr['VoiceAge'] do solve the error, however when I try the following demo code, the program runs but generate no sound.
`from RealtimeTTS import TextToAudioStream, SystemEngine
engine = SystemEngine(voice= 'Zoe (Premium)') # replace with your TTS engine stream = TextToAudioStream(engine) stream.feed("Hello world! How are you today?") stream.play_async()`
Oh, sorry - this demo code might be misleading.
You either need to write:
stream.play_async()
while stream.is_playing():
time.sleep(0.1)
Or this:
stream.play()
stream.play_async() while stream.is_playing(): time.sleep(0.1)
when I tried that or the stream.play() one, this is the new error I got
engine system failed to synthesize sentence "How are you today?" with error: run loop already started Traceback: Traceback (most recent call last): File "/venv/lib/python3.10/site-packages/RealtimeTTS/text_to_stream.py", line 279, in synthesize_worker success = self.engine.synthesize(sentence) File "/venv/lib/python3.10/site-packages/RealtimeTTS/engines/system_engine.py", line 69, in synthesize self.engine.runAndWait() File "*****/venv/lib/python3.10/site-packages/pyttsx3/engine.py", line 183, in runAndWait raise RuntimeError('run loop already started') RuntimeError: run loop already started
Error: run loop already started engine system is the only engine available, can't switch to another engine
Hm, never saw this one so far. Googled it but no idea currently. What happens if you run this basic pyttsx3 test without RealtimeTTS?
import pyttsx3
engine = pyttsx3.init()
engine.say("I will speak this text")
engine.runAndWait()
Does this play out?
Hm, never saw this one so far. Googled it but no idea currently. What happens if you run this basic pyttsx3 test without RealtimeTTS?
import pyttsx3 engine = pyttsx3.init() engine.say("I will speak this text") engine.runAndWait()
Does this play out?
it plays out no problem
I'm lost with this one, I have to admit.
RealtimeTTS would split the input text into sentences and then loop
self.engine.save_to_file(text, self.file_path)
self.engine.runAndWait()
for every sentence. Unsure what goes wrong here with the runAndWait(), googled the error but got no insights. Sadly I got no Mac here to debug, very sorry I can't offer further help currently.
I'm lost with this one, I have to admit.
RealtimeTTS would split the input text into sentences and then loop
self.engine.save_to_file(text, self.file_path) self.engine.runAndWait()
for every sentence. Unsure what goes wrong here with the runAndWait(), googled the error but got no insights. Sadly I got no Mac here to debug, very sorry I can't offer further help currently.
the pyttsx3 lib was known for its blocking behaviour which have caused a lot of weird problems on Mac, well, I'm not gonna give up on this one, because it's currently the best performing one on GitHub, if I figure out what's going on, I will let you know
@holytony have u figured out the solution to this problem? I'm also a MacBook user struggling with this problem
@holytony have u figured out the solution to this problem? I'm also a MacBook user struggling with this problem
Nah, unfortunately the clusterfuck with nsss and pyttsx3 on macOS it's beyond me
I'm lost with this one, I have to admit.
RealtimeTTS would split the input text into sentences and then loop
self.engine.save_to_file(text, self.file_path) self.engine.runAndWait()
for every sentence. Unsure what goes wrong here with the runAndWait(), googled the error but got no insights. Sadly I got no Mac here to debug, very sorry I can't offer further help currently.
Still haven't figured out a way to make it work, but here is what I have found:
also @Jiminator if you are still working on this, hope the infos above helps
Code:
Also i had to install the pip3 install pyobjc==9.0.1 for this sample to work