brief-vase-33757
07/05/2025, 10:56 AMtall-airline-16756
07/05/2025, 10:56 AMtall-airline-16756
07/05/2025, 10:56 AMfrom livekit import rtc
from livekit.agents import ModelSettings, stt, Agent
from typing import AsyncIterable, Optional
async def stt_node(
self, audio: AsyncIterable[rtc.AudioFrame], model_settings: ModelSettings
) -> Optional[AsyncIterable[stt.SpeechEvent]]:
async def filtered_audio():
async for frame in audio:
# insert custom audio preprocessing here
yield frame
async for event in Agent.default.stt_node(self, filtered_audio(), model_settings):
# insert custom text postprocessing here
yield event
This example demonstrates how to add a noise filtering step to the STT process. The method first creates a filtered audio stream with custom preprocessing, then passes it to the default STT node implementation, and finally allows for postprocessing of the transcribed text before yielding the speech events.
Sources: Voice pipeline nodes | LiveKit Docsbrief-vase-33757
07/05/2025, 10:57 AMtall-airline-16756
07/05/2025, 10:58 AM