You are not closing the file.
The WAV file has a data chunk size of zero. The CAF file has a data chunk size of -1. These are definite indicators that the files were not closed. CAF is meant to be resilient to crashing while recording. A -1 data chunk size means the data chunk extends to the end of the file. So a CAF file is still valid even if its data chunk is not updated at closing time to reflect the actual size. WAV files are not legal if the data chunk size is not updated.
On Oct 29, 2009, at 9:51 AM, Zhiye (Sterling) Li wrote: Sorry I accidentally sent the last email while I didn't finish yet.
so, the recording part of the code is like:
audioFormat.mSampleRate = 44100.0; audioFormat.mFormatID = kAudioFormatLinearPCM;
audioFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked; audioFormat.mBytesPerPacket = 2; audioFormat.mFramesPerPacket = 1; audioFormat.mBytesPerFrame = 2;
audioFormat.mChannelsPerFrame = 1; audioFormat.mBitsPerChannel = 16;
status = AudioFileCreateWithURL(fileURL, kAudioFileWAVEType, &audioFormat, kAudioFileFlags_EraseFile, &audioFileID);
status = ExtAudioFileWrapAudioFileID(audioFileID, YES, &audiofile); ExtAudioFileSetProperty(audiofile,kExtAudioFileProperty_ClientDataFormat,sizeof(audioFormat),&audioFormat); status = ExtAudioFileWriteAsync(audiofile, 0,NULL);
And in the recording callback:
status = ExtAudioFileWriteAsync(THIS.audiofile,inNumberFrames,THIS.bufferList);
Since "status" doesn't return error anywhere, I cannot find where is wrong, but the recorded .wav file cannot even be opened by iTunes...
Zhiye
On Thu, Oct 29, 2009 at 2:32 AM, Seth Delackner <email@hidden> wrote:
How are you writing your data to the file? AudioFileWritePackets
works fine for me. Not sure about the data format flags you are
using. You are trying to write mono it seems, but I've only tried
writing stereo output. Shouldn't be an issue I would think...
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
|