Advance Gemini icon

Advance Gemini

Interact with Google Gemini AI models

Generate TTS

AI-generated

Summary

Converts text to speech using Google Gemini's TTS models, supporting single or multiple voices with customizable playback speed.

Inputs

  • ttsModel (required) — Select the Gemini TTS model: 'gemini-2.5-flash-preview-tts' (recommended, fewer restrictions) or 'gemini-2.5-pro-preview-tts' (higher quality).
  • voiceInstruction (required) — Instructions for the voice's tone and style (e.g., 'Read aloud in a warm, welcoming tone').
  • voiceTranscript (required) — The text to convert to speech.
  • voiceMode — Choose 'single' to use one voice for all text or 'multi' to assign different voices to different speakers.
  • voiceName — The specific voice to use (available voices include Zephyr, Puck, Charon, etc.). Only visible in single-voice mode.
  • speakerVoices — Configure voices for each speaker in multi-speaker mode. Includes a speaker label and a voice name.
  • uploadToS3 — Whether to upload the generated audio to an S3 bucket and return the URL.
  • s3BucketName — Name of the S3 bucket to upload to (required if uploadToS3 is enabled).
  • s3PublicDomain — Optional public domain URL (e.g., https://cdn.example.com). If provided, the final URL will use this domain instead of the default S3 URL.
  • temperature — Controls randomness in the output (0 to 2).
  • playbackSpeed — Adjust playback speed of the output audio (0.1 to 10). 1.0 = normal, 2.0 = 2x faster, 0.5 = half speed.

Output shape

A single record containing JSON metadata and a binary audio file (WAV format) or an S3 URL.

If the input transcript exceeds 2000 characters, it is split into chunks processed concurrently. The resulting audio is concatenated into a single WAV file with playback speed adjustments applied. Requires a Google Gemini API key.

Examples

Example 1: Generate a simple text-to-speech audio file

Select 'Flash' model, 'Zephyr' voice, default playback speed, and do not upload to S3.

Example 2: Create a multi-speaker dialogue with custom playback speed

Select 'Pro' model, 'Multi-Speaker' mode, configure two speakers (e.g., 'Speaker 1' with 'Puck', 'Speaker 2' with 'Zephyr'), set playback speed to 1.2.

Example 3: Upload generated audio directly to an S3 bucket

Enable 'Upload to S3', provide 's3BucketName', and optionally 's3PublicDomain' for a custom CDN URL.

Links

Discussion