Chapter 34
Get started with Gemini-TTS voices using Text-to-Speech
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.Get started with Gemini-TTS voices using Text-to-Speech
Overview
This notebook introduces Gemini-TTS, the latest evolution of our Text-to-Speech technology that's moving beyond just naturalness to giving granular control over generated audio using text-based prompts. Using Gemini-TTS, you can synthesize speech from short snippets to long-form narratives, precisely dictating style, accent, pace, tone, and even emotional expression, all steerable through natural-language prompts. You can create conversations between two speakers with the same emotional expression and steerability.
There are currently 30 distinct voice options. See all available voices.
There are 80+ locale options to use for synthesis. See all available locales
Gemini-TTS is available through two APIs to help simplify the integration process for clients. Cloud Text-to-Speech API and Agent Platform API, with REST endpoints and SDKs in multiple programming languages.
In this tutorial, you learn how to:
- How to synthesize using both APIs.
- How to synthesize speech using real-time (online) processing.
- How to use formatting and expressive tags to modify the tone of the speech.
- How to synthesize dialogues with two speakers.
Choose the right API
If the following applies, choose Cloud Text-to-Speech API:
- If you are using Chirp 3 HD or other voices, then you can continue to use the same Cloud Text-to-Speech API with minimal incremental updates.
- If you need specific output encoding types, Cloud Text-to-Speech API can specify audio encoding. In Agent Platform API, the output is PCM 16bit 24k audio data, and doesn't have WAV headers. If you want to convert to another audio format, then the conversion needs to be handled from the client side.
- If you need bidirectional streaming, Cloud Text-to-Speech API supports multiple requests and multiple responses interaction. In contrast, Agent Platform API supports single request and multiple responses.
If the following applies, choose Agent Platform API:
- If you are already using Gemini-TTS from AI Studio, you can switch to Agent Platform seamlessly to take advantage of the scalability and compliance of Google Cloud.
- If you are using Agent Platform API for other models, then the unified api structure makes it easier to start using Gemini-TTS by specifying the model name and voice selection options.
Synthesize using Cloud Text-to-Speech API
Get started
Install Text-to-Speech SDK and other required packages
Minimum google-cloud-texttospeech version 2.31.0 is required to be able to use the Gemini-TTS related fields.
%%bash
# Detect the operating system
os=$(uname -s)
if [[ "$os" == "Linux" ]]; then
# Linux installation
sudo apt update -y -qq
sudo apt install ffmpeg -y -qq
echo "ffmpeg installed successfully on Linux."
elif [[ "$os" == "Darwin" ]]; then
# macOS installation
if command -v brew &> /dev/null; then
brew install ffmpeg
if [[ $? -eq 0 ]]; then
echo "ffmpeg installed successfully on macOS using Homebrew."
else
echo "Error installing ffmpeg on macOS using Homebrew."
fi
else
echo "Homebrew is not installed. Please install Homebrew and try again."
fi
else
echo "Unsupported operating system: $os"
fi%pip install --upgrade --quiet google-cloud-texttospeech
%pip show google-cloud-texttospeechAuthenticate your notebook environment (Colab only)
If you're running this notebook on Google Colab, run the cell below to authenticate your environment.
import sys
if "google.colab" in sys.modules:
from google.colab import auth
auth.authenticate_user()Set Google Cloud project information and initialize SDK
To get started using the Text-to-Speech API, you must have an existing Google Cloud project and enable the API.
Learn more about setting up a project and a development environment.
For regional availability, see documentation.
# Use the environment variable if the user doesn't provide Project ID.
import os
# fmt: off
PROJECT_ID = "[your-project-id]" # @param {type: "string", placeholder: "[your-project-id]", isTemplate: true}
# fmt: on
if not PROJECT_ID or PROJECT_ID == "[your-project-id]":
PROJECT_ID = str(os.environ.get("GOOGLE_CLOUD_PROJECT"))
TTS_LOCATION = "global"! gcloud config set project {PROJECT_ID}
! gcloud auth application-default set-quota-project {PROJECT_ID}
! gcloud auth application-default login -qImport libraries
from IPython.display import Audio, display
from google.api_core.client_options import ClientOptions
from google.cloud import texttospeech_v1beta1 as texttospeechSet constants
Initiate the API endpoint and the text to speech client.
API_ENDPOINT = (
f"{TTS_LOCATION}-texttospeech.googleapis.com"
if TTS_LOCATION != "global"
else "texttospeech.googleapis.com"
)
client = texttospeech.TextToSpeechClient(
client_options=ClientOptions(api_endpoint=API_ENDPOINT)
)Single-speaker speech synthesis
You define the text you want to convert, select a specific voice and language, and then instruct the API to generate an audio of the spoken text.
This example uses the Aoede voice, which is a high-definition voice, offering improved clarity. Feel free to choose another voice from the voice drop-down menu.
The code will call the synthesize_speech method, which handles the core conversion process, and the output will be an MP3 audio as bytes.
# fmt: off
MODEL = "gemini-3.1-flash-tts-preview" # @param ["gemini-3.1-flash-tts-preview", "gemini-2.5-flash-tts", "gemini-2.5-pro-tts"]
VOICE = "Aoede" # @param ["Achernar", "Achird", "Algenib", "Algieba", "Alnilam", "Aoede", "Autonoe", "Callirrhoe", "Charon", "Despina", "Enceladus", "Erinome", "Fenrir", "Gacrux", "Iapetus", "Kore", "Laomedeia", "Leda", "Orus", "Puck", "Pulcherrima", "Rasalgethi", "Sadachbia", "Sadaltager", "Schedar", "Sulafat", "Umbriel", "Vindemiatrix", "Zephyr", "Zubenelgenubi"]
LANGUAGE_CODE = "en-us" # @param ["am-et", "ar-001", "ar-eg", "az-az", "be-by", "bg-bg", "bn-bd", "ca-es", "ceb-ph", "cs-cz", "da-dk", "de-de", "el-gr", "en-au", "en-gb", "en-in", "en-us", "es-es", "es-419", "es-mx", "es-us", "et-ee", "eu-es", "fa-ir", "fi-fi", "fil-ph", "fr-fr", "fr-ca", "gl-es", "gu-in", "hi-in", "hr-hr", "ht-ht", "hu-hu", "af-za", "hy-am", "id-id", "is-is", "it-it", "he-il", "ja-jp", "jv-jv", "ka-ge", "kn-in", "ko-kr", "kok-in", "la-va", "lb-lu", "lo-la", "lt-lt", "lv-lv", "mai-in", "mg-mg", "mk-mk", "ml-in", "mn-mn", "mr-in", "ms-my", "my-mm", "nb-no", "ne-np", "nl-nl", "nn-no", "or-in", "pa-in", "pl-pl", "ps-af", "pt-br", "pt-pt", "ro-ro", "ru-ru", "sd-in", "si-lk", "sk-sk", "sl-si", "sq-al", "sr-rs", "sv-se", "sw-ke", "ta-in", "te-in", "th-th", "tr-tr", "uk-ua", "ur-pk", "vi-vn", "cmn-cn", "cmn-tw"]
# fmt: on
voice = texttospeech.VoiceSelectionParams(
name=VOICE, language_code=LANGUAGE_CODE, model_name=MODEL
)# @title Capture emotion with prompts
# fmt: off
PROMPT = "You are having a conversation with a friend. Say the following in a happy and casual way" # @param {type: "string"}
# fmt: on
TEXT = "hahaha, i did NOT expect that. can you believe it!" # @param {type: "string"}
# Perform the text-to-speech request on the text input with the selected
# voice parameters and audio file type
response = client.synthesize_speech(
input=texttospeech.SynthesisInput(text=TEXT, prompt=PROMPT),
voice=voice,
# Select the type of audio file you want returned
audio_config=texttospeech.AudioConfig(
audio_encoding=texttospeech.AudioEncoding.MP3
),
)
# play the generated audio
display(Audio(response.audio_content))# @title Modify pace of the speech
# fmt: off
PROMPT = "Say the following very fast but still be intelligible" # @param {type: "string"}
TEXT = "Availability and terms may vary. Check our website or your local store for complete details and restrictions." # @param {type: "string"}
# fmt: on
# Perform the text-to-speech request on the text input with the selected
# voice parameters and audio file type
response = client.synthesize_speech(
input=texttospeech.SynthesisInput(text=TEXT, prompt=PROMPT),
voice=voice,
# Select the type of audio file you want returned
audio_config=texttospeech.AudioConfig(
audio_encoding=texttospeech.AudioEncoding.MP3
),
)
# play the generated audio
display(Audio(response.audio_content))# @title Modify text with expressive tags
# NOTE: These tags are not strict syntax. Feel free to experiment with different
# expressions and formats.
PROMPT = "Say the following with a sarcastic tone" # @param {type: "string"}
# fmt: off
TEXT = "So.. [chuckling] tell me about this [coughs] AI thing." # @param {type: "string"}
# fmt: on
# Perform the text-to-speech request on the text input with the selected
# voice parameters and audio file type
response = client.synthesize_speech(
input=texttospeech.SynthesisInput(text=TEXT, prompt=PROMPT),
voice=voice,
# Select the type of audio file you want returned
audio_config=texttospeech.AudioConfig(
audio_encoding=texttospeech.AudioEncoding.MP3
),
)
# play the generated audio
display(Audio(response.audio_content))Multi-speaker (Dialog) speech synthesis
You can create a dialog between two speakers. Using multi_speaker_voice_config, you can specify the speakers, and assign a custom speaker name to reference in the input text.
There are two ways to structure the multi-speaker input
# @title Explicit turn-based syntax
SPEAKER_ALIAS_1 = "Zizu" # @param {type: "string"}
# fmt: off
SPEAKER_1 = "Fenrir" # @param ["Achernar", "Achird", "Algenib", "Algieba", "Alnilam", "Aoede", "Autonoe", "Callirrhoe", "Charon", "Despina", "Enceladus", "Erinome", "Fenrir", "Gacrux", "Iapetus", "Kore", "Laomedeia", "Leda", "Orus", "Puck", "Pulcherrima", "Rasalgethi", "Sadachbia", "Sadaltager", "Schedar", "Sulafat", "Umbriel", "Vindemiatrix", "Zephyr", "Zubenelgenubi"]
SPEAKER_ALIAS_2 = "Gary" # @param {type: "string"}
SPEAKER_2 = "Orus" # @param ["Achernar", "Achird", "Algenib", "Algieba", "Alnilam", "Aoede", "Autonoe", "Callirrhoe", "Charon", "Despina", "Enceladus", "Erinome", "Fenrir", "Gacrux", "Iapetus", "Kore", "Laomedeia", "Leda", "Orus", "Puck", "Pulcherrima", "Rasalgethi", "Sadachbia", "Sadaltager", "Schedar", "Sulafat", "Umbriel", "Vindemiatrix", "Zephyr", "Zubenelgenubi"]
LANGUAGE_CODE = "en-gb" # @param ["am-et", "ar-001", "ar-eg", "az-az", "be-by", "bg-bg", "bn-bd", "ca-es", "ceb-ph", "cs-cz", "da-dk", "de-de", "el-gr", "en-au", "en-gb", "en-in", "en-us", "es-es", "es-419", "es-mx", "es-us", "et-ee", "eu-es", "fa-ir", "fi-fi", "fil-ph", "fr-fr", "fr-ca", "gl-es", "gu-in", "hi-in", "hr-hr", "ht-ht", "hu-hu", "af-za", "hy-am", "id-id", "is-is", "it-it", "he-il", "ja-jp", "jv-jv", "ka-ge", "kn-in", "ko-kr", "kok-in", "la-va", "lb-lu", "lo-la", "lt-lt", "lv-lv", "mai-in", "mg-mg", "mk-mk", "ml-in", "mn-mn", "mr-in", "ms-my", "my-mm", "nb-no", "ne-np", "nl-nl", "nn-no", "or-in", "pa-in", "pl-pl", "ps-af", "pt-br", "pt-pt", "ro-ro", "ru-ru", "sd-in", "si-lk", "sk-sk", "sl-si", "sq-al", "sr-rs", "sv-se", "sw-ke", "ta-in", "te-in", "th-th", "tr-tr", "uk-ua", "ur-pk", "vi-vn", "cmn-cn", "cmn-tw"]
# fmt: on
PROMPT = "Read the following dialogue between two friends" # @param {type: "string"}
multi_speaker_voice_config = texttospeech.MultiSpeakerVoiceConfig(
speaker_voice_configs=[
texttospeech.MultispeakerPrebuiltVoice(
speaker_alias=SPEAKER_ALIAS_1, speaker_id=SPEAKER_1
),
texttospeech.MultispeakerPrebuiltVoice(
speaker_alias=SPEAKER_ALIAS_2, speaker_id=SPEAKER_2
),
]
)
multi_speaker_markup = texttospeech.MultiSpeakerMarkup(
turns=[
texttospeech.MultiSpeakerMarkup.Turn(
speaker=SPEAKER_ALIAS_1,
text="Have you tried the new multi-speaker feature on Gemini?",
),
texttospeech.MultiSpeakerMarkup.Turn(
speaker=SPEAKER_ALIAS_2, text="Yes! I am super excited about it"
),
]
)
response = client.synthesize_speech(
input=texttospeech.SynthesisInput(
multi_speaker_markup=multi_speaker_markup, prompt=PROMPT
),
voice=texttospeech.VoiceSelectionParams(
language_code=LANGUAGE_CODE,
model_name=MODEL,
multi_speaker_voice_config=multi_speaker_voice_config,
),
audio_config=texttospeech.AudioConfig(
audio_encoding=texttospeech.AudioEncoding.LINEAR16
),
)
# play the generated audio
display(Audio(response.audio_content))# @title Inline dialog text input
multi_speaker_voice_config = texttospeech.MultiSpeakerVoiceConfig(
speaker_voice_configs=[
texttospeech.MultispeakerPrebuiltVoice(
speaker_alias=SPEAKER_ALIAS_1,
speaker_id=SPEAKER_1,
),
texttospeech.MultispeakerPrebuiltVoice(
speaker_alias=SPEAKER_ALIAS_2,
speaker_id=SPEAKER_2,
),
]
)
response = client.synthesize_speech(
input=texttospeech.SynthesisInput(
text="Zizu: Have you tried the new multi-speaker feature on Gemini?\nGary: Yes! I am super excited about it",
prompt=PROMPT,
),
voice=texttospeech.VoiceSelectionParams(
language_code=LANGUAGE_CODE,
model_name=MODEL,
multi_speaker_voice_config=multi_speaker_voice_config,
),
audio_config=texttospeech.AudioConfig(
audio_encoding=texttospeech.AudioEncoding.LINEAR16
),
)
# play the generated audio
display(Audio(response.audio_content))Relax safety filters
Accounts with monthly invoiced billing may relax Gemini TTS's harmful content filters by setting relax_safety_filters in AdvancedVoiceOptions.
This field is not enabled for accounts without monthly invoiced billing.
# @title Demonstrate relaxing safety filters
PROMPT = "Say the following" # @param {type: "string"}
# fmt: off
TEXT = "This is input that would normally be blocked by Gemini TTS." # @param {type: "string"}
# fmt: on
# Perform the text-to-speech request on the text input with the selected
# voice parameters and audio file type
response = client.synthesize_speech(
input=texttospeech.SynthesisInput(text=TEXT, prompt=PROMPT),
voice=voice,
# Select the type of audio file you want returned
audio_config=texttospeech.AudioConfig(
audio_encoding=texttospeech.AudioEncoding.MP3
),
advanced_voice_options=texttospeech.AdvancedVoiceOptions(relax_safety_filters=True),
)
# play the generated audio
display(Audio(response.audio_content))Single-speaker synthesis using streaming processing
You can use the StreamingSynthesizeRequest method to get audio streamed back as soon as it is ready. This method is more suitable for real-time scenarios where fast response time is important for better user-experience.
A function like request_generator can be used to stream text into the API, for example from an LLM which generates the text as a response to a user action.
The audio stream will start after the client stops sending the text input, as indicated by half-close message. In the example below, the completion of the request_generator model implies the half-close operation.
In real-time applications, the streaming responses are meant to be heard immediately as the responses are sent from the TTS server. For example, in a web server scenario, where the client is connected to your webserver via websockets, you could use emit("audio", response.audio_content) to pass the audio to the client immediately.
# @title Calling Streaming synthesize
import datetime
import numpy as np
# fmt: off
PROMPT = "Say the following with a respectful tone" # @param {type: "string"} # fmt: skip
TEXT = "So.. tell me about this [coughs] AI thing. I would be super interested in learning the fundamentals and jump into the world of vibe coding" # @param {type: "string"} # fmt: skip
# fmt: on
config_request = texttospeech.StreamingSynthesizeRequest(
streaming_config=texttospeech.StreamingSynthesizeConfig(
voice=texttospeech.VoiceSelectionParams(
name=VOICE, language_code=LANGUAGE_CODE, model_name=MODEL
)
)
)
def request_generator():
yield config_request
yield texttospeech.StreamingSynthesizeRequest(
input=texttospeech.StreamingSynthesisInput(text=TEXT, prompt=PROMPT)
)
request_start_time = datetime.datetime.now()
streaming_responses = client.streaming_synthesize(request_generator())
is_first_chunk_received = False
final_audio_data = np.array([])
num_chunks_received = 0
for response in streaming_responses:
# just a simple progress indicator
num_chunks_received += 1
print(".", end="")
if num_chunks_received % 40 == 0:
print("")
# measuring time to first audio
if not is_first_chunk_received:
is_first_chunk_received = True
first_chunk_received_time = datetime.datetime.now()
# accumulating audio. In a web-server scenario, you would want to "emit" audio
# to the frontend as soon as it arrives.
#
# For example using flask socketio, you could do the following
# from flask_socketio import SocketIO, emit
# emit("audio", response.audio_content)
# socketio.sleep(0)
audio_data = np.frombuffer(response.audio_content, dtype=np.int16)
final_audio_data = np.concatenate((final_audio_data, audio_data))
time_to_first_audio = first_chunk_received_time - request_start_time
time_to_completion = datetime.datetime.now() - request_start_time
audio_duration = len(final_audio_data) / 24_000 # default sampling rate.
print("\n")
print(f"Time to first audio: {time_to_first_audio.total_seconds()} seconds")
print(f"Time to completion: {time_to_completion.total_seconds()} seconds")
print(f"Audio duration: {audio_duration} seconds")
display(Audio(final_audio_data, rate=24_000, autoplay=False))Synthesize using Agent Platform API
Get started
Install SDK and other required packages
%%bash
# Detect the operating system
os=$(uname -s)
if [[ "$os" == "Linux" ]]; then
# Linux installation
sudo apt update -y -qq
sudo apt install ffmpeg -y -qq
echo "ffmpeg installed successfully on Linux."
elif [[ "$os" == "Darwin" ]]; then
# macOS installation
if command -v brew &> /dev/null; then
brew install ffmpeg
if [[ $? -eq 0 ]]; then
echo "ffmpeg installed successfully on macOS using Homebrew."
else
echo "Error installing ffmpeg on macOS using Homebrew."
fi
else
echo "Homebrew is not installed. Please install Homebrew and try again."
fi
else
echo "Unsupported operating system: $os"
fi%pip install --upgrade --quiet google-genai
%pip show google-genaiAuthenticate your notebook environment (Colab only)
If you're running this notebook on Google Colab, run the cell below to authenticate your environment.
import sys
if "google.colab" in sys.modules:
from google.colab import auth
auth.authenticate_user()Set Google Cloud project information
To get started using Agent Platform, you must have an existing Google Cloud project and enable the API.
Learn more about setting up a project and a development environment.
# Use the environment variable if the user doesn't provide Project ID.
import os
# fmt: off
PROJECT_ID = "" # @param {type: "string", placeholder: "[your-project-id]", isTemplate: true}
# fmt: on
if not PROJECT_ID or PROJECT_ID == "[your-project-id]":
PROJECT_ID = str(os.environ.get("GOOGLE_CLOUD_PROJECT"))
LOCATION = os.environ.get("GOOGLE_CLOUD_REGION", "global")! gcloud config set project {PROJECT_ID}
! gcloud auth application-default set-quota-project {PROJECT_ID}
! gcloud auth application-default login -qImport libraries
import datetime
import wave
from IPython.display import Audio, display
from google import genai
from google.genai import typesSet constants
Initiate the Agent Platform client.
client = genai.Client(enterprise=True, project=PROJECT_ID, location=LOCATION)Single-speaker speech synthesis
# fmt: off
TEXT = "Say the following in a curious way: OK, so... tell me about this [um] AI thing." # @param {type: "string"}
# fmt: on
# Set up the wave file to save the output:
def wave_file(filename, pcm, channels=1, rate=24000, sample_width=2) -> None:
with wave.open(filename, "wb") as wf:
wf.setnchannels(channels)
wf.setsampwidth(sample_width)
wf.setframerate(rate)
wf.writeframes(pcm)
response = client.models.generate_content(
model="gemini-2.5-flash-tts",
contents=TEXT,
config=types.GenerateContentConfig(
speech_config=types.SpeechConfig(
language_code="en-in",
voice_config=types.VoiceConfig(
prebuilt_voice_config=types.PrebuiltVoiceConfig(
voice_name="Kore",
)
),
),
),
)
data = response.candidates[0].content.parts[0].inline_data.data
file_name = "output_speech.wav"
wave_file(file_name, data) # Saves the file to current directory
Audio("output_speech.wav")Single-speaker synthesis using streaming processing
# fmt: off
TEXT = "Say the following in a curious way: Radio Bakery is a New York City gem, celebrated for its exceptional and creative baked goods. The pistachio croissant is often described as a delight with perfect sweetness. The rhubarb custard croissant is a lauded masterpiece of flaky pastry and tart filling. The brown butter corn cake stands out with its crisp edges and rich flavor. Despite the bustle, the staff consistently receives praise for being friendly and helpful." # @param {type: "string"}
# fmt: on
# Set up the wave file to save the output:
def wave_file(filename, pcm, channels=1, rate=24000, sample_width=2) -> None:
with wave.open(filename, "wb") as wf:
wf.setnchannels(channels)
wf.setsampwidth(sample_width)
wf.setframerate(rate)
wf.writeframes(pcm)
def synthesize(text: str, model: str, voice: str, locale: str):
"""Synthesizes speech from the input text.
Args:
text: Text to synthesize.
model: Gemini TTS model name. gemini-2.5-flash-tts, gemini-2.5-flash-lite-preview-tts, and gemini-2.5-pro-tts
voice: voice name. Example: leda, kore. Refer to available voices
locale: locale name. Example: en-us. Refer to available locales.
"""
client = genai.Client(enterprise=True, project=PROJECT_ID, location=LOCATION)
generate_content_config = types.GenerateContentConfig(
speech_config=types.SpeechConfig(
language_code=locale,
voice_config=types.VoiceConfig(
prebuilt_voice_config=types.PrebuiltVoiceConfig(
voice_name=voice,
)
),
),
)
request_start_time = datetime.datetime.now()
is_first_chunk_received = False
final_audio_data = b""
num_chunks_received = 0
for chunk in client.models.generate_content_stream(
model=model,
contents=text,
config=generate_content_config,
):
# just a simple progress indicator
num_chunks_received += 1
print(".", end="")
if num_chunks_received % 40 == 0:
print("")
# measuring time to first audio
if not is_first_chunk_received:
is_first_chunk_received = True
first_chunk_received_time = datetime.datetime.now()
if (
chunk.candidates is None
or not chunk.candidates
or chunk.candidates[0].content is None
or not chunk.candidates[0].content.parts
):
continue
part = chunk.candidates[0].content.parts[0]
if part.inline_data and part.inline_data.data:
# accumulating audio. In a web-server scenario, you would want to
# "emit" audio to the frontend as soon as it arrives.
#
# For example using flask socketio, you could do the following
# from flask_socketio import SocketIO, emit
# emit("audio", chunk.candidates[0].content.parts[0].inline_data.data)
# socketio.sleep(0)
final_audio_data += chunk.candidates[0].content.parts[0].inline_data.data
time_to_first_audio = first_chunk_received_time - request_start_time
time_to_completion = datetime.datetime.now() - request_start_time
print("\n")
print(f"Time to first audio: {time_to_first_audio.total_seconds()} seconds")
print(f"Time to completion: {time_to_completion.total_seconds()} seconds")
return final_audio_data
audio_data = synthesize(TEXT, "gemini-2.5-flash-tts", "Kore", "en-in")
file_name = "output_speech.wav"
wave_file(file_name, audio_data)
Audio("output_speech.wav")Further details
Feel free to review the Cloud Text-to-Speech Python SDK documentation to explore all available fields and options to customize the API behavior.
To learn more about Gemini-TTS offering on Agent Platform, make sure to check out the Gemini-TTS Guide.
