Phase 2 implemented and tested. Added warmup to pipeline and Miku queues tokens while the pipeline is warming up

This commit is contained in:
2026-01-16 23:37:34 +02:00
parent b0066f3525
commit 9943cecdec
9 changed files with 631 additions and 15 deletions

View File

@@ -17,7 +17,7 @@ async def handle_voice_command(message, cmd, args):
Args:
message: Discord message object
cmd: Command name (join, leave, voice-status)
cmd: Command name (join, leave, voice-status, test)
args: Command arguments
"""
@@ -30,6 +30,9 @@ async def handle_voice_command(message, cmd, args):
elif cmd == 'voice-status':
await _handle_status(message)
elif cmd == 'test':
await _handle_test(message, args)
else:
await message.channel.send(f"❌ Unknown voice command: `{cmd}`")
@@ -227,3 +230,36 @@ async def _handle_status(message):
embed.set_footer(text="Use !miku leave to end the session")
await message.channel.send(embed=embed)
async def _handle_test(message, args):
"""
Handle !miku test command.
Test TTS audio playback in the current voice session.
"""
session = voice_manager.active_session
if not session:
await message.channel.send("❌ No active voice session! Use `!miku join` first.")
return
if not session.audio_source:
await message.channel.send("❌ Audio source not connected!")
return
# Get test text from args or use default
test_text = " ".join(args) if args else "Hello! This is a test of my voice chat system."
try:
await message.channel.send(f"🎤 Speaking: *\"{test_text}\"*")
logger.info(f"Testing voice playback: {test_text}")
# Stream text to TTS via the audio source
await session.audio_source.stream_text(test_text)
await message.add_reaction("")
logger.info("✓ Test audio sent to TTS")
except Exception as e:
logger.error(f"Failed to test voice playback: {e}", exc_info=True)
await message.channel.send(f"❌ Error testing voice: {e}")