How can I turn off the default microphone audio ca...
# ask-ai
w
How can I turn off the default microphone audio capture and instead send my own microphone buffer to the agent? I want to manually collect the mic audio frames and forward them to the LiveKit client for agent processing.
t
To help you disable the default microphone audio capture and send a custom microphone buffer to the LiveKit client, the steps can vary depending on the platform you’re working with. Let’s walk through them together: For iOS/macOS (Swift SDK): • Start by enabling manual rendering mode with
AudioManager.shared.setManualRenderingMode(true)
. • Then, activate the microphone track using
room.localParticipant.setMicrophone(enabled: true)
. • Finally, you can send your custom audio buffers through
AudioManager.shared.mixer.capture(appAudio: yourAudioBuffer)
. For Android (Android SDK): • Create a
LocalAudioTrack
and set a custom audio buffer callback using
setAudioBufferCallback()
. • If you need more control, you might want to implement a custom
AudioDeviceModule
. For other platforms: • JavaScript SDK: Custom audio injection isn’t directly supported, but you might explore WebRTC-level options. • Flutter SDK: Support is somewhat limited, so platform-specific solutions could be necessary. • Rust SDK: Currently, there’s no direct support for injecting custom buffers. Please feel free to share which platform you’re targeting or if you’d like me to guide you through any specific part in more detail—I’m here to help! Sources: src/room/track/options.ts | lib/src/preconnect/pre_connect_audio_buffer.dart | examples/local_audio/README.md | Tests/LiveKitAudioTests/AudioEngineTests.swift | livekit-android-sdk/src/main/java/io/livekit/android/room/track/LocalAudioT...