IOS audio format conversion tool Library: ExtAudioConverter,

Source: Internet
Author: User

IOS audio format conversion tool Library: ExtAudioConverter,

Some time ago, it was related to iOS audio and needed a function: Converting audio from wav format to mp3 format. This requirement is not very strong, but it is not very easy to implement.

So I wrote an open-source audio format conversion library, which contains all the audio formats supported by iOS/OS X, and also supportsMp3 format(Implemented using lame ). It is modeled on OS XafconvertCommand parameter settings will be more extensive in the future than afconvert.

The open-source library named ExtAudioConverter is implemented based on ExtAudioFile. Link here: https://github.com/lixing123/ExtAudioConverter

How to use:

        ExtAudioConverter* converter = [[ExtAudioConverter alloc] init];        converter.inputFile =  @"/your/input/file";        converter.outputFile = @"/your/output/file";        [converter convert];

The Code passes the test on iOS and OS X.

Some optional parameters:
1. Sampling Rate

converter.outputSampleRate = 44100;
converter.outputNumberChannels = 2;
converter.outputBitDepth = BitDepth_16;
converter.outputFileType = kAudioFileWAVEType;
converter.outputFormatID = kAudioFormatLinearPCM;

For instructions on file formats and data formats, here: https://developer.apple.com/library/ios/documentation/MusicAudio/Conceptual/CoreAudioOverview/SupportedAudioFormatsMacOSX/SupportedAudioFormatsMacOSX.html

Simply put, a file format corresponds to one or more data formats. For example, mp3 file format only corresponds to mp3 data Format, and caf (Core Audio format) format corresponds to almost all data formats. Therefore, the default output file format of the tool library is the caf format.

There is no bit rate setting interface yet. Add as needed.

If you need it, you can download it. If you have any questions or suggestions
1. Contact me to comment in this article;
2. Send the Issues to the project;
3. mail to my mailbox: shangwangwanwan@gmail.com

If you have a github account, one Star/Follow encourages me to continue contributing to the open-source community. Thank you!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.