Re: Canonical format max amp limits?
Re: Canonical format max amp limits?
- Subject: Re: Canonical format max amp limits?
- From: James Chandler Jr <email@hidden>
- Date: Tue, 13 Jul 2004 23:13:55 -0400
On Tuesday, July 13, 2004, at 10:06 PM, "" <email@hidden> wrote:
Thanks Bill and Brian for the confirmation on the range.
Now, just to make sure..Is this something so obvious that doesn't need
to
accompany a description of the format (except for dummos like me?) Or
has this
question popped up here before and I was just wasting your time?. Or
still, is
it written somewhere and I missed it?
Please forgive me for insisting in this point. I don't mean to upset
anyone with
trivialities. I just want to make sure I look in the right
docs/headers for
info next time.
Hi
There is no such thing as a dumb question.
Dunno where the Apple spec is defined, but the float range of {-1.0 <=
SampleValue < 1.0}, is the standard numeric range used in most floating
point audio DSP programming (regardless of computer platform).
Since this is such a common numeric range for floating point audio DSP,
perhaps documentation writers sometimes forget that this isn't
necessarily universal knowledge. The topic is discussed in most Audio
DSP programming books.
CoreAudio offers format converters optimized to quickly convert this
standard numeric range to 16 bit PCM, 24 bit PCM, or whatever. In
CoreAudio you may not have to concern yourself with the nuts'n'bolts of
writing code converting to/from other sample formats.
Other platform audio API's don't necessarily have this luxury, and it
is common to have to roll yer own conversions.
An example-- To 'manually' convert 16 bit -> float -> 16bit--
double Mul16Bit = 1.0 / 32768.0;
float FloatSample = IntSample * Mul16Bit;
//multiply is usually faster than divide
short IntSample = FloatSample * 32768.0;
You typically must guard against 'wraparound', if it can ever happen
that FloatSample exceeds the normal audio float range.
If your audio processing causes the float numbers to exceed the
standard range, it sounds much better to clip rather than wrap around.
It can be a bit of work to write efficient tight loops to do such
conversions, so it is nice that CoreAudio provides optimized format
conversions.
JCJR
_______________________________________________
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.