[sdiy] converting white noise to pink noise

Eric Brombaugh ebrombaugh at earthlink.net
Wed Mar 5 16:33:26 CET 2008


Andre Majorel wrote:
> 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.
>> 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.

Wow! There must have been something wrong with the implementation. A 
period of 15.5 bytes is only 124 bits - nowhere near 2**31 
(2,147,483,648) as it should have been. One thing that comes to mind is 
that the appnote you reference has a block diagram of a 5-bit LFSR which 
is unrelated to the 31-bit LFSR they constructed in the assembly code, 
but that wouldn't have given the repeat length you saw.

Note also that it's very easy when creating an LFSR to come up with a 
degenerate case - if you pick off the wrong taps in the shift register 
for the feedback term then you won't get a maximal-length sequence. I've 
done this before myself and it can be frustrating.

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

The sin(x)/x curve has a peak at DC, with nulls at integer multiples of 
the clock frequency and progressively lower peaks between the nulls at 
higher frequencies. It looks kind of like a comb filter superimposed 
with a lowpass rolloff.

> 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. :-)

Yes, adding a little leakage turns it into a more ordinary 1st-order 
(not 2nd-order as I had initially said) system. I often use a simple 
equation of the form

Y(n) = A * X(n) + (1-A) * Y(n-1)

which has a 3dB corner frequency controlled by the A coefficient and is 
very easy to implement in digital hardware using simple shift operations.

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

Overflows & wraps are usually don't sound good, although there is a 
special case of FIR filter implemented with recursive math called a MAWF 
or CIC that depends on controlled overflows. But that's not what we're 
dealing with here.

Eric




More information about the Synth-diy mailing list