Re: skips in file using ExtAudioFileWrite in aac
Re: skips in file using ExtAudioFileWrite in aac
- Subject: Re: skips in file using ExtAudioFileWrite in aac
- From: Guy Shaviv <email@hidden>
- Date: Sat, 17 Jul 2010 08:06:37 +0300
On Jul 17, 2010, at 2:46 , Jonathan wrote:
> Are you normalizing on the fly?
Nope. I have a preflight stage, so I've seen the entire audio data before starting to render to the file.
>
> Try using ExtAudioFileWriteAsync() instead. I had problems even with
> ExtAudioFileWriteAsync (even though it says it buffers it internally)
> so I ended up writing outside of the main thread.
Tried ExtAudioFileWriteAsync, same results. I'm off the main thread already, running in a background thread which is why I was using ExtAudioFileWrite() to begin with.
I've tested my code on the simulator, and on the simulator the AAC file is created fine. So I'm more and more getting the feeling this is something with the hardware encoder on the ipad. Is there a way to request a software encoder on the ipad or are there any parameters to control the hardware encoder, like how do I set the bit-rate of the file? I only saw a way to specify the AAC encoding type (low-complexity/high-efficiency) but not bit rate?
My next step would be to try creating an isolated example that can be submitted as a bug report.
Guy
>
> On Fri, Jul 16, 2010 at 8:57 AM, Guy Shaviv <email@hidden> wrote:
>> 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
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Coreaudio-api mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden