I know there is an old issue on this error that was closed here. It was supposed to be fixed in latest release. I am using AudioKit 4.9.5 from cocoa pods, however, the crash is happening for me on simulator still. How can I resolve this?
2020-04-16 09:44:22.966253+0700 Nika[11082:133193] [avae] AVAEInternal.h:76 required condition is false: [AVAudioIONodeImpl.mm:1093:SetOutputFormat: (format.sampleRate == hwFormat.sampleRate)]
2020-04-16 09:44:22.994143+0700 Nika[11082:133193] *** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: format.sampleRate == hwFormat.sampleRate'
edit
This also happens if I build and run the MicrophoneAnalysis example project.
Is this problem happening in the simulator, on the Mac, or on a device, and which device? Closing until more info, thanks.
We're seeing this quite often on iOS in our app. We've seen it on all kinds of devices, from iPhone 6 to 11 (and some iPads). Usually it happens when the inputNode.inputFormat sample rate does not match the outputNode.outputFormat sample rate.
I noticed that this was reproducible by being on a Facetime call, but we've added call detection and it still happens for some users.
Here are some samples from our logs right before the app crashes with required condition is false: format.sampleRate == hwFormat.sampleRate:
AKSettings.sampleRate: 16000.0
AVAudioSession.sharedInstance().sampleRate: 16000.0
AudioKit.engine.inputNode.inputFormat(forBus: 0).sampleRate: 24000.0
AudioKit.engine.inputNode.inputFormat(forBus: 0).channelCount: 1
AudioKit.engine.outputNode.outputFormat(forBus: 0).sampleRate: 16000.0
AudioKit.engine.outputNode.outputFormat(forBus: 0).channelCount: 1
AKSettings.sampleRate: 48000.0
AVAudioSession.sharedInstance().sampleRate: 48000.0
AudioKit.engine.inputNode.inputFormat(forBus: 0).sampleRate: 24000.0
AudioKit.engine.inputNode.inputFormat(forBus: 0).channelCount: 1
AudioKit.engine.outputNode.outputFormat(forBus: 0).sampleRate: 48000.0
AudioKit.engine.outputNode.outputFormat(forBus: 0).channelCount: 2
AKSettings.sampleRate: 48000.0
AVAudioSession.sharedInstance().sampleRate: 48000.0
AudioKit.engine.inputNode.inputFormat(forBus: 0).sampleRate: 0.0
AudioKit.engine.inputNode.inputFormat(forBus: 0).channelCount: 0
AudioKit.engine.outputNode.outputFormat(forBus: 0).sampleRate: 0.0
AudioKit.engine.outputNode.outputFormat(forBus: 0).channelCount: 0
AKSettings.sampleRate: 48000.0
AVAudioSession.sharedInstance().sampleRate: 48000.0
AudioKit.engine.inputNode.inputFormat(forBus: 0).sampleRate: 0.0
AudioKit.engine.inputNode.inputFormat(forBus: 0).channelCount: 2
AudioKit.engine.outputNode.outputFormat(forBus: 0).sampleRate: 48000.0
AudioKit.engine.outputNode.outputFormat(forBus: 0).channelCount: 2
Our working theory is that this might be caused by some unusual headsets or external mics, but we haven't been able to verify that yet.
@aure not sure if you missed this, but I've added more info to this issue above. I'm also happy to provide more details if I can be of any help in tracking this issue down.
Sorry, very busy these days.
Same problem here in the simulator.
Audiokit 4.9.5
Swift 5.2.4
XCode 11.5
Macbook Pro 13 2020
Exception: "required condition is false: format.sampleRate == hwFormat.sampleRate"
---EDIT---
Now that's weird. It works when compiling the app with Swift 4.2
Now that's weird. It works when compiling the app with Swift 4.2
Are you sure that's the variable, not confounded by any changes in your audio setup such as a Bluetooth device being connected?
I haven't changed anything. Bluetooth was off all the time.
Bought a new Macbook, installed Xcode, opened my Xcode project, updated AudioKit via Cocoapods. Compiled. Crashed. Changed Swift from 5 to 4.2. Compiled.
But I will try again later.
Oh wait. You're right, that's not it. I just tried again with Swift 5 and it worked.
The only difference might be that I eventually had my monitors connected to the jack output.
Thanks. I'm still confused though. Will keep on investigating.
I am seeing this intermittently on the simulator for iPhoneSE. I'm on Catalina
I'm seeing this problem whenever I attempt to run theLoopbackRecording, iOS Recorder or MicrophoneAnalysis iOS examples in simulator for iPhone 11 and for multiple other simulation targets. I have not yet found a simulation target where this problem is not present for all three demonstration apps.
I'm using AudioKit 4.10.1, with code downloaded from github, then built using build_frameworks.sh
Full error info reads:
_2020-08-15 10:32:04.358551+1000 MicrophoneAnalysis[30199:329606] [avae] AVAEInternal.h:76 required condition is false: [AVAudioIONodeImpl.mm:1093:SetOutputFormat: (format.sampleRate == hwFormat.sampleRate)]
2020-08-15 10:32:04.364208+1000 MicrophoneAnalysis[30199:329606] *** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: format.sampleRate == hwFormat.sampleRate'_
Am running Catalina 10.15.6, xCode 11.6
I can consistently reproduce this issue by instantiating a microphone using AKMicrophone() while:
The call has to be active before instantiating the microphone otherwise everything works as expected. I'm trying to catch the exception that's raised by CoreAudio and will report back if I have any luck. Hope this helps.
possibly related to #1767
This should be a thing of the past shortly, but it will require an update to v5 of AudioKit, which is not quite ready yet, but getting there, stay tuned.
Most helpful comment
I can consistently reproduce this issue by instantiating a microphone using
AKMicrophone()while:The call has to be active before instantiating the microphone otherwise everything works as expected. I'm trying to catch the exception that's raised by CoreAudio and will report back if I have any luck. Hope this helps.