Phase 3 implemented — Text LLM can now stream to the TTS pipeline with the !miku say command

This commit is contained in:
2026-01-17 00:01:17 +02:00
parent 9943cecdec
commit 3e59e5d2f6
3 changed files with 123 additions and 2 deletions

View File

@@ -281,8 +281,21 @@ class MikuVoiceSource(discord.AudioSource):
await self.send_token(word + " ", pitch_shift)
# Small delay to avoid overwhelming the TTS
await asyncio.sleep(0.05)
async def flush(self):
"""
Send flush command to TTS to trigger synthesis of buffered tokens.
This ensures any remaining text in the TTS buffer is synthesized.
"""
if self.websocket:
try:
await self.websocket.send_json({"flush": True})
logger.debug("Sent flush command to TTS")
except Exception as e:
logger.error(f"Failed to send flush command: {e}")
async def _receive_audio(self):
"""Background task to receive audio from WebSocket and buffer it."""
try: