Re: Calculating peak level in db
Re: Calculating peak level in db
- Subject: Re: Calculating peak level in db
- From: Richard Dobson <email@hidden>
- Date: Tue, 15 Oct 2002 01:19:51 +0100
I agree with all that - and my scaling by 32767 on the output end is in effect
that very small amount of 'backing off'. The issues raised was ensuring an
identity operation in converting from and to 16bits, and I can do that despite
using 32768 one end and 32767 the other. And anyone who really does push their
signals to digital peak has only themselves to blame...
I just find the notion of the purely positive clip inelegant. All other issues
aside, I don't need to code for that clipping at all. It is in any case a moot
point how non-identical samples can be without causing a problem. If symmetry
is preserved, the differences would amount to just a minuscule change of level,
as you say, which is neither here nor there.
Richard Dobson
Kurt Bigler wrote:
Well, the trick I use is to use convergent rounding when converting from
floats
to shorts, and my underlying concern is with preserving exact symmetry of the
waveform - that is the case if I map floats to +- 32767 (so that 16bit zero =
true DC). A sampled sinusoid that touched both -32768 and +32767 would have a
true DC point 0.5 below 16bit zero, on rendering to analogue.
But such a sinusoid would never exist unless one really contrived to create
it. It would require not just scalling but explicitly adding a DC offset in
order to acheive that - unless you are talking about an A/D that perversely
"centered" its analog zero point between the two extremes of its digital
output range.
I think what was being talked about here is scaling by 32768 but not adding
any offset. This results in a positive clip that does not match the
negative clip. So there is slightly less headroom on the + side than on the
- side, by about 0.0003 db (20 log 32767/32768). This is not a loss of
headroom that anyone is likely to worry about. So yes, if you clip a sine
wave significantly in this situation, then you will end up with a DC offset
accompanying the clip. But even if you sent a full 1.0 float amplitude sine
wave to an output with asymmetrical clipping involved along the way, you
would get almost no DC offset, and in fact almost no distortion to speak of.
(The same kind of issue applies on A/D input, but it would be impossibly
difficult to arrange for the exact amplitude that would clip on the + side
but not on the - side.) If you are worried about that amount of distortion,
don't push the headroom to its limit. If you back off even one thousandth
of a db you won't run into the problem. If you need to do signal testing
with near-full amplitude sine waves then you can go to the extra trouble to
back off that much.
_______________________________________________
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.