"""test_pocket_tts_service.py Test script verifying PocketTTSService with custom_pocket voice clone state. """ import asyncio from pocket_tts_service import PocketTTSService from pipecat.frames.frames import TTSAudioRawFrame async def test_pocket_service(): print("Testing PocketTTSService with 'custom_pocket' voice clone state...") service = PocketTTSService(voice="custom_pocket", sample_rate=24000) frames = [] async for frame in service.run_tts("Hello! This is a real-time speech test of Pocket TTS.", "test-ctx"): if isinstance(frame, TTSAudioRawFrame): frames.append(frame) assert len(frames) > 0, "No audio frames generated!" total_bytes = sum(len(f.audio) for f in frames) duration_s = (total_bytes / 2) / 24000.0 print(f"PASS: Generated {len(frames)} audio frame(s), total {total_bytes} bytes ({duration_s:.2f}s audio at 24kHz)!") if __name__ == "__main__": asyncio.run(test_pocket_service())