feat(google): add Gemini 3.1 Flash TTS support#1820
feat(google): add Gemini 3.1 Flash TTS support#1820rosetta-livekit-bot[bot] wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 0835a48 The changes in this PR will be included in the next version bump. This PR includes changesets to release 35 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| for (const frame of bstream.flush()) { | ||
| sendLastFrame(false); | ||
| lastFrame = frame; | ||
| } |
There was a problem hiding this comment.
🚩 AudioByteStream.flush() produces 0-sample frame when buffer is empty
When all audio data aligns perfectly with the AudioByteStream frame size (bytesPerFrame = 4800 bytes for 24kHz mono at 100ms), the internal buffer is empty at flush time. AudioByteStream.flush() at agents/src/audio.ts:76-93 doesn't guard against an empty buffer — it always returns an array with one frame, even if that frame has 0 samples. This 0-sample frame becomes lastFrame and is emitted as the final: true frame. The resemble plugin guards against this (plugins/resemble/src/tts.ts:155: if (frame.samplesPerChannel === 0) continue), but most other plugins don't. This is a pre-existing issue not introduced by this PR — the old Gemini code had the same exposure.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
gemini-3.1-flash-tts-previewTesting
pnpm test plugins/google/src/beta/gemini_tts.test.tspnpm --filter @livekit/agents-plugin-google buildpnpm build:pluginspnpm --filter livekit-agents-examples buildPorted from livekit/agents#6134
Original PR description
…handling, and include new examples and tests.