Re: AudioConverter gives non normalized samples?!
Re: AudioConverter gives non normalized samples?!
- Subject: Re: AudioConverter gives non normalized samples?!
- From: "Mike Kluev" <email@hidden>
- Date: Thu, 29 Jan 2009 15:01:57 +0300
On Thu, 29 Jan 2009 02:10:56 -0800
Brian Willoughby <email@hidden> wrote:
This is a matter of basic mathematics and numerical representations.
If you multiply part of a waveform by one factor, and another part
by a different factor, then you have distorted the shape of the
waveform. That's more of a "by definition" kind of statement,
rather than something that needs to be backed up with an elaborate
paper. The power of two is also elementary, given that we are
talking about binary number representations in both the case of
fixed and floating point numbers.
ok
One very convincing argument for 0x8000 is that CDDA data passed
through 32-bit float will come out the DAC undistorted. With 0x7fff
you end up with altered data in the simplest case. But there are
many other examples.
What cases do you mean specifically? I tried several positive and
negative numbers with the following transform:
short s = ...; float f = s / factor; short s2 = f * factor;
and got s2 == s no matter which factor I choose 0x8000 or 0x7FFF.
BTW, should not there be "round" when converting to shorts?
(to better preserve waveform):
outputBuf[sampleIndex] = lround( inSample * 32768.0);
round could be inlined for efficiency (if it's not already) to
"compare"
and "addition".
Mike
_______________________________________________
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