Re: AudioConvertor does dither?
Re: AudioConvertor does dither?
- Subject: Re: AudioConvertor does dither?
- From: Ev <email@hidden>
- Date: Mon, 3 May 2004 13:22:46 -0500
On May 3, 2004, at 1:00 PM, Doug Wyatt wrote:
As for when to dither: If you are recording, the driver will have
received 16 or 24-bit integers and converted them to float, which is a
perfectly accurate conversion for 24 bits and less. There's no need to
dither when you convert back from float to int for saving in a file.
On playback, the driver is ultimately going to be responsible for
converting your floats to ints. I don't know if any drivers do dither
at this stage of the process, that's an interesting ball of wax. If
the driver doesn't dither (and I don't believe you have a way to know
without asking the manufacturer), then you might consider dithering
your floats based on the device's bit depth (though for 24-bit I
suspect it's not worth the trouble -- or someone will correct me if
I'm wrong :-).
In cases where you want dithering, yes, you could add noise to your
floats.
It's conceivable that a future version of AudioConverter would
implement dithering, but it would almost certainly have to be turned
on explicitly by the client, both to preserve the current behavior and
to allow the client to make the decision about whether to incur the
extra computational overhead.
--
Doug Wyatt
Core Audio, Apple
OK, great. This explains things a bit better. It sounds like where
dither really should take place is "at the last moment" on playback.
All I'm really doing in my app (at this point) is simple multiplication
or bringing things through AUs which modify the floats. I don't even
really touch integers, really, as my buffering system for file reading
and writing just converts it to/from the file's bit depth at the last
moment.
Adding noise to a floating point buffer sounds crazy, but maybe that's
the way to do it, based on the bit depth it's gonna write out. So, get
buffer of floats, add 1/2LSB of the 'going-to-be-converted-to' bit
depth, run it through the converter, then there you have it.
The convertor is great, by the way. Very useful and predictable. Adding
a dither feature would be extremely cool. Another field in the output
AudioBasicStreamDescription, perhaps?
I think we could get into a great discussion with some folks about
whether dithering is necessary at the 24-bit level - or since we're
doing all the math in floats that it needs to be done at all in any
depth. But I'd like to hear what other programmers say - I'm beginning
to go anti-dither at this point.
Ev
Technical Knowledge Officer
Head Programmer/Designer
Audiofile Engineering
http://www.audiofile-engineering.com/
_______________________________________________
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.