handsome-easter-5670
08/19/2025, 3:43 PMtall-airline-16756
08/19/2025, 3:43 PMtall-airline-16756
08/19/2025, 3:44 PMfrom livekit.plugins import silero
# Load the VAD model
vad = silero.VAD.load(
min_speech_duration=0.05,
min_silence_duration=0.4,
activation_threshold=0.5,
sample_rate=16000
)
# Create a stream for processing audio
stream = vad.stream()
# Process audio frames
for frame in audio_frames:
stream.push_frame(frame)
stream.end_input()
# Handle VAD events
async for event in stream:
if event.type == vad.VADEventType.START_OF_SPEECH:
print("Speech started")
elif event.type == vad.VADEventType.END_OF_SPEECH:
print("Speech ended")
elif event.type == vad.VADEventType.INFERENCE_DONE:
print(f"Speech probability: {event.probability}")
If you'd like to see a full example in action, check out this script: LiveKit Python Agents Examples.
And hey, if you have any questions or a specific scenario you're working on, just let me know — I'm here to help!
Sources: Silero VAD plugin | LiveKit Docs | livekit-plugins/livekit-plugins-silero/livekit/plugins/silero/__init__.py | plugins/silero/src/index.tshandsome-easter-5670
08/19/2025, 3:46 PMtall-airline-16756
08/19/2025, 3:47 PMhandsome-easter-5670
08/19/2025, 3:48 PMtall-airline-16756
08/19/2025, 3:50 PMasync for vad_event in vad_stream:
if vad_event.type == VADEventType.START_OF_SPEECH:
print("Speech started")
elif vad_event.type == VADEventType.END_OF_SPEECH:
print("Speech ended")
speech_frames = vad_event.frames
• Advanced Features:
◦ Real-time processing with thresholds you can tweak to fit your needs.
◦ Automatic resampling to handle different input sample rates smoothly.
◦ Speech buffering to make sure you capture the whole speech segment without missing a beat.
If you’re interested in diving into the source code or want help with specific configurations, just give me a shout! I’m happy to point you to the right resources or examples.
Sources: agents/src/stt/stream_adapter.ts | livekit-agents/livekit/agents/stt/stream_adapter.pyhandsome-easter-5670
08/19/2025, 3:51 PMtall-airline-16756
08/19/2025, 3:51 PM