Phase 3 implemented — Text LLM can now stream to the TTS pipeline with the !miku say command
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user