Integration guides ยท 2026-09-22

Two-speaker dialogue with Gemini TTS

Unlike single-voice long-text narration, this covers how to set up a two-speaker dialogue, and why assigning a separate voice to each speaker matters.

Diagram showing a dialogue script with two speakers, each mapped to a separate voice, narrated turn by turn and merged in order.

Dialogue needs a different setup than single-voice long text

As the Gemini 2.5 Pro Preview TTS long-text narration article explains, the core work when narrating long text with a single voice is splitting it at sentence boundaries. When narrating a dialogue between two speakers (a podcast draft or a customer service scenario, for example), an extra layer comes into play: fixing on your side which voice reads which speaker.

LLMTR's `/v1/audio/speech` endpoint takes a single `voice` value per request; it has no field for assigning two voices to two speakers within one request. If you send the whole dialogue in one request, every line is read in the same voice.

Narrate the dialogue turn by turn in separate requests

The supported path is splitting the dialogue script at each change of speaker and sending every chunk as its own request with the `voice` value assigned to that speaker. You then merge the returned audio chunks on your side, in dialogue order. Keeping the speaker-to-voice mapping in a single table in your code guarantees the right voice is chosen for every request.

A speaker's voice choice should stay consistent; the same speaker being read with a different voice in different parts confuses the listener. Because the chunks are separate requests, tone and pacing can vary slightly from chunk to chunk; before merging, confirm the chunks share the same sample rate and consider adding a short silence at each transition.

  • Split the dialogue script at each change of speaker.
  • Send each chunk as a separate request with that speaker's `voice` value.
  • Merge the returned audio on your side in dialogue order.

Verify the output format

Just as with single-voice narration, dialogue chunks also require checking the actual format of the returned audio (sample rate, channel count) and saving the file accordingly; assuming a default format can result in an unplayable or corrupted audio file.

Frequently asked questions

Up to how many speakers can be narrated in a single request?

Through LLMTR each request is read in a single voice. The number of speakers is limited by your merge step, not by the request: assign one voice per speaker and narrate the chunks in order to build a dialogue with two or more speakers.

Can I use a different language for each speaker?

That depends on the language support of the voices you choose. Before mixing languages in a dialogue, you need to separately verify that each voice you assign supports its target language.

Related posts