Help - Search - Members - Calendar
Full Version: Open Source Dither Routines
Hydrogenaudio Forums > Hydrogenaudio Forum > Scientific Discussion
spoon
I am about to put some real effort into writing a universal dither routines. Rather than take open source stuff, improve it and rewrite it as closed source, it will be kept open-source (after all we all 'stand on the shoulders of giants'). The code for dithers is relatively simple, but being a black art, errors can slip through, by concentrating on a small library it is hoped that such can be avoided, whilst creating a flexible library, coded in a style 2nd to none (and well documented) allowing all kind of bit reduction (32 float, 64 float, 24 bit, 32 bit) to 24 >> 8 bit.

What exists already in the open source domain:

SSRC: offers pretty much the full range - rectangular, TPDF, ATH, the code is very much imbedded and none commented (having done alot of work on ssrc, it is not for the faint hearted. Don't take this as critism Mr Shibatch if you are reading, your work pure brilliance). Much is said about the quality, especially the noise shaped code.

MAD Player: a quick look, it seems to be rectangular dither with quantize error feedback (3 stage, n+1 / 2, n+2 / 4, n+3 / 8). (my wording might be slightly off)

Various commercial efforts: These are nearly all patented, they need to be kept an eye on to make sure that any code is not infringing.

It seems that SSRC would be the best one to work off, any comments on its implementation, problems, improvement insights?

Finally: a bit a**l...but...all (AFAIK) use random noise, but I have seen no reference to the random number generators. Pseudo-random noise generators generally speaking have problems with randomness (the results from pseudo generators can be easily detected, see www.random.org for links to tools that test randomness). Has anyone any info on this, are true random numbers (such as the pre-collected numbers as collected from atmospheric electromagnetic radiation) audibly better?
Garf
QUOTE(spoon @ Dec 20 2005, 10:10 PM)
Finally: a bit a**l...but...all (AFAIK) use random noise, but I have seen no reference to the random number generators. Pseudo-random noise generators  generally speaking have problems with randomness (the results from pseudo generators can be easily detected, see www.random.org for links to tools that test randomness). Has anyone any info on this, are true random numbers (such as the pre-collected numbers as collected from atmospheric electromagnetic radiation) audibly better?
*



Good psuedo random number generators are not detectable (not by tools, not by the ears).
spoon
Can you recommend any generators? the ones I have tested (I run one from some abscure mathamatical book as recommended by some maths guy a number of years ago), plus all ones on code project, all fail on Chi Squared Distribution and are easily detected.
jcoalson
just throwing this out there: Wolfram's 1D cellular automaton rule #30 generator? (the one used in mathematica.)

http://www.wolframscience.com/nksonline/pa...ext?firstview=1
http://mathworld.wolfram.com/RandomNumber.html

Josh
Enig123
Maby Mersenne Twister (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html) can meet your needs.

http://www.agner.org/random/ you can find the c/asm lib of implementation of this algorithm.
KikeG
I think that as long as there is not a clearly perceivable repeating pattern on the resulting dither noise, the amount of randomness is not very important.

This post about testing that the applied dither is doing what is supposed to do can be useful:

http://www.hydrogenaudio.org/forums/index....indpost&p=85763
Halcyon
I'm not sure this is what you asked for, but check out also the following source for dither implementation:

Resampler by Laurent de Soras (GPL, simple TPDF implementation)
http://ldesoras.free.fr/prod.html#src_resampler

Perhaps you might also be interested in:

Whither Dither: Experience with High-Order Dithering Algorithms in the Studio. with Julia C. Wen. Presented at the 95 AES convention, October 7-10 1993, Preprint Number 3747 (B3-AM-3)
http://www.jamminpower.com/PDF/Whither%20Dither.jsp

Dither Myths and Facts, Lipshitz, Stanley P.; Vanderkoy, John, 2004, AES Preprint Number: 6279.

Subtractive and Nonsubtractive Dithering: A Mathematical Comparison, Wannamaker, Robert A., JAES Volume 52 Number 12 pp. 1211-1227; December 2004.

Alexey Lukin's comparison of WLR implementations
http://audio.rightmark.org/lukin/dither/dither.pdf


spoon
Thanks for the links, Axeley has done a sterling job of listing all dither types (here is the html, I hate pdf):

http://audio.rightmark.org/lukin/dither/dither.htm

--------

I will check out and test Maby Mersenne Twister. smile.gif

--------

>the amount of randomness is not very important

I suspect this is true also, although there are some really bad random number generators, have a look at the 'not so good' plotted here:

http://www.viewsfromscience.com/documents/...s/chaos_p4.html

This guy likes his geiger counter.

I would love to try a simple dither (rectangular) and try with different random number generators, there might be an audible difference (atleast with a 'not so good' generator).
spoon
>Maby Mersenne Twister

I have run my analysis on Mersenne, it does seem an impressive random number generator (I have switched), fast as well.
donriggs
QUOTE(spoon @ Jan 4 2006, 10:38 PM)
I have run my analysis on Mersenne, it does seem an impressive random number generator (I have switched), fast as well.
*



The Mersenne twister also forms the base of glib's random number generator.
This might be helpful for portability.

Riggs
Synthetic Soul
I can't believe that I have seen the phrase Mersenne Twister twice now in the space of a fortnight.

Coincidence, or purely random?

One for Scooby Doo I feel.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.