You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The tts.say() doesn't work, i.e. doesn't push the audio.
Repro steps
tts = PlayHTTTSService(
user_id=os.getenv("PLAYHT_USER_ID"),
api_key=os.getenv("PLAYHT_API_KEY"),
voice_url=voice_url
)
tts.say("This is a text message to test the TTS say method.")
Potential root cause
the say method flushes the audio as last statement:
However, this is an abstract method defined in TTSService:
@abstractmethod
async def flush_audio(self):
pass
In several TTS classes, this method is not implemented, e.g. PlayHTTTSService
Therefore, the await self.flush_audio() call doesn't perform any operation. Consequently, the process_frame() might not end because it doesn't process the TTSStoppedFrame here:
async def run_tts(self, text: str) -> AsyncGenerator[Frame, None]:
try:
yield TTSStartedFrame()
# ... process audio chunks ...
yield TTSAudioRawFrame(chunk, self._settings["sample_rate"], 1)
# ... more processing ...
yield TTSStoppedFrame() # This frame might never be processed
The above is just a speculation because I lack the understanding of the underlying mechanisms of processing frames.
Solution
Is there a generic solution for flush_audio which works for all TTS services?
If not, what would be a workaround?
A workaround would be very helpful also to use with other methods like push_frame(TTSSpeakFrame()) or task.queue_frames to ensure completion, as currently, they all seem to queue the frames.
The text was updated successfully, but these errors were encountered:
Description
Bug
Environment
Issue description
The
tts.say()
doesn't work, i.e. doesn't push the audio.Repro steps
Potential root cause
the say method flushes the audio as last statement:
However, this is an abstract method defined in
TTSService
:In several TTS classes, this method is not implemented, e.g. PlayHTTTSService
Therefore, the
await self.flush_audio()
call doesn't perform any operation. Consequently, theprocess_frame()
might not end because it doesn't process theTTSStoppedFrame
here:The above is just a speculation because I lack the understanding of the underlying mechanisms of processing frames.
Solution
flush_audio
which works for all TTS services?A workaround would be very helpful also to use with other methods like
push_frame(TTSSpeakFrame())
ortask.queue_frames
to ensure completion, as currently, they all seem to queue the frames.The text was updated successfully, but these errors were encountered: