iOS Audio Format Conversion Tool Gallery: Extaudioconverter

Source: Internet
Author: User

The work of the previous time, and the audio related to iOS, need a function: Convert audio from WAV format to MP3 format. This demand is not very strong, but it is not very good to achieve.

So I wrote an open source library for audio format conversion, which contains all the audio formats supported by Ios/os X, and also supports the MP3 format (implemented with lame). It is modeled on the parameters of the command on OS X afconvert and will be more widely used in the future than Afconvert.

Open Source Library named Extaudioconverter, based on extaudiofile implementation. Link here: Https://github.com/lixing123/ExtAudioConverter

How to use:

    1. Add "Audiotoolbox.framework" to the project;
    2. Add "ExtAudioConverter.h" and "EXTAUDIOCONVERTER.M" to the project;
    3. Test:
        ExtAudioConverter* converter = [[ExtAudioConverter alloc] init];        converter.inputFile =  @"/your/input/file";        converter.outputFile = @"/your/output/file";        [converter convert];

The code is tested on iOS and OS X.

Some optional parameters:
1. Sample Rate

converter.outputSampleRate = 44100;
    1. Number of channels
converter.outputNumberChannels = 2;
    1. Bit depth
converter.outputBitDepth = BitDepth_16;
    1. Set file format
converter.outputFileType = kAudioFileWAVEType;
    1. Set data format
converter.outputFormatID = kAudioFormatLinearPCM;

Documentation on file format and data format, here: https://developer.apple.com/library/ios/documentation/MusicAudio/Conceptual/ Coreaudiooverview/supportedaudioformatsmacosx/supportedaudioformatsmacosx.html

In short, a file format corresponds to one or more data formats, such as MP3 file formats that correspond to MP3 data FORMAT,CAF (Core Audio format) for almost all data format. Therefore, the default output file format of the ToolPak is the CAF format.

There is no setup interface for bit rate at this time. The following will be added as needed.

If you need a classmate, you can download it. If you have questions and suggestions, please
1. Contact me for comments under this article;
2. Send issues to the project below;
3. e-mail to my email:[email protected]

With a GitHub account, a star/follow can encourage me to continue to contribute to the open source community, thank you!

iOS Audio Format Conversion Tool Gallery: Extaudioconverter

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.