How can I improve noise cancellation in the LiveKi...
# ask-ai
r
How can I improve noise cancellation in the LiveKit Agent real-time option? It still picks up too much background noise, even though the output response is accurate. Why does this happen?
t
Thanks for reaching out, Av. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! If you’re looking to boost noise cancellation in the LiveKit Agent real-time option, here are some friendly tips to help you out: • Enable Background Voice Cancellation (BVC): Try using the BVC model in your server-side agent code (Python or Node.js). It’s great at cutting out background noise and other voices, which is especially handy for voice AI applications. • Use Enhanced Noise Cancellation: Take advantage of Krisp’s AI-powered noise cancellation—it’s included at no extra cost for LiveKit Cloud users! Just a heads-up: avoid turning on Krisp both on the frontend and server-side at the same time. • Keep WebRTC Defaults: Make sure WebRTC’s built-in noise suppression and echo cancellation are switched on. They work really well alongside the other noise cancellation features. Sometimes, background noise might sneak through if only basic WebRTC filtering is used, Krisp isn’t enabled, or if you’re on unsupported platforms or browsers. To get the best experience, double-check your setup and give the free noise canceller tool for LiveKit Cloud users a try—it’s a handy way to test things out. Sources: Enhanced noise cancellation | LiveKit Docs | OpenAI and LiveKit | LiveKit Docs | Noise & echo cancellation | LiveKit Docs | Audio and video | LiveKit Docs | AI voice agents | LiveKit Docs
r
i use gpt realtime option
t
Hey there! Just to make sure I’m on the right track, are you using the GPT real-time option with LiveKit’s server-side agent (like the Python or Node.js SDK), or is it a frontend setup? Knowing this will help me give you the best tips to improve noise cancellation for your situation.
r
• Use Enhanced Noise Cancellation: Take advantage of Krisp’s AI-powered noise cancellation—it’s included at no extra cost for LiveKit Cloud users! Just a heads-up: avoid turning on Krisp both on the frontend and server-side at the same time. tell me how to do this
t
Hey there! To get Krisp noise cancellation up and running, here’s a quick guide based on your setup: • Frontend (Outbound): For JavaScript/React projects, just install the
@livekit/krisp-noise-filter
package. You can use the
useKrispNoiseFilter
hook or manually add the filter to your microphone tracks. Just a heads-up—make sure your browser supports Krisp by checking with
isKrispNoiseFilterSupported()
. • Server-Side (Inbound): If you’re working with AI agents, you can turn on Krisp on the server side using the Python or Node.js SDK. Simply add
noise_cancellation.BVC()
or
NC()
to the
room_input_options
in your agent session. • Important: To keep things smooth, avoid enabling Krisp on both the frontend and server side at the same time—it can cause some unexpected hiccups. If you’d like some detailed code examples or need a hand with a specific platform or SDK, just give me a shout! I’m here to help you out. Sources: Enhanced noise cancellation | LiveKit Docs | packages/react/src/hooks/cloud/krisp/useKrispNoiseFilter.ts | Sources/LiveKitKrispNoiseFilter/LiveKitKrispNoiseFilter.swift | SIP overview | LiveKit Docs | Audio and video | LiveKit Docs
r
load_dotenv(override=True) instructions = ( "You are a helpful voice AI assistant." ) class Assistant(Agent): def __init__(self) -> None: super().__init__(instructions=instructions) async def entrypoint(ctx: agents.JobContext): session = AgentSession( llm=openai.realtime.RealtimeModel(model="gpt-4o-mini-realtime-preview",modalities=["text"]), tts=openai.TTS( model="tts-1", voice="ash", ), ) await session.start( room=ctx.room, agent=Assistant(), room_input_options=RoomInputOptions( # For telephony applications, use
BVCTelephony
instead for best results noise_cancellation=noise_cancellation.BVC(), ), ) if name == "__main__": agents.cli.run_app(agents.WorkerOptions(entrypoint_fnc=entrypoint,port=1100)) this my code block
t
Hey there! Your code block looks great and is all set up to use Background Voice Cancellation (BVC) to help keep unwanted noise and other voices out of your server-side agent. This means your real-time voice AI app should sound nice and clear. If you run into any hiccups or want a hand with anything else, just give me a shout—I’m here to help!
r
is my code use krisp ?
t
Hey there! Just a quick heads-up—your code isn’t using Krisp noise cancellation right now. Instead, it’s working with the Background Voice Cancellation (BVC) model from LiveKit, which is great for cutting out background noise and other voices on the server side. BVC does its thing independently of Krisp. If you’re interested in using Krisp noise cancellation, that would usually be set up on the frontend or need a different configuration. Just let me know if you want a hand with getting Krisp up and running—I’m here to help!
r
is BVC include noise cancallation
t
Yes, BVC (Background Voice Cancellation) does include noise cancellation! It not only cuts out background noise but also filters out other voices that aren’t the main speaker, which makes it super effective for voice AI applications. This helps give you clearer audio for things like transcription and turn detection. If you have any more questions or want to know more, just let me know—I’m here to help!
r
is krips and BVC noise cancellation are different ?
t
Hey there! Just to clarify, Krisp and BVC (Background Voice Cancellation) are actually two different types of noise cancellation: • Krisp: This one uses AI to cancel out background noise right on the frontend (the outbound audio). It’s great for cleaning up the sound coming from a participant’s device before it reaches the room. Just a heads-up, Krisp doesn’t remove other voices besides the main one. • BVC: This is a noise cancellation model that works on the server side, provided by LiveKit. It goes a step further by not only removing background noise but also filtering out non-primary voices. This makes it super handy for things like voice AI apps, transcription, and turn detection. Both do a great job, but they’re designed for different parts of the audio process. If you want me to break it down more or have any questions, just let me know—I’m here to help!
r
you said live kit cloud users can use krisp free. how to use it ?
t
Hey there! If you're using LiveKit Cloud, you can enjoy Krisp noise cancellation for free by simply turning it on in your frontend app. Here's a quick and easy way to get it going: • Install the Krisp Noise Filter: For JavaScript/React projects, just run
npm install @livekit/krisp-noise-filter
to get started. • Enable Krisp in Your Code: If you're using React, the
useKrispNoiseFilter
hook makes it super simple. Or, you can manually add the filter to your microphone tracks with the
setProcessor()
method. • Check Browser Compatibility: Make sure to use
isKrispNoiseFilterSupported()
to see if your browser plays nice with Krisp (heads up: Safari versions before 17.4 won’t work). If you’d like some detailed code snippets or need help with a particular platform, just give me a shout—I’m here to help!
r
i want to add it be
t
Hey there! Could you let me know which platform or environment you're working with (like JavaScript/React, iOS, or Android)? That way, I can give you the best tips on how to add Krisp noise cancellation to your setup.
r
can i add krisp part to from dotenv import load_dotenv from livekit import agents from livekit.agents import AgentSession, Agent, RoomInputOptions from livekit.plugins import ( openai, noise_cancellation, deepgram, groq ) from livekit.plugins import elevenlabs import os from livekit.plugins import ( groq, ) from livekit.plugins.turn_detector.multilingual import MultilingualModel from livekit.plugins.turn_detector.english import EnglishModel load_dotenv(override=True) instructions = ( "You are a helpful voice AI assistant." ) class Assistant(Agent): def __init__(self) -> None: super().__init__(instructions=instructions) async def entrypoint(ctx: agents.JobContext): session = AgentSession( llm=openai.realtime.RealtimeModel(model="gpt-4o-mini-realtime-preview",modalities=["text"]), tts=openai.TTS( model="tts-1", voice="ash", ), ) await session.start( room=ctx.room, agent=Assistant(), room_input_options=RoomInputOptions( # For telephony applications, use
BVCTelephony
instead for best results noise_cancellation=noise_cancellation.BVC(), ), ) if name == "__main__": agents.cli.run_app(agents.WorkerOptions(entrypoint_fnc=entrypoint,port=1100)) this code
t
Hey there! Just to clarify, Krisp noise cancellation is made for frontend (outbound) audio processing, but your code is set up for server-side (inbound) processing using the Python SDK. So, Krisp can’t be added directly to your current server-side setup. The good news is your code already uses Background Voice Cancellation (BVC), which is great for handling server-side noise and filtering out non-primary voices. If you’d like to use Krisp, it needs to be set up on the frontend. Feel free to reach out if you want a hand with setting up Krisp in a frontend app or if you have any other questions about your current setup—I’m here to help!
r
tell me how to use krisp noise cancallation free for my livekit agen. i am using livekit cloud
t
Hey there! Just a quick heads-up: Krisp noise cancellation isn’t available for server-side agents like the one in your code. It’s actually built for frontend (outbound) audio processing in LiveKit apps. Since you’re using a server-side agent with LiveKit Cloud, you’re already benefiting from Background Voice Cancellation (BVC), which is specially tuned to handle server-side noise and filter out non-primary voices. If you’d like to use Krisp, it needs to be set up on the frontend side. Feel free to reach out if you want a hand with setting that up or if you have any other questions about your current setup—I’m here to help!
r
i want to use on fe
t
Hey there! To get Krisp noise cancellation working on your frontend, here’s a simple guide to help you out: • Install the Krisp Noise Filter: If you’re working with JavaScript or React, just run
npm install @livekit/krisp-noise-filter
. Easy! • Enable Krisp in Your Code: For React, you can use the handy
useKrispNoiseFilter
hook. Or, if you prefer, manually apply the filter to your microphone tracks with the
setProcessor()
method. Here’s a quick example:
Copy code
import { useKrispNoiseFilter } from '@livekit/components-react/krisp';

function KrispToggle() {
  const krisp = useKrispNoiseFilter();

  return (
    <input type="checkbox" 
      onChange={(ev) => krisp.setNoiseFilterEnabled(ev.target.checked)}
      checked={krisp.isNoiseFilterEnabled}
      disabled={krisp.isNoiseFilterPending}
    />
  );
}
• Check Browser Compatibility: Before you dive in, use
isKrispNoiseFilterSupported()
to make sure your browser plays nice with Krisp (heads up: Safari versions below 17.4 won’t work). If you want, I’m here to help with more examples or if you’re using a different frontend framework. Just give me a shout!
r
is any delay happen ? use krisp
t
Using Krisp noise cancellation adds almost no delay to your audio streams. Since all the processing happens right on your device, none of your audio data is sent anywhere else, which keeps everything running smoothly in real time. Krisp is designed to work well with low-latency setups, though on devices with less power, you might see a bit more CPU usage—but don’t worry, this usually doesn’t cause any noticeable lag in your audio. If you have any questions or want to know more, just let me know—I’m here to help! Sources: Noise & echo cancellation | LiveKit Docs | Optimizing Video Calls for Low-Powered Devices in LiveKit (JS SDK ≥ v2.14... | Enhanced noise cancellation | LiveKit Docs | Noise & echo cancellation | LiveKit Docs | AI noise cancellation | LiveKit Docs
r
is krisp proccess happen on browse ? i mean client side ?
t
Hey! Just to let you know, Krisp processing happens completely on your device—right in your browser or app. That means all the noise cancellation is done locally, so none of your audio data goes out to external servers. It’s a great way to keep things private and make sure everything runs smoothly without delays. If you have any more questions or need a hand setting it up, I’m here to help—just ask!
r
are you sure
t
Absolutely! Krisp noise cancellation works right on your device, so none of your audio gets sent anywhere else. This helps keep things private and running smoothly without any delays. If you have any other questions or want me to explain anything further, just let me know—I’m here to help!
r
is we dont need to use krisp api ?
t
You're right, there's no need to use a separate Krisp API. Krisp noise cancellation is already built right into LiveKit's frontend SDKs, like the
@livekit/krisp-noise-filter
package for JavaScript/React. Everything runs locally on your device, so you don’t have to worry about any external API calls to Krisp. If you want a hand setting it up, just give me a shout—I’m here to help!