AudioKit: RecorderDemo example error: exportAsynchronously(ios)

Hello, I run the original example of RecorderDemo and It compiles with only one error for exportAsynchronously:

Export Failed Optional(Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedFailureReason=An unknown error occurred (-12936), NSLocalizedDescription=The operation could not be completed, NSURL=/Users/miguelsaldana/Library/Developer/CoreSimulator/Devices/79E361A8-8DA9-4E2B-8264-0ED34E1EFCB7/data/Containers/Data/Application/BD8F35B0-2A75-4046-95CC-BF30709C52D3/tmp/DBAE1838-D059-422D-B66B-23454350F109.caf, NSUnderlyingError=0x60000024ebe0 {Error Domain=NSOSStatusErrorDomain Code=-12936 "(null)"}})

anyone got a solution? It does work with .wav to m4a but I want to convert .caf to .m4a 😃 Thank you

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 18 (12 by maintainers)

Most upvoted comments

I don’t have a solution, but thanks for making the issue. Will keep it open until it can be addressed.

I had the same issue as @masaldana2 above. Typical non-helpful error message from AVFoundation, specifically the -12936 code.

His solution is correct also. Line 390 of AKAudioFile+ProcessingAsynchronously.swift:

internalExportSession.outputURL = URL(fileURLWithPath: filePath)

should probably be replaced with

internalExportSession.outputURL = NSURL(fileURLWithPath: filePath) as URL

This issue is reproducible In the Recorder demo. This export call below will generate the error with -12396 code:

player?.audioFile.exportAsynchronously(name: "TempTestFile.m4a", baseDir: .documents, exportFormat: .m4a) {_, error in if error != nil { print("Export Failed \(error)") } else { print("Export succeeded") }

This can be fixed without modifying the AudioKit code directly by calling the function @masaldana2 designed above. See attached file.

convertAudioToM4A.txt