Re: AudioConverter format not supported error
Re: AudioConverter format not supported error
- Subject: Re: AudioConverter format not supported error
- From: Philippe Wicker <email@hidden>
- Date: Wed, 13 Aug 2003 21:01:14 +0200
On Wednesday, August 13, 2003, at 08:05 PM, Robert Grant wrote:
>
I'm delving into the realm of AudioFiles and AudioConverters because
>
QuickTime's AIFF support stops short at 48000 Hz and 16 bits.
>
>
So I'm trying to build an AudioConverter that'll take a
>
non-interleaved 32 bit float stereo buffer and convert it into
>
interleaved 16 bit integer stereo.
>
>
Trouble is I'm getting a 'fmt?' error but I'm not sure which format is
>
causing trouble. Of course my ignorance is a major factor :-)
>
>
Here are the two ASBDs:
>
>
sampleRate = 44100; // I want to support various sample rates
>
bitDepth = 16; // I want to support 24 bits too.
>
>
The AIFF format:
>
AudioStreamBasicDescription inFormat;
>
inFormat.mSampleRate = sampleRate;
>
inFormat.mFormatID = kAudioFormatLinearPCM;
>
inFormat.mFormatFlags = kLinearPCMFormatFlagIsBigEndian;
Are you sure you want **unsigned** integer? The AIF files I have played
with recently were always "signed integer". Anyway, I had to add
"kLinearPCMFormatFlagIsSignedInteger" to make it work.
>
inFormat.mBytesPerPacket = 2 * (bitDepth / 8);
>
inFormat.mFramesPerPacket = 1;
>
inFormat.mBytesPerFrame = 2 * (bitDepth / 8);
>
inFormat.mChannelsPerFrame = 2;
>
inFormat.mBitsPerChannel = bitDepth;
>
>
The Float format:
>
AudioStreamBasicDescription rwFormat;
>
rwFormat.mSampleRate = sampleRate;
>
rwFormat.mFormatID = kAudioFormatLinearPCM;
>
rwFormat.mFormatFlags = kLinearPCMFormatFlagIsNonInterleaved |
>
kLinearPCMFormatFlagIsFloat;
You are requesting **little** endian float, if you add
"kAudioFormatFlagIsBigEndian" then there is no more error. Maybe that
little endian float is an illegal format for AIF files?
I have made a little C routine that prints the format flag in a
readable format. I don't know if such a utility is available somewhere
in the SDK. If not, I'd be glad to share it whit the list.
>
rwFormat.mBytesPerPacket = 4;
>
rwFormat.mFramesPerPacket = 1;
>
rwFormat.mBytesPerFrame = 4;
>
rwFormat.mChannelsPerFrame = 2;
>
rwFormat.mBitsPerChannel = 32;
>
>
>
Create a new audio converter with these formats gets me a 'fmt?' error.
>
>
Thanks,
>
>
Robert.
>
_______________________________________________
>
coreaudio-api mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
>
Do not post admin requests to the list. They will be ignored.
>
>
Philippe Wicker
email@hidden
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.