Do you recommend using the server-side <noise_canc...
# ask-ai
m
Do you recommend using the server-side noise_cancellation.NC() or BVC noise cancellation AND the frontend Krisp noise cancellation as well? Like both noise filters?
t
Thanks for reaching out, Alexander. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! Just a quick heads-up: it’s best not to use both server-side noise cancellation (like
noise_cancellation.NC()
or BVC) and frontend Krisp noise cancellation at the same time. Since noise cancellation models are trained on raw audio, feeding them audio that’s already been filtered can lead to some unexpected results. Here’s what we recommend: • Pick either frontend Krisp noise cancellation or server-side noise cancellation — using both together isn’t a great idea. • If you’re working with voice AI applications, server-side BVC is usually the way to go because it effectively removes background noise and other voices, which really helps keep your speech-to-text transcription clean. Also, feel free to keep standard WebRTC noise suppression and echo cancellation turned on alongside either option. They work at a different level and actually complement the noise cancellation nicely. Sources: Enhanced noise cancellation | LiveKit Docs
m
Is standard WebRTC noise suppression and echo canellation turned on by default? Do I have to do anything to turn it on?
t
Hey there! Just a quick heads-up: WebRTC noise suppression and echo cancellation are usually turned on by default in LiveKit, but it can vary depending on the SDK and platform you're using: • Android SDK: Both of these handy features are enabled right out of the box. • JavaScript SDK: The default capture options already include
echoCancellation: true
and
noiseSuppression: true
. • Flutter SDK: These settings come along as part of the media constraints with default values set to
true
. • iOS/macOS Swift SDK: Things are a bit different here—Apple’s built-in voice processing is used instead of WebRTC’s, so these features are
false
by default unless you turn them on yourself. If you want to enable them manually, no worries! You can easily set the audio capture options when you initialize the microphone. Here’s a quick example:
Copy code
// JavaScript example
room.localParticipant.setMicrophoneEnabled(true, { echoCancellation: true, noiseSuppression: true });
Feel free to reach out if you'd like me to walk you through the steps for your specific platform—I’m here to help! Sources: lib/src/track/options.dart | Tests/LiveKitTests/AudioProcessingTests.swift | Noise & echo cancellation | LiveKit Docs | AI voice agents | LiveKit Docs | livekit-android-sdk/src/main/java/io/livekit/android/room/track/LocalAudioT...
m
I’m not interested in isolated all voices. It needs to hear two people speak, so is standard NC the better option- and not using Krisp on my local client?
t
When you’re trying to catch what several people are saying, the usual WebRTC noise suppression might not cut it. It’s great at cutting down constant background noise, but it’s not built to tell different voices apart. Krisp noise cancellation on the frontend can help make audio clearer, but it’s not really designed for situations with lots of speakers either. The best way to handle multiple voices is with LiveKit’s server-side Background Voice Cancellation (BVC) model. BVC is made to block out other background voices while keeping the main speaker’s audio clear. This makes it perfect for conversations with multiple people and helps ensure your speech-to-text transcription stays accurate. If you’re not using voice AI or transcription and just want to boost audio quality for everyone, Krisp noise cancellation on the frontend is still a solid option. But when you’ve got lots of people talking, BVC is definitely the way to go. Sources: Noise & echo cancellation | LiveKit Docs | AI voice agents | LiveKit Docs | src/room/track/LocalAudioTrack.ts | Enhanced noise cancellation | LiveKit Docs
Hey there! To get Background Voice Cancellation (BVC) up and running in Python on the backend, just follow these simple steps: 1. *First, install the noise cancellation plugin:*`pip install "livekit-plugins-noise-cancellation~=0.2"` 2. *Then, set up BVC in your agent like this:*`from livekit.plugins import noise_cancellation await session.start( agent=MyAgent(), room=ctx.room, room_input_options=RoomInputOptions( noise_cancellation=noise_cancellation.BVC(), ), )` Here’s a full example to make it clearer:
Copy code
from livekit.plugins import noise_cancellation
from livekit.agents import AgentSession, RoomInputOptions

session = AgentSession(
    vad=ctx.proc.userdata["vad"],
)

await session.start(
    room=ctx.room,
    agent=Assistant(),
    room_input_options=RoomInputOptions(
        noise_cancellation=noise_cancellation.BVC(),  # This turns on BVC for inbound audio
    ),
)
If you hit any bumps or want to chat more about this, just let me know—I’m here to help! Sources: Enhanced noise cancellation | LiveKit Docs | agent.py