The CoreAudioConverter framework provides facilities for converting various audio file formats to MPEG Audio Layer III, more commonly referred to as MP3.
- Audio Interchange File Format (AIFF)
- Apple Lossless Audio Codec (ALAC)
- Advanced Audio Coding (ACC)
- macOS 10.10+
- Xcode 10.1+
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate CoreAudioConverter into your Xcode project using Carthage, specify it in your Cartfile
:
github "Phisto/CoreAudioConverter" ~> 1.0
If you prefer not to use Carthage, you can integrate CoreAudioConverter into your project manually. You only need to build and add the CoreAudioConverter framework (CoreAudioConverter.framework) to your project.
// create the encoder task
NSURL *fileURL = <#...#>
NSURL *outFileUrl = <#...#>
EncoderTask *task = [EncoderTask taskWithInputURL:fileURL
outputURL:outFileUrl
temporaryURL:nil];
// create the encoder
MP3Encoder *mp3Encoder = [[MP3Encoder alloc] initWithDelegate:self];
if (!mp3Encoder) {
<#// handle failure...#>
}
NSError *encodingError = nil;
BOOL erfolg = [mp3Encoder executeTask:task error:&encodingError];
if (!erfolg) {
<#// handle failure...#>
}
The CoreAudioConverter framework is using LAME to encode files to MP3. LAME is a high quality MPEG Audio Layer III encoder licensed under the GNU Lesser General Public License (LGPL).
The CoreAudioConverter framework is using the AudioFileTagger framework to tag the encoded MP3 files with ID3v2 tags. AudioFileTagger is released under the GNU Lesser General Public License (LGPL).
I learned a lot by browsing trough the code repository for the brilliant macOS application Max.
CoreAudioConverter is released under the GNU Lesser General Public License (LGPL).