Every audio that I get back from a batch API request today has a very loud TV static segment at the end for about 0.1-0.2 seconds. I have generated thousands of short audio files over the past few days and none of them had this issue until today. I’ve been able to reproduce it multiple times and it’s extremely consistent.
I can’t attach the audio files here, but I’m just doing a standard batch request with the latest versions of the libraries and it’s happening with every audio file on every response so I’m hoping it’s easily reproducible.
Here is the relevant code for the actual batch API call. All the submissions get compiled into a jsonl and submitted as a file. The audio that comes back is reencoded to mp3 to reduce the file size, but I’ve confirmed that the raw .wav data is also affected.
Here is the raw jsonl data for one of the submissions (limited to 1 sentence). I have confirmed the issue reproduces with this exact request. It’s still happening today with every request, so it doesn’t appear to be a transient issue.
Gemini 3.8 TTS returns non-streaming audio as a WAV file, not raw PCM (Audio output formats). Your to_mp3 treats the whole file as audio samples, so the metadata block at the end of the file plays as static.
Please try the below steps:
Decode with AudioSegment.from_wav(io.BytesIO(pcm)) and drop the 0.2 s trim.
Or set generationConfig.responseFormat.audio.mimeType to AUDIO_L16 to get raw PCM (API reference).