--- Mihail Zenkov <[EMAIL PROTECTED]> wrote: > On Wed, 9 May 2007 01:36:13 +0100 > Miguel Lobo <[EMAIL PROTECTED]> wrote: > > > > Yes, you absolutely right. But look at that code again: > > > > > > for (c = 0; c < DITHER_CHANNELS; c++) { > > > dp = 0; > > > for (i = 0; i < DITHER_SIZE-1; i++) { > > > d = rand() / (float)RAND_MAX - 0.5f; > > > rand_table[c][i] = d - dp; > > > dp = d; > > > } > > > rand_table[c][DITHER_SIZE-1] = 0 - dp; > > > > > > We subtract previous dither value from current to prevent noise > > > modulation. I use dither table to get maximum speed. > > > > I actually felt curious about the subtraction of the previous value > too. What > > do you mean by "noise modulation"? (And yes, this time I have > looked it up > > in Wikipedia ;)). > > Roughly, dither convert harmonic distortion to noise. If we just add > noise (random) to signal, distortion gone but noise will by modulated > by signal (correlate with signal). This noise not fully random. This > is > rectangle dithering. > > To prevent this modulation and get pure white (fully random) noise > (it > much better for human ears) not correlated with signal, we consider > previous dither value.
This is exactly my point. But for this to be correct two calls to a random generator per table entry is needed. If you do only one call and use a the second random number from the previous table entry you introduce correlations into the noise which means that the noise is not white. Now, it could be a design feature or a mistake I do not know. >From what I understand about dithering, it is a mistake, not design and yes it increases the speed of a factor of two, but this is, probably, not what you wanted. I addition, I do not know if this produces any noticable change at all, but since I am against dithering, I could be biased on that.... ZF __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ fluid-dev mailing list fluid-dev@nongnu.org http://lists.nongnu.org/mailman/listinfo/fluid-dev