Android
This guide covers iOS AVAudioSession only. On Android, configure AudioRecord / Oboe at 48 kHz mono and call processFrame from a background thread.
Audio Session Troubleshooting
Real-Time Pipeline Is Silentโ
Symptoms: engine.start() succeeds but no audio comes through the tap.
Checklist:
-
Microphone permission โ confirm
AVAudioSession.recordPermission == .granted -
Audio session activated โ call
AVAudioSession.sharedInstance().setActive(true)beforeengine.start() -
Correct format in installTap โ the format passed to
installTapmust match theAVAudioInputNode's output format:Swiftlet inputFormat = engine.inputNode.outputFormat(forBus: 0)
// If inputFormat.sampleRate != 48000, use AVAudioMixerNode to resample -
installTap before start โ
installTapmust be called beforeengine.start()
AVAudioSession Activation Failedโ
Swift
let session = AVAudioSession.sharedInstance()
try session.setCategory(.playAndRecord, options: [.mixWithOthers, .allowBluetooth])
try session.setActive(false, options: .notifyOthersOnDeactivation)
try session.setActive(true)