mammoth-tiger-73810
07/30/2025, 8:42 PMtall-airline-16756
07/30/2025, 8:43 PMtall-airline-16756
07/30/2025, 8:44 PMroom_io for noise cancellation in your code, you need to import it from the livekit.agents.voice module. Below are the correct import statements and usage details:
Import Statements:
from livekit.agents.voice import room_io
from livekit.plugins import noise_cancellation
Alternatively, you can import specific classes directly:
from livekit.agents.voice.room_io import RoomInputOptions
from livekit.plugins import noise_cancellation
Usage Example:
await session.start(
agent=agent,
room=ctx.room,
room_input_options=room_io.RoomInputOptions(
noise_cancellation=noise_cancellation.BVC(),
)
)
Available Noise Cancellation Models:
• `noise_cancellation.NC()`: Standard enhanced noise cancellation
• `noise_cancellation.BVC()`: Background voice cancellation (NC + removes non-primary voices)
• `noise_cancellation.BVCTelephony()`: Background voice cancellation optimized for telephony applications
Installation:
Before using noise cancellation, ensure you have installed the required package:
pip install "livekit-plugins-noise-cancellation~=0.2"
The room_io module is part of the core LiveKit Agents framework and facilitates communication between your agent and room participants, while the noise cancellation functionality is provided through a separate plugin that integrates with the RoomInputOptions.
Sources: complex-agents/nutrition-assistant/agent.py | livekit-agents/livekit/agents/voice/room_io/__init__.py | Noise & echo cancellation | LiveKit Docs