Hi,
I'm creating an audio file using several file options. When creating an aac file I get random "knocks" and skips in the audio while when creating a caf from the same audio data the audio file is generated ok.
To create aac I use: CAStreamBasicDescription dstFormat; dstFormat.mSampleRate = kSampleRate; dstFormat.mFormatID = kAudioFormatMPEG4AAC; dstFormat.mChannelsPerFrame = 2; UInt32 size = sizeof(dstFormat); AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, 0, NULL, &size, &dstFormat);
To create caf I use: CAStreamBasicDescription dstFormat; dstFormat.mSampleRate = kSampleRate; dstFormat.mFormatID = kAudioFormatLinearPCM ; dstFormat.mChannelsPerFrame = 2; dstFormat.mBitsPerChannel = 16; dstFormat.mBytesPerPacket = dstFormat.mBytesPerFrame = 2 * dstFormat.mChannelsPerFrame; dstFormat.mFramesPerPacket = 1; dstFormat.mFormatFlags = kLinearPCMFormatFlagIsPacked | kLinearPCMFormatFlagIsSignedInteger; // little-endian
I open the file using: OSStatus result = ExtAudioFileCreateWithURL((CFURLRef) [NSURL fileURLWithPath:file], type, &dstFormat, 0, kAudioFileFlags_EraseFile, &audioFileRef);
And write to it using ExtAudioFileWrite(). My audio is normalized so it peaks at 0.0dB.
Are there any limitations on the hardware AAC encoder that will cause it to create knocks or stop rendering? I'm suspecting the AAC encoding cause when not encoding (caf) the audio file turns out fine.
Thanks. Guy |