Audio data in float format for iOS?
Audio data in float format for iOS?
- Subject: Audio data in float format for iOS?
- From: Steve gfx <email@hidden>
- Date: Mon, 17 Jan 2011 12:28:51 +0000
Hi
For efficiency reasons to suit some existing DSP algorithms I would like to use a 32-bit float format for the audio data in Core Audio on iOS.
I'm not even sure this is possible after reading this:
"On iOS the AudioSampleType is 16-bit integer. The AudioUnitSampleType is an 8.24-bit fixed-point number with 8 bits to the left of the radix point and 24 bits to the right"
And indeed when I try to specify the following AudioStreamBasicDescription, I get a kAudioUnitErr_FormatNotSupported error.
asbd.mSampleRate = 44100.0;
asbd.mFormatID = kAudioFormatLinearPCM;
asbd.mFormatFlags = kAudioFormatFlagIsFloat | kAudioFormatFlagIsPacked;
asbd.mFramesPerPacket = 1;
asbd.mChannelsPerFrame = 2;
asbd.mBitsPerChannel = 32;
asbd.mBytesPerPacket =8;
asbd.mBytesPerFrame = 8;
Ideally the pipeline would be something like this:
1)Load some audio data as 32-bit floats (2-ch stereo) in to buffers.
2) Keep it in this format so that in the mixer and master callbacks no conversion is necessary to perform per-channel, or global DSP.
3) Finally convert it to whatever necessary for output.
After loading AIFFs or WAVs at startup, they can be converted to any format as they are only short samples and speed is not an issue at this point.
Can anyone offer some advice on the most efficient formatting to minimise the amount of conversions during the time-critical callbacks.
At the moment I'm having to do SInt-> float and back again, in both the mixer and master callbacks.
Thanks
Steve
_______________________________________________
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