'Audio Engine: Rare Unsupported Format Error
I am experiencing a rare issue with AVAudioEngine, which I am using for speech recognition. While trying to start the audio engine, it immediately throws this error:
[ALERT ❌]::[14:26:25.2970]::The operation couldn’t be completed. (com.apple.coreaudio.avfaudio error -10868.)
An error code of -10868 translates to kAudioUnitErr_FormatNotSupported apart of the AudioToolbox library.
private var mixerNode: AVAudioMixerNode = AVAudioMixerNode()
audioEngine.attach(mixerNode)
audioEngine.connect(audioEngine.inputNode, to: mixerNode, format: nil)
let format = audioEngine.inputNode.outputFormat(forBus: 0)
mixerNode.installTap(
onBus: 0,
bufferSize: 1024,
format: format
) { (buffer, _) in
self.recognitionRequest?.append(buffer)
}
do {
audioEngine.prepare()
try audioEngine.start()
} catch {
mixerNode.removeTap(onBus: 0)
Log.error(error.localizedDescription)
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
