If I'm using the realtime models (say gpt-realtime...
# ask-ai
v
If I'm using the realtime models (say gpt-realtime) - then what is the best way to background noise filtering on the mobile client (give me code sample for flutter)
t
Thanks for reaching out, Ruchir. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It sounds like you’re using a realtime model (e.g., gpt-realtime) and want the best way to filter background noise on mobile in Flutter. • Best practice: apply noise/voice cancellation inbound in your agent so the model gets clean, raw audio. If you need background voice removal (not just noise), use Background Voice Cancellation (BVC) in the agent (Python/Node). Don’t enable frontend noise cancellation at the same time as agent-side cancellation. Docs, Agents + OpenAI • If you must filter on the client in Flutter: use the standard noise cancellation plugin (outbound only). Example:
Copy code
import 'package:livekit_client/livekit_client.dart';
import 'package:livekit_noise_filter/livekit_noise_filter.dart';

final liveKitNoiseFilter = LiveKitNoiseFilter();

final room = Room(
  roomOptions: RoomOptions(
    defaultAudioCaptureOptions: AudioCaptureOptions(
      processor: liveKitNoiseFilter,
    ),
  ),
);

await room.connect(url, token);
await room.localParticipant?.setMicrophoneEnabled(true);

// Toggle at runtime:
// liveKitNoiseFilter.setBypass(true);  // disable NC
// liveKitNoiseFilter.setBypass(false); // enable NC
Would you like a Python or Node agent example to enable BVC so your realtime model gets cleaner input? Sources: Enhanced noise cancellation | LiveKit docs | OpenAI and LiveKit | LiveKit Docs
v
I already have BVC enabled - so do I need to enable the client side noise filter?
t
It sounds like you already have BVC enabled in your agent. In that case, do not enable the client-side noise filter in Flutter. • Models expect raw audio; double-processing (frontend NC + agent BVC) can produce worse results. • Keep the frontend filter off and let the agent-side BVC handle cleanup end-to-end. If you want, I can share a quick checklist to verify BVC is active and the Flutter client isn’t applying NC.
v
yeah sure that'll be helpful
t
Here’s a quick checklist to confirm BVC-only audio flow (no client NC): Agent-side (BVC) • Ensure BVC is enabled in your agent pipeline (Python/Node) before forwarding audio to the model. • Verify logs/metrics show BVC initialized and running for the participant stream. • Confirm the agent receives full-band, unprocessed PCM from the client (no frontend DSP). Flutter client (disable NC) • Do not include or instantiate
livekit_noise_filter
in your app. • If the package is present, ensure you’re not setting
AudioCaptureOptions(processor: ...)
anywhere. • At runtime, confirm no calls to
setBypass(false)
on a
LiveKitNoiseFilter
instance (ideally, no instance at all). • If you previously enabled NC, explicitly disable/remove it and restart the app to clear state. Room/media settings • Use default capture without extra audio processing flags on the client. • Check that only the agent applies processing; no SFU/SIP-side NC is enabled for this path. Optional validation • Record a short baseline from the client mic and the agent’s post-BVC output; compare that the client track is raw and the agent track is cleaned. • Temporarily log RMS/voice activity before and after BVC to confirm suppression activates only in the agent. Want a quick code snippet to assert BVC is active in your agent logs?
v
got it thanks!