Gemini Live audio to a browser avatar: an early PCM adapter

Hi everyone, I’m with Kasamila, a commercial paid avatar API/SDK. We’ve published an early example for connecting Gemini Live reply audio to a browser avatar.

The backend uses Google Gen AI SDK, sends 16 kHz mono PCM input, and reads the output sample rate from Gemini’s audio MIME metadata. It consumes all audio parts in each model turn and clears queued speech when Gemini reports an interruption. Only the assistant’s output drives the avatar, and the SDK owns audio playback to avoid duplicate sound.

Code and setup:

A few limits worth knowing:

  • Automated tests use mocked events. Credentialed Gemini-to-avatar end-to-end acceptance is still outstanding.
  • Permanent Google and Kasamila keys stay server-side. This is a loopback starter that needs application authentication and production hardening before public deployment.
  • Automatic Gemini session resumption is not implemented. Runtime billing continues until the session is ended; stopping audio alone does not end it.
  • Lip motion is audio-driven. Gaze, expressions and body movement come from the chosen template, with no independent semantic control of those movements.

Separate product preview:

No registration is needed, with up to ten minutes per user. You can select Gemini in the preview. This standalone preview does not validate the published adapter’s end-to-end integration.

I’d welcome technical feedback from developers adding a visible avatar to a Gemini voice app, especially around interruption handling and session cleanup. Which part would you want demonstrated first?

I wanted to use Gemma for most of FriendAlly but it kept hitting OOM. I personally prefer Google but I had to get the Local customizable AI companion functioning. I ended up mostly using Qwen.

I’m pretty happy with how it turned out. Feel free to check it out if you want.

Thanks, Steven — I read FriendAlly’s README, though I haven’t run it. The local-first approach and existing lip-sync pipeline make the distinction important: our Kasamila example here connects Gemini Live audio to a browser avatar; it isn’t a local Gemma runtime or a fix for the OOM issue.

If you revisit Gemma, which model/quantization, context length and GPU memory were involved, and did the OOM occur with Gemma alone or with the speech/avatar components loaded too? That would help separate the model’s footprint from the combined pipeline.

Is keeping FriendAlly fully offline a firm requirement, or are you also exploring a browser/audio integration path? I wouldn’t assume a cloud-based adapter fits your project.

Yeah cloud based is awesome for quality. My issue with cloud based is the lack of customization. Controlling how forgetful the companion is, how often they come up with ideas on their own, how fast and how extreme their emotional responses are, how their memories are constructed, how their memories are cleaned up in a sleep cycle, how huge their mouths are, what species they are, what voice they have etc. Cloud based tend to have strict controls and also the privacy issue too. Local allows people to talk about highly personal stuff with no through about it being shared with others. Local is also free. If people want quality, cloud-based is always the go. Local will take decades to properly compete with the extreme processing that cloud-based systems have. I kept on seeing avatars and companions with awesome lip-sync but then I’d see they couldn’t run locally for most people. Otherwise the latency was off the charts.

I was looking at the 12b version of Gemma4 I think. On a 12GB card with TTS, STT, and MuseTalk, it just took up too much space or time. Even the 4b used up more memory. I didn’t go into it too much since I just wanted to get some models that worked.

The weird thing is that there hasn’t been a real upgrade in local lip-sync since MuseTalk came out. And it’s like 2 years old. I was expecting to find something significantly better. Seems like cloud-based is the only real place to get those significant improvments.

Thanks, Steven—that clarifies the local-first requirement: privacy and control over the companion’s behavior, not just model choice. I wouldn’t try to steer FriendAlly toward a cloud renderer on that basis. Our Kasamila example isn’t evidence of an offline replacement for MuseTalk.

An architecture I’d consider is keeping memory, initiative and emotion policy separate from the speech/avatar components, so swapping a renderer doesn’t mean replacing those controls. That separation alone would not make a network renderer private or offline.

For the 12GB setup, a small reproducible comparison could help: record the exact model, quantization and context length, then compare the model alone with the full STT/TTS/avatar pipeline using the same short interaction. Track peak GPU memory and time to first audible response separately. Since the earlier setup wasn’t investigated closely, I wouldn’t treat it as a model-level benchmark.

For FriendAlly’s next step, which is the main constraint: fitting the full pipeline into that memory budget, improving lip-sync, or making response timing more consistent?

Well it’s all working fine. Until new models come out, there’s nothing I can do. Marketing would be good but I hate marketing. So zero views is fine. The thing I like is that in 2 years time when someone says “Hey there is a new AI companion and it has emotions!!!” I’ll be like “Dude that’s been out for years. I made that 2 years ago. They haven’t done anything new. They just reinvented the wheel. The thing they have though is the marketing team to get people to know it exists.”

You can cure cancer but if you don’t have the marketing team and don’t package it right, billions could die because no one knows it exists. Just the way of the world.