# Google TTS Plugin Unsupported audio encoding error

**URL:** <https://community.livekit.io/t/google-tts-plugin-unsupported-audio-encoding-error/1890>\
**Category:** Getting Started\
**Created:** [August 19, 2026, 11:06am UTC](https://community.livekit.io/t/google-tts-plugin-unsupported-audio-encoding-error/1890 "2026-08-19T11:06:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kerem\_Kezer](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/kerem_kezer/32/2259_2.png) [@Kerem\_Kezer](https://community.livekit.io/u/Kerem_Kezer)\
**Post date:** [August 19, 2026, 11:06am UTC](https://community.livekit.io/t/google-tts-plugin-unsupported-audio-encoding-error/1890/1 "2026-08-19T11:06:25Z")

</div>

When I try standard voice i don’t get this error. However I try gemini-flash-tts I have this error.

FAILED tests/agent/test\_latency.py::test\_gemini\_tts\_latency - livekit.agents.\_exceptions.APIStatusError: message=‘Unsupported audio encoding.’, status\_code=400…

```auto
tts = google.TTS(
model_name="gemini-2.5-flash-tts", # veya gemini-2.5-flash-tts
voice_name="Algenib", # veya Callirrhoe, Zephyr, Aoede vb.
)

@pytest.mark.asyncio

async def test_gemini_tts_latency():

metrics_data = \[\]

for i, text in enumerate(TEST_TEXTS):

    test_id = i + 1

    output_file = f"latency_test_output\_{test_id}.wav"

    wav = wave.open(output_file, "wb")

    wav.setnchannels(1)

    wav.setsampwidth(2)

    wav.setframerate(24000)

    first_chunk_time = None

    total_audio_bytes = 0

    time_to_first_audio = 0.0

    start_time = time.perf_counter()

    stream = tts.synthesize(text=text)

    async for audio in stream:

        if first_chunk_time is None:

            first_chunk_time = time.perf_counter()

            time_to_first_audio = first_chunk_time - start_time

        chunk_data = audio.frame.data.tobytes()

        total_audio_bytes += len(chunk_data)

        wav.writeframes(chunk_data)

    wav.close()

    end_time = time.perf_counter()

    total_time = end_time - start_time

    test_result = {

        "test_id": test_id,

        "text_length": len(text),

        "ttfa_seconds": round(time_to_first_audio, 4),

        "total_time_seconds": round(total_time, 4),

        "audio_size_bytes": total_audio_bytes,

        "file_path": output_file

    }

    metrics_data.append(test_result)

with open("latency_metrics.json", "w", encoding="utf-8") as f:

    json.dump(metrics_data, f, indent=4)

```

---

<div class="post-metadata">

**Author:** ![darryncampbell](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/darryncampbell/32/20_2.png) [@darryncampbell](https://community.livekit.io/u/darryncampbell)\
**Post date:** [August 19, 2026, 12:39pm UTC](https://community.livekit.io/t/google-tts-plugin-unsupported-audio-encoding-error/1890/2 "2026-08-19T12:39:33Z")

</div>

Hi, I think the `Unsupported audio encoding` message is misleading.

The root cause, I believe, is you are passing a model intended for Gemini TTS into Google Cloud TTS.

Gemini TTS:

> **[Gemini TTS plugin guide | LiveKit Documentation](https://docs.livekit.io/agents/models/tts/gemini/)**
>
> How to use the Gemini TTS plugin for LiveKit Agents.

Google Cloud TTS:

> **[Google Cloud TTS integration guide | LiveKit Documentation](https://docs.livekit.io/agents/models/tts/google/)**
>
> How to use the Google Cloud TTS plugin for LiveKit Agents.

---

<div class="post-metadata">

**Author:** ![Kerem\_Kezer](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/kerem_kezer/32/2259_2.png) [@Kerem\_Kezer](https://community.livekit.io/u/Kerem_Kezer)\
**Post date:** [August 19, 2026, 1:24pm UTC](https://community.livekit.io/t/google-tts-plugin-unsupported-audio-encoding-error/1890/3 "2026-08-19T13:24:59Z")

</div>

Thank you so much. At first, I tried using GEMINI API but It doesn’t support streaming capabilities and due to its speed. I transitioned into Google API. Is there any possible solution to use GEMINI Models with streaming capabilities?

---

<div class="post-metadata">

**Author:** ![Kerem\_Kezer](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/kerem_kezer/32/2259_2.png) [@Kerem\_Kezer](https://community.livekit.io/u/Kerem_Kezer)\
**Post date:** [August 19, 2026, 2:15pm UTC](https://community.livekit.io/t/google-tts-plugin-unsupported-audio-encoding-error/1890/4 "2026-08-19T14:15:36Z")

</div>

BTW issue is due to audio encoding type. I changed audio encoding type to LINEAR16 and it works.  
Google cloud support these models as you can see in the cloud documentation as well as dictated as parameters inside plugin

```auto
GeminiTTSModels = Literal\[

    *"gemini-3.1-flash-tts-preview"*,

    *"gemini-2.5-flash-tts"*,

    *"gemini-2.5-flash-lite-preview-tts"*,

    *"gemini-2.5-pro-tts"*,

\]

```

> **[Gemini-TTS  |  Cloud Text-to-Speech  |  Google Cloud Documentation](https://docs.cloud.google.com/text-to-speech/docs/gemini-tts)**
>
> Learn about Gemini-TTS, the latest evolution of Text-to-Speech technology offering granular control over generated audio using text-based prompts.

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex001/user_avatar/community.livekit.io/system/32/26_2.png) [@system](https://community.livekit.io/u/system)\
**Post date:** [August 21, 2026, 2:16pm UTC](https://community.livekit.io/t/google-tts-plugin-unsupported-audio-encoding-error/1890/5 "2026-08-21T14:16:34Z")

</div>

Closed on August 21, 2026, 2:16pm UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
