I think you should be using SInt16 rather than
AudioUnitSampleType. Also, although it doesn't matter if you only ever run
on Intel, omit kAudioFormatFlagsNativeEndian.
Little-endian is the default and that's what you want here.
Something to get your head around if you are using
Extended Audio File Services is that there are two data formats you need to
specify. One is the format of the file you want to create, and that (I
assume) is what we're discussing here. The other is the 'client
data format' which specifies the format of samples you pass to
ExtAudioFileWrite. This, within reason, can be anything you like.
They can of course be the same, and from you're previous post that's probably
what you want, but the nice thing is that they don't have to be.
HTH.
Regards,
Paul Sanders.
----- Original Message -----
Sent: Friday, July 09, 2010 9:16 PM
Subject: Re: What is the AudioStreamBasicDescription(asbd) for a wav
file
I used
anASBD.mSampleRate =
44100.0;
anASBD.mFormatID =
kAudioFormatLinearPCM;
anASBD.mFormatFlags =
kAudioFormatFlagsAudioUnitCanonical;
anASBD.mBytesPerPacket =
sizeof(AudioUnitSampleType)*2;
anASBD.mFramesPerPacket =
1;
anASBD.mBytesPerFrame =
sizeof(AudioUnitSampleType)*2;
anASBD.mChannelsPerFrame =
2;
anASBD.mBitsPerChannel =
8 * sizeof(AudioUnitSampleType);
anASBD.mReserved =
0;
anASBD.mFormatFlags =
kAudioFormatFlagIsSignedInteger |
kAudioFormatFlagsNativeEndian |
kAudioFormatFlagIsPacked;
and it is creating a wav file.I can also
see the size of the file is 5 MB.But I am unable to play.
I dont want to use some other framework
unless i have no other option.
Regards,
Nambiar
|