Back to library
AI
tutorial

Reduce Latency in Voice Apps with Gemini TTS Streaming

Enable real-time audio playback in your apps using Gemini streaming.

Use the new `streamGenerateContent` capability with the Gemini 3.1 Flash TTS model to reduce latency in text-to-speech applications.

Google Gemini

The Scenario

You are building a real-time accessibility tool or a customer service bot where long wait times for audio generation lead to a poor user experience. Streaming allows the audio to start playing as it's being generated.

Before & after

The old way

Previously, users had to wait for the entire audio file to be generated before playback could begin. For a long paragraph, this could take 10–15 seconds of silence.

With AI

Developers can now implement streaming with `streamGenerateContent` using the `gemini-3.1-flash-tts-preview` model. This reduces waiting time to just 1–2 seconds for the first audio chunk to play.

The Prompt

// Example configuration for streaming TTS in Gemini API
const model = genAI.getGenerativeModel({ model: "gemini-3.1-flash-tts-preview" });
const result = await model.generateContentStream([
  "Read the following text with a [STYLE: e.g., professional and calm] tone and a [ACCENT: e.g., British] accent: [INSERT_TEXT_HERE]"
]);

Streaming support via streamGenerateContent is now available for the gemini-3.1-flash-tts-preview model. This allows for near-instantaneous audio feedback in applications like real-time translators or voice assistants.

Source

Release notes  |  Gemini API  |  Google AI for Developers
"Streaming support for speech generation via streamGenerateContent is now available for the gemini-3.1-flash-tts-preview model."