chore: re-addd more silence before speech audio

This commit is contained in:
Twirre Meulenbelt
2026-01-27 18:19:20 +01:00
parent 82aa7c76df
commit 941aa00b7b
2 changed files with 20 additions and 9 deletions

View File

@@ -285,9 +285,10 @@ class VADAgent(BaseAgent):
assert self.audio_out_socket is not None
await self.audio_out_socket.send(self.audio_buffer[: -2 * len(chunk)].tobytes())
# At this point, we know that the speech has ended.
# Prepend the last chunk that had no speech, for a more fluent boundary
self.audio_buffer = chunk
# At this point, we know that there is no speech.
# Prepend the last few chunks that had no speech, for a more fluent boundary.
self.audio_buffer = np.append(self.audio_buffer, chunk)
self.audio_buffer = self.audio_buffer[-begin_silence_length * len(chunk) :]
async def handle_message(self, msg: InternalMessage):
"""