nateshmbhat / pyttsx3

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

Infinite Looping in startLoop sapi5.py #308

Open MikeKadoshnikov opened 3 months ago

MikeKadoshnikov commented 3 months ago

Using this package in a Robotics project, we have a function for speaking below: def say(self, text):   self.face.set_robot_state("talking")   if (self.voice._inLoop):    self.voice.endLoop()   self.voice.say(text)   self.voice.runAndWait()   self.face.set_robot_state("idle")

and the runAndWait() function ends up running into an infinite loop. Going through PyCharm debugging I have narrowed it down to sapi5.py where it is getting stuck in startLoop(self) and looking at the code it is not obvious how this while loop is supposed to stop. Haven't found any resources on circumventing this issue, as its unfortunate since we wanted to use this package for our assignments, we will have to look for an alternative. pyttsx3issue

MikeKadoshnikov commented 3 months ago

Found a way to have it not infinite loop but it requires us to initialize pyttsx3 every time we want the robot to say something, although it works it seems somewhat resource intensive since we have to reinitialize it everytime