which noise_cancellation is supported by self-host...
# ask-ai
n
which noise_cancellation is supported by self-hosted options?
t
Thanks for reaching out, Rafał. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thank you for reaching out! Could you please help me understand a bit more about what you mean by "noise_cancellation"? Are you looking for details on specific features, how to integrate it, or how to configure noise cancellation in your self-hosted LiveKit setup? I'm here to help you every step of the way!
n
how to configure noise cancellation in my self-hosted LiveKit setup?
t
I’d love to help clarify how noise cancellation works with your setup! Enhanced noise cancellation using Krisp (like Background Voice Cancellation or standard Noise Cancellation) is available on LiveKit Cloud, but it’s not supported in self-hosted setups. For your self-hosted deployment, you can still rely on the default WebRTC-based noise suppression and echo cancellation. You can set these up using the following options: • AudioCaptureOptions: This lets you enable WebRTC noise suppression and echo cancellation when your client connects. • AudioSourceOptions: By setting
noise_suppression: true
, you activate the built-in WebRTC suppression features. Just a quick tip: make sure your agent code doesn’t include any references to enhanced noise cancellation plugins (like
noise_cancellation.BVC()
) that you might see in cloud examples. If you’d like, I’m here to help you configure these options in your frontend or agent code—just let me know! Sources: Voice AI quickstart | LiveKit Docs | Voice AI quickstart | LiveKit Docs | Noise & echo cancellation | LiveKit Docs | livekit-rtc/livekit/rtc/_proto/audio_frame_pb2.pyi
n
How to setup AudioCaptureOptions and AudioSourceOptions?
t
I'd be happy to help you set up AudioCaptureOptions and AudioSourceOptions for noise suppression in LiveKit. Here’s a simple way to get started: • AudioCaptureOptions: This has a
noiseSuppression
boolean property that’s set to
true
by default. You can easily turn it on or off depending on what you need when connecting your client. • AudioSourceOptions: For the best audio experience, you can adjust these settings:Usually, it’s a good idea to keep these options enabled to maintain clear audio. ◦ `noiseSuppression`: Switch WebRTC-based noise suppression on or off. ◦ `echoCancellation`: Choose whether to enable echo cancellation. ◦ `autoGainControl`: Decide if you want automatic gain control enabled. If you'd like, I can provide some specific code examples or help you further with this—just let me know! Sources: src/room/track/options.ts | Noise & echo cancellation | LiveKit Docs
n
Please provide some examples.
t
Here are some helpful examples for setting up AudioCaptureOptions and AudioSourceOptions across different LiveKit SDKs. I hope these make things a bit clearer for you! JavaScript SDK: AudioCaptureOptions
Copy code
import { createLocalAudioTrack } from 'livekit-client';

// Enable noise suppression (this is usually the default)
const audioTrack = await createLocalAudioTrack({
  noiseSuppression: true,  // typically true by default
  echoCancellation: true,
  autoGainControl: true,
});

// Or if you'd like to disable noise suppression
const noisyTrack = await createLocalAudioTrack({
  noiseSuppression: false,
});
You can also include these options when connecting to a room:
Copy code
room.connect('wss://your-livekit-url', token, {
  audioCaptureOptions: {
    noiseSuppression: true,
    echoCancellation: true,
  },
});
Flutter SDK: AudioCaptureOptions
Copy code
final options = AudioCaptureOptions(
  noiseSuppression: true,
  echoCancellation: true,
  autoGainControl: true,
);

final localAudioTrack = LocalAudioTrack(options: options);
Native SDKs (Rust, Node.js, Python): AudioSourceOptions Rust example:
Copy code
let options = AudioSourceOptions {
    noise_suppression: true,
    echo_cancellation: true,
    auto_gain_control: true,
};
Node.js example:
Copy code
const options = new AudioSourceOptions({
  noiseSuppression: true,
  echoCancellation: true,
  autoGainControl: true,
});
Python example:
Copy code
from livekit.rtc import AudioSourceOptions

options = AudioSourceOptions(
    noise_suppression=True,
    echo_cancellation=True,
    auto_gain_control=True,
)
If you have any questions or need examples for a specific platform, please don’t hesitate to ask — I’m here to help! Sources: Enhanced noise cancellation | LiveKit Docs | Client SDKs | livekit/livekit_composite | DeepWiki | src/room/track/options.ts | lib/src/track/options.dart | webrtc-sys/src/audio_track.cpp
n
How to setup this for SIP connections?
t
I'm happy to help you set up noise suppression for SIP connections in LiveKit! You can easily enable Krisp noise cancellation by using the
krispEnabled
option when you're configuring your SIP trunks or participants: For Inbound Calls:
Copy code
await client.createSIPInboundTrunk({
  allowedAddresses: ['192.0.2.0'],
  krispEnabled: true, // Enable noise cancellation
});
For Outbound Calls:
Copy code
await client.createSIPParticipant({
  fromNumber: '+1234567890',
  toNumber: '+0987654321',
  krispEnabled: true, // Enable noise suppression
});
Note: The
AudioSourceOptions
is specifically for WebRTC tracks and doesn’t apply to SIP connections. For SIP, the audio processing happens server-side through Krisp integration, which offers excellent noise and voice cancellation. If you have any questions or need more examples, please feel free to ask—I’m here to help! Sources: packages/livekit-server-sdk/src/SipClient.ts | SIP overview | LiveKit Docs
n
How to setup Krisp for SIP connections in self-hosted?
t
Hi there! I wanted to let you know that Krisp noise cancellation is currently available only in LiveKit Cloud and isn't supported in self-hosted LiveKit setups. This also applies to SIP connections, where you can enable Krisp in the cloud environment by setting the
krispEnabled
flag in your trunk or participant configurations. If you're working with a self-hosted setup and need advanced noise cancellation, you might want to consider third-party solutions or look into custom noise suppression options outside of LiveKit's built-in features. I'm here to help, so please feel free to reach out if you'd like some guidance on alternative approaches or if you have any other questions! Sources: krisp-minimal/README.md | livekit-protocol/livekit/protocol/analytics.pyi | livekit/livekit_analytics.pb.go | SIP overview | LiveKit Docs | README.md
n
Please show me alternative approaches
t
For self-hosted LiveKit setups, including SIP connections, I’d love to share some alternative approaches to noise cancellation that might help you out: 1. WebRTC Built-in Noise Suppression: LiveKit takes advantage of WebRTC’s native audio processing features, like
noiseSuppression
and
echoCancellation
. These are turned on by default for client-side tracks and you can easily tweak them using
AudioCaptureOptions
in the SDKs. For instance, in JavaScript:
Copy code
room.localParticipant.setMicrophoneTrackSettings({
  noiseSuppression: true,
  echoCancellation: true
});
This is a simple, local solution that doesn’t require extra libraries and works right out of the box. While it might not be as powerful as AI-based models like Krisp, it’s still a solid option to consider. 2. Custom Audio Processing in Native SDKs: If you’re looking for something more advanced, you can explore custom noise cancellation through LiveKit’s native SDKs. For example, in the Rust SDK, you can use the
AudioProcessingModule
from
libwebrtc
to enable noise suppression, echo cancellation, and auto gain control right at the audio capture stage:
Copy code
let options = AudioSourceOptions {
    noise_suppression: true,
    echo_cancellation: true,
    auto_gain_control: true,
};
This method opens the door to integrating third-party noise suppression libraries or even your own AI models. Just a heads-up though, it does require some advanced audio engineering skills and unfortunately isn’t applicable for SIP connections. Limitations for SIP Connections: When it comes to SIP-based calls, Krisp remains the only officially supported noise cancellation option. You can enable it using the
krisp_enabled: true
flag here: •
CreateSIPParticipant
API (for outbound calls) • Inbound trunk configuration (for inbound calls) Currently, there’s no way to turn on WebRTC noise suppression on SIP media paths or to plug in other AI noise filters for SIP calls. If you’d like, I’m here to help walk you through implementing these options or brainstorming custom solutions that fit your needs. Just let me know! Sources: Noise & echo cancellation | LiveKit Docs | examples/local_audio/src/main.rs | SIP overview | LiveKit Docs | SIP APIs | LiveKit Docs | Enhanced noise cancellation | LiveKit Docs