salmon-fountain-5704
03/26/2025, 4:00 PMtall-airline-16756
03/26/2025, 4:00 PMtall-airline-16756
03/26/2025, 4:00 PMuser_started_speaking
, user_stopped_speaking
, and user_speech_committed
to track and respond to user audio activity.
Sources: Voice activity detection (VAD) parameters | LiveKit Docs | Turn detection | LiveKit Docs | VoicePipelineAgent | LiveKit Docssalmon-fountain-5704
03/26/2025, 4:13 PMtall-airline-16756
03/26/2025, 4:14 PMfrom livekit import agents, rtc
from livekit.plugins import openai, silero
async def process_track(ctx: agents.JobContext, track: rtc.Track):
# Initialize Whisper STT
whisper_stt = openai.STT()
# Configure VAD with specific parameters
vad = silero.VAD.load(
min_speech_duration=0.1,
min_silence_duration=0.5,
)
vad_stream = vad.stream()
# StreamAdapter buffers audio until VAD emits END_SPEAKING event
stt = agents.stt.StreamAdapter(whisper_stt, vad_stream)
stt_stream = stt.stream()
# ...
This code initializes a VAD instance with specific parameters and processes audio tracks. You can also handle VAD events like user_started_speaking
and user_stopped_speaking
to respond to user audio activity.
If you need further assistance or customization, feel free to ask!
Sources: livekit.agents.pipeline.pipeline_agent API documentation | Working with plugins | LiveKit Docs