"""Text-to-speech (TTS) – multi-speaker (up to 2 speakers)."""
from google import genai
from google.genai import types
from _helpers import save_wav

def main() -> None:
    client = genai.Client()

    prompt = """Joe: How's it going today Jane?
Jane: Not too bad, how about you?"""

    resp = client.models.generate_content(
        model="gemini-2.5-flash-preview-tts",
        contents=prompt,
        config=types.GenerateContentConfig(
            response_modalities=["AUDIO"],
            speech_config=types.SpeechConfig(
                voice_config=types.VoiceConfig(
                    multi_speaker_voice_config=types.MultiSpeakerVoiceConfig(
                        speaker_voice_configs=[
                            types.SpeakerVoiceConfig(
                                speaker="Joe",
                                voice_config=types.VoiceConfig(
                                    prebuilt_voice_config=types.PrebuiltVoiceConfig(voice_name="Kore")
                                ),
                            ),
                            types.SpeakerVoiceConfig(
                                speaker="Jane",
                                voice_config=types.VoiceConfig(
                                    prebuilt_voice_config=types.PrebuiltVoiceConfig(voice_name="Puck")
                                ),
                            ),
                        ]
                    )
                )
            ),
        ),
    )

    pcm = resp.candidates[0].content.parts[0].inline_data.data
    save_wav("out_multi.wav", pcm)
    print("Saved out_multi.wav")

if __name__ == "__main__":
    main()
