Re: adapting "Playing Audio"
Re: adapting "Playing Audio"
- Subject: Re: adapting "Playing Audio"
- From: Brian Willoughby <email@hidden>
- Date: Sun, 13 Jan 2008 15:30:41 -0800
Very true. However you pick your scaling factor, you should use the
same scale for all samples (and not one scale for positive and
another for negative, even though you might see such a mistake in
sample code). If you vary the scale according to the sample value,
then you will create correlated distortion.
The key thing to remember is that testing for clipped samples really
depends upon your source material and your goals. If you're
examining sampled data that hasn't been altered, you might find
legals values of -1.0 without worrying, but +1.0 should be
impossible. If you're generating sine waves algorithmically, you
need to scale such that it is always < +1.0 and never equal to +1.0.
In any event, you don't really need to check this if all you're going
to do is manually clip, because the driver will clip for you. But if
you're picking a scaling factor on the fly, you might need to be
aware of the details. On the one hand, you shouldn't scale down a
sampled signal just because it hits -1.0, but you probably won't be
able to generate a sine wave that hits -1.0 because then it would
also hit the illegal +1.0 value. Different expectations for
different sources.
Brian Willoughby
Sound Consulting
On Jan 13, 2008, at 15:14, B.J. Buchalter wrote:
On Jan 13, 2008, at 6:09 PM, Brian Willoughby wrote:
Or, more precisely, the driver will clip the audio to -1.0 <= x < 1.0
Depending upon your algorithm, it may be important to note that
-1.0 is legal and valid, but +1.0 is not. The sample value must
be one fixed point unit less than +1.0 in two's complement.
Right -- but it will clip it to the maximum fixed point value.
You should not be doing anything to account for that asymmetry in
your fixed <-> float <-> fixed code, as handling the positive and
negative sides asymmetrically will introduce distortion.
_______________________________________________
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