big-controller-60015
07/13/2025, 10:39 PMtall-airline-16756
07/13/2025, 10:39 PMtall-airline-16756
07/13/2025, 10:40 PM_create_owned_stream
method in audio_stream.py
is responsible for creating a new audio stream designed to receive audio frames from a specific track. Here’s a step-by-step breakdown of what it does and how it fits into LiveKit’s audio stream infrastructure:
• Track Validation: Ensures a track is attached to the instance before proceeding.
• FFI Request Creation: Sets up a protocol buffer request (FFI), which enables Python code to communicate with the underlying Rust implementation.
• Stream Configuration: Assigns track handle, sample rate, channel count, frame size (if set), and marks the stream as a native audio stream.
• Audio Filter Configuration: If audio filtering (like noise cancellation) is enabled, it attaches filter modules and their options, allowing server-side audio processing.
• FFI Request Execution: Sends the request through the FFI client, creating the stream on the Rust side. The method returns an object representing the new audio stream.
This function acts as the bridge between the Python SDK and the native Rust-based WebRTC/audio processing engine, allowing for efficient and configurable audio stream creation within LiveKit’s architecture.
For more details, see the internal documentation on audio streams in the Python SDK.
Sources: livekit-rtc/livekit/rtc/_proto/ffi_pb2.pyibig-controller-60015
07/13/2025, 10:41 PMtall-airline-16756
07/13/2025, 10:41 PM_create_owned_stream
won't automatically send audio to the STT service – you'll need to do a bit of manual work.
Don't worry, though! Here's a friendly guide to connecting your audio stream to the speech-to-text system:
1. First, create an AudioStream
from your track.
2. Next, set up a separate STT stream.
3. Then, you'll want to manually forward those audio frames. It's pretty straightforward – here's an example:
async for ev in audio_stream:
stt_stream.push_frame(ev.frame)
This is just how LiveKit's current SDK is set up, so a little extra step is needed to get your speech-to-text working smoothly. Hope this helps!
Sources: livekit-rtc/livekit/rtc/audio_stream.py | Transcriptions | LiveKit Docs