I have met this problem with iOS 13.1.2 and AudioKit 4.9. Testing with iPhone XS.
I'm trying to render clip recorder result using this code:
func preRender() {
var scheduleTime : TimeInterval = 2
let dspTime = AVAudioTime(sampleTime: AVAudioFramePosition(scheduleTime * AKSettings.sampleRate), atRate: AKSettings.sampleRate)
if !clipsOnly {
self.musicPlayer.play(at: dspTime)
scheduleTime += 2
}
self.clipPlayer.play(at: dspTime)
}
let writeFile = try AKAudioFile()
try AudioKit.renderToFile(writeFile, duration: duration + 2.0,
prerender: preRender)
Expected result is rendered audio file. Code above works well in simulator with iOS 13.1.2 and also on a device with iOS 12.
Actual result is:
[avae] AVAEInternal.h:109 [AVAudioEngineGraph.mm:1397:Initialize: (err = AUGraphParser::InitializeActiveNodesInInputChain(ThisGraph, *GetInputNode())): error -10868
I have the same issue on my AVAudioEngine
setup code.
If you check this error code -10868
on OSStatus page
you will find the error description to be kAudioUnitErr_FormatNotSupported
.
This means that some deeper audio setup code fails because an audio format is used which is not supported.
It is important to know which audio format is being used when dealing with raw audio data. Two different audio samples can't just get combined/mixed if their audio format is not equal. Audio conversion is required.
I know for sure that something inside Apple's code has changed. Some audio formats are not allowed anymore. The AVAudioEngine
and AVAudioNode's
accept different formats for different iOS versions:
iOS 12 works.
iOS 13.1.2. (in your case) doesn't work.
iOS 13.3.1. (in my case) doesn't work.
iOS 13.4. (in my case) works (for some similar but other audio bug).
The underlying code has changed in so far that my code under iOS 13.4. works, while under iOS 13.3.1. produces sound artifacts making audio callback unusable.
I am working on a solution to this particular audio format mismatch bug. In your case, I would advise you to test the same code under iOS 13.4.
You won't be able to solve the problem in your code because it is somewhere in AudioKit
. AudioKit
needs to address the changes Apple made to its underlying audio code. When I repair my issue I will post the solution and contact them on their GitHub issue tracker.
It might be the same issue.