Gemini Live
Stork Live · tested 2026-12-02
Give a Gemini Live voice agent a face over its WebSocket.
Before you start
A page that already talks to Gemini Live. The reply arrives as pieces of 24 kHz PCM, not as an audio track.
Code
const live = await StorkLive.mount(canvas, { avatar: 'a', siteKey: 'YOUR_SITE_KEY' })
// Gemini sends the reply as pieces of 24 kHz PCM: play them into a stream, and give the avatar the stream
const ctx = live.ctx = new AudioContext() // in a click handler
const out = ctx.createMediaStreamDestination()
live.speak(out.stream)
let playAt = 0
function play(pcm16) { // one decoded piece, an Int16Array
const buf = ctx.createBuffer(1, pcm16.length, 24000)
buf.getChannelData(0).set(Float32Array.from(pcm16, (v) => v / 32768))
const src = ctx.createBufferSource(); src.buffer = buf; src.connect(out)
playAt = Math.max(playAt, ctx.currentTime + 0.05); src.start(playAt); playAt += buf.duration
}When the user interrupts, stop the queued sources and set playAt back to 0.
Check it works
A face that blinks, with the Powered by stork.ai mark in the corner. When your audio plays, the lips move.
If it does not
- No sound. Create the AudioContext in a click handler, and connect each piece to the stream (out), not to ctx.destination.
- A black box. The browser has no WebGL 2.
Next
Change the letter to change the face: 'a' to 'h' are free. To use a face of your own without the mark, see Your own avatar.
