crooked-tiger-31253
06/27/2025, 11:48 PMtall-airline-16756
06/27/2025, 11:48 PMtall-airline-16756
06/27/2025, 11:48 PMoutput_emitter
object using its push()
method.
5. Finally, the emitter is flushed with output_emitter.flush()
.
For example, in the Neuphonic plugin:
audio_bytes = base64.b64decode(parsed_message["data"]["audio"])
output_emitter.push(audio_bytes)
And in the Groq plugin:
async for data, _ in resp.content.iter_chunks():
output_emitter.push(data)
The AudioEmitter
object handles the streaming of these audio bytes to the LiveKit agent session.
Sources: GitHub::livekit::agents | livekit-plugins/livekit-plugins-resemble/livekit/...crooked-tiger-31253
06/28/2025, 12:04 AMtall-airline-16756
06/28/2025, 12:05 AMoutput_emitter
, which organizes the data into streaming-friendly audio frames. Pretty cool, right?
Now, the Cartesia plugin has its own little twist:
1. In the ChunkedStream approach, audio data comes in chunks from the Cartesia API and gets pushed straight to the `output_emitter`: `async for data, _ in resp.content.iter_chunks():
output_emitter.push(data)`It's like receiving a puzzle piece by piece!
2. With the WebSocket method, it's similar but with an extra step - the base64 data gets decoded first: `if data.get("data"):
b64data = base64.b64decode(data["data"])
output_emitter.push(b64data)`A quick translation before sending it on its way.
The coolest part? In both plugins, the AudioEmitter is the behind-the-scenes hero, making sure those audio bytes stream smoothly to the LiveKit agent session. Technology is awesome, isn't it? 🎉 Sources: GitHub::livekit::agents | livekit-plugins/livekit-plugins-elevenlabs/README... | GitHub::livekit::agents | livekit-plugins/livekit-plugins-cartesia/livekit/...