I tried to run the "minimalistic_talkbot" test using ElevenlabsEngine for TTS. It works fine for the first user input & AI response but subsequent responses from the AI fail to convert to speech with the following errors (depending on usage of play or play_async of course):
RealTimeSTT: root - WARNING - play_async() called while already playing audio, skipping
RealTimeSTT: root - WARNING - play() called while already playing audio, skipping
It seems to be triggered by the initial check to acquire the play_lock when play() is called. This lock can not be acquired after play() is run for the first time because it doesn't get released for engines with the attribyute _can_consumegenerators=True. The only place in text_to_stream.py where where the lock is released is in the else clause of an if-else check for this attribute.
if self.engine.can_consume_generators:
[...]
else:
[...]
if is_external_call:
if self.on_audio_stream_stop:
self.on_audio_stream_stop()
self.is_playing_flag = False
self.play_lock.release()
Moving this section outside of the if-else statement solved the problem for my use case, but did not want to create a pull request for it as I do not know/could not check if it breaks something else.
I tried to run the "minimalistic_talkbot" test using ElevenlabsEngine for TTS. It works fine for the first user input & AI response but subsequent responses from the AI fail to convert to speech with the following errors (depending on usage of play or play_async of course):
It seems to be triggered by the initial check to acquire the play_lock when play() is called. This lock can not be acquired after play() is run for the first time because it doesn't get released for engines with the attribyute _can_consumegenerators=True. The only place in text_to_stream.py where where the lock is released is in the else clause of an if-else check for this attribute.
Moving this section outside of the if-else statement solved the problem for my use case, but did not want to create a pull request for it as I do not know/could not check if it breaks something else.