[sdiy] converting white noise to pink noise

Andre Majorel aym-htnys at teaser.fr
Wed Mar 5 09:36:54 CET 2008


On 2008-03-04 16:38 -0700, Eric Brombaugh wrote:
> Andre Majorel wrote:
>> But note that long period does not imply good sound. For example,
>> http://www.maxim-ic.com/appnotes.cfm?appnote_number=1743&CMP=WP-9
>> is a 32-bit LFSR with a 2**32 period that does not sound very
>> white.
>
> If it doesn't sound white, what does it sound like?

Like noise with an uneven spectrum.

> The polynomial they used gives a uniform distribution so it
> ought to work as well as any other.

Well, a sawtooth also has uniform distribution.

> I've been using LFSRs for years now and haven't come across any
> information on some polynomials providing better quality than
> others (aside from longer ones being more desirable in some
> situations).

Can't provide any, sorry. I was just playing with a C
implementation of this LFSR. Using a highly sophisticated tool
named a Hex-And-ASCII Dump Program, I noticed that its output was
strangely repetitive, with a pseudo-period of 15.5 bytes. No
wonder the spectrum sounds so peaky.

> I don't know anything about the MAX765x processor discussed in
> that app note, so I've got no idea how fast that noise generator
> was running. Maybe the one you heard was running too slow. One
> of the problems with using straight binary LFSR outputs for
> audio noise is that there is a sin(x)/x rolloff due to the
> zero-order hold nature of the shift register output.
> This gives roughly 3dB loss at half the LFSR clock rate and deep
> notches at multiplies of the clock rate. To get around that you
> need to have a fairly high clock rate so that losses due to the
> sinc response are negligible within normal human hearing range.

The tests made were :

- One iteration of the LFSR gives a 32-bit value. Configure audio
  DAC for 8-bit operation @ 8 kHz and send that value to the DAC 8
  bits at a time. Effective LFSR clock 2 kHz.

- The same but 16 bits at a time @ 44.1 kHz. Effective LFSR clock
  22.05 kHz.

How is that sin(x) / x curve centred with respect to the clock
frequency ?

>> y = yprev + rand has more LF energy than y = rand (i.e. white
>> noise). But I don't think that's pink distribution, otherwise
>> people would use that !
>
> That's an interesting linear system you've defined there -
> notice that the impulse response is an infinite hold (it
> converts an impulse into a step).  That aside, it is a
> second-order system with a lowpass response falling off at
> roughly 6dB/octave...

If you say so. :-) That may be brown noise but don't quote me on
that.

> ... starting from DC...

Yes. In practice, you would have to do something to limit the
excursion. Perhaps make it leaky, y = f x yprev + rand with f
something like 0.999. Defining the LF response as a function of f
and the sample rate is left as an exercise to the maths-heads. :-)

Or maybe let it overflow and wrap around, although I suspect that
would tilt the spectrum towards HF.

-- 
André Majorel <URL:http://www.teaser.fr/~amajorel/>
Do not use this account for regular correspondence.
See the URL above for contact information.



More information about the Synth-diy mailing list