Hello, I am trying to integrate TTS API to voice assistant but even though I use streamed response which I send to voice assistant in chunks, it still waits until stream ends. Is it possible to play stream in real-time?
I use logic like this in MQTT wyoming custom python script:
await self.write_event(AudioStart(rate=self.rate, width=self.width, channels=self.channels).event())
async for chunk in bytes_iter:
await self.write_event(AudioChunk(audio=bytes(to_send), rate=self.rate, width=self.width, channels=self.channels).event())
await self.write_event(AudioStop().event())
Voice assistant waits until AudioStop() event is written. So even though TTS starts sending audio in 200ms, it sometimes waits for like 10 seconds before it starts playing which is kinda annoying.