在iPhone上录制"Apple无损"音频

Ste*_*fan 2 iphone audio mp4 core-audio

你能指点一下docs/snippets/blogs,它解释了如何在iPhone上录制Apple无损音频文件吗?

我已经从Apple开发中心检查了录音机示例,但无法弄清楚,我用于无损音频的设置.

问候,

斯特凡

slf*_*slf 6

iPhone OS支持使用多种不同的压缩音频编码格式录制.caf文件:

Apple Lossless - kAudioFormatAppleLossless

iLBC(互联网低比特率编解码器) - kAudioFormatiLBC

IMA/ADPCM(又名IMA4) - kAudioFormatAppleIMA4

μLaw - kAudioFormatULaw

aLaw - kAudioFormatALaw

- (id) initWithURL: fileURL {
    NSLog (@"initializing a recorder object.");
    self = [super init];

    if (self != nil) {

        // define the audio stream basic description for the file to record into

        // record audio at the current hardware sample rate
        // make sure the audio session is active before asking for properties
        UInt32 propertySize = sizeof(audioFormat.mSampleRate);
        AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareSampleRate,
                                &propertySize,
                                &audioFormat.mSampleRate);

        audioFormat.mFormatID           = kAudioFormatAppleIMA4; // record using IMA4 codec
        audioFormat.mChannelsPerFrame   = 1;

        AudioQueueNewInput(&audioFormat, ... );

        ...

    }

    return self;
}
Run Code Online (Sandbox Code Playgroud)

您肯定希望阅读" 音频队列服务编程指南"