RE: Native Device Formats
RE: Native Device Formats
- Subject: RE: Native Device Formats
- From: "Richard Furse" <email@hidden>
- Date: Tue, 10 Jun 2008 10:32:07 +0100
> -----Original Message-----
> From:
> coreaudio-api-bounces+rf015d9821=email@hidden.
> com
> [mailto:coreaudio-api-bounces+rf015d9821=blueyonder.co.uk@list
> s.apple.com] On Behalf Of Brian Willoughby
> Sent: 09 June 2008 21:26
> To: Mikael Hakman
> Cc: CoreAudio API
> Subject: Re: Native Device Formats
> [...] There is no lossless mapping from CDDA to
> float [-1.0, +1.0], although it is sometimes possible to
> recreate the lost data under carefully controlled conditions.
> [...]
Ah, yes - I hadn't been considering the 24bit integer vs float with 24bit
mantissa case specifically - good point.
There's also plenty of interesting stuff happening even if we assume for the
sake of argument that the particular float type in use has "enough"
precision relative to the integer type in use.
> -----Original Message-----
> From:
> coreaudio-api-bounces+rf015d9821=email@hidden.
> com
> [mailto:coreaudio-api-bounces+rf015d9821=blueyonder.co.uk@list
> s.apple.com] On Behalf Of Mikael Hakman
> Sent: 09 June 2008 11:38
> To: Brian Willoughby; CoreAudio API
> Subject: Re: Native Device Formats
> [...]
> Now, consider the following series of signed 24-bit binary integers:
> 0x7fffff, 0x800000, 0x7fffff, 0x800000, etc. The values are
> the maximum and the minimum of a 24-bit number, and these are
> the values transmitted by S/PDIF and processed by a DAC. What
> does this signal represent? Two answers are possible.
>
> If you say that this series represent the same wave as the
> above +1.0,-1.0 series then you must withstand that the
> binary integer value 0x0 is not signal value 0. The signal
> value zero is half way between binary 0x0 and 0xffffff - i.e.
> it is not expressible as a bit combination. This doesn't mean
> that you cannot output silence. A series of any constant
> numbers will be interpreted as a silence with a corresponding
> DC offset. A series of 0x0:s will be interpreted as a silence
> with DC offset ½ bit out of 24.
For me, the biggest problem with mapping zero to a non-zero "DC" level is
that it can cause unexpected results downstream in a processing chain. For
instance, the next element might be an amplifier with high time-varying
gain.
But from what you're saying, it sounds like DC isn't an issue for ADC/DAC
stuff, where I guess it's a "separate" problem. (?)
> If you, on the other hand, require the signal value 0 to be
> represented by binary 0x0 then the consequence is that the
> above integer series doesn't represent pure sine wave. This
> is because a pure sine wave is symmetrical around 0 but the
> above series isn't - negative half is larger by 1 bit than
> the positive half. It is a distorted sine wave but only if
> you persist that binary 0x0 shall be signal value 0. There
> you have your distortion.
Exactly - it's not a pure sine wave. Only I wouldn't call it distortion -
I'd model it as a Nyquist frequency sine wave with an amplitude slightly
under one, mixed with some slight negative DC.
> The interesting questions now are:
>
> 1. What would you like it to be?
> 2. What does current DAC semiconductor components do? How do
> they interpret this series?
>
> Depending on the answer to the above questions, you could
> arrive either to conclusion that inclusive [-1.0, +1.0]
> mapping is very adequate, or that you shouldn't use the most
> negative integer value at all in which case the inclusive
> mapping is still ok.
I think for DSP stuff, it's probably best to map zero to zero to keep
complex signal chains stable and simple. But that's largely a matter of
priority - I can see that this might not be so important in ADC/DAC work.
The final option of mapping [-127,+127], [-32767,+32767] etc to [-1.0,+1.0]
does work well (mantissa skew aside) and I used to use this approach until I
ran into bafflingly subtle difficulties where mixed bit depths are used. For
instance, if we map 4bit audio to 3bit audio, we're mapping 15 values
(-1,-6/7,-5/7...) onto 7 mostly rather different values (-1,-2/3,-1/3...),
so we map 2 values across onto 1 except in one place where we map 3 onto 1.
This isn't too natural - and once combined with other operations, even
linear ones, I found weird artefacts creeping into my audio at low levels.
This all went away when I finally saw the light and gave up on +1.0. ;-)
> Regards/Mikael
>
Best wishes,
--Richard
_______________________________________________
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