sbooth / SFBAudioEngine

A powerhouse of audio functionality for macOS, iOS, and tvOS
https://sbooth.github.io/SFBAudioEngine/
MIT License
569 stars 86 forks source link

Unable to convert some audio formats #271

Closed tryWabbit closed 1 year ago

tryWabbit commented 1 year ago

Thank you for creating this beautiful library, It is really helpful for other developers.

I'm trying to convert an m4a file to some formats and but it is throwing me an error:-

Code I'm using:-

let inputURL = audioUrl!
let outputURL = URL(fileURLWithPath: NSTemporaryDirectory() + "trimmed.aifc")
print(inputURL)
print(outputURL)
if FileManager.default.fileExists(atPath: outputURL.path) {
    try? FileManager.default.removeItem(atPath: outputURL.path)
}
do {
    try AudioConverter.convert(inputURL, to: outputURL)
} catch let error {
    print(error)
}

When I try to convert .m4a to .aifc I get

2023-10-07 17:27:42.978255+0530 RPTools[45431:2069254] [AMCP]  91395          HALC_ProxyIOContext.cpp:1329  HALC_ProxyIOContext::IOWorkLoop: skipping cycle due to overload
2023-10-07 17:27:42.987289+0530 RPTools[45431:2068879] [AudioEncoder] SFBAudioEncodingSettingsKeyCoreAudioFileTypeID is not set: guessed 'AIFC' based on extension "aifc"
2023-10-07 17:27:42.987459+0530 RPTools[45431:2068879] [AudioEncoder] SFBAudioEncodingSettingsKeyCoreAudioFormatID is not set: guessed 'lpcm' based on format 'AIFC'
2023-10-07 17:27:42.987533+0530 RPTools[45431:2068879] [AudioEncoder] SFBAudioEncodingSettingsKeyCoreAudioFormatFlags is not set; mFormatFlags will be zero which is probably incorrect
2023-10-07 17:27:42.987619+0530 RPTools[45431:2068879] [AudioEncoder] SFBAudioEncodingSettingsKeyCoreAudioBitsPerChannel is not set; mBitsPerChannel will be zero which is probably incorrect
2023-10-07 17:27:42.987676+0530 RPTools[45431:2068879] [AudioEncoder] AudioFileOpenWithCallbacks failed: 1718449215 'fmt?'
Error Domain=NSOSStatusErrorDomain Code=1718449215 "(null)"
2023-10-07 17:27:49.140740+0530 RPTools[45431:2069254] [AMCP]  91395          HALC_ProxyIOContext.cpp:1329  HALC_ProxyIOContext::IOWorkLoop: skipping cycle due to overload

Same error I get with ac3 and eac3.

Any help will be truly appreciated.