|
Message
From: Attila Kinali<attila@k...>
Date: Wed Apr 25 22:24:09 CEST 2007
Subject: [oc] White Noise generator
On Fri, 20 Apr 2007 21:53:17 +0200 (CEST) jeanpaul.milani@a... wrote:
> I'm approcing to realize a white noise generator > using a Lattice fpga and a pcm1793 dac @ 192KHz > I've found many solutions on the web but many of them > are too slice's expencive for me. > I've try with a lfsr using this code:
[...]
> when i've try the machine i've notice that the power spectrum isn't flat > but it's quite gaussian with a peak @ 20KHz. > I hope someone can help me
This is not a problem of your code, but one of the design. LSFR produce a gausian distribution because of their structure. A simple (and most probably not fully true) explanation would be that the lsfr produces more or less random values that are evenly distributed. But the frequency component of the output signal depends on the dy/dt of the signal which is dependent on the difference of two successive samples. Now, because the samples are evenly distributed it is much more likely to find sample differences around 2^(wordlength/2) than of 0 (two times the same sample) and 2^(wordlength) (0 and max value).
I'm sure, someone with a real understanding of signal theory could give you a better explanation, but this whole thing boils down to that you are not looking for a random number generator that produces a evenly distributed numbers, but evenly distributed differences of consecutive values.
One way to achieve this would be to treat the output of an LFSR as a signed number and just add it up. But then you have to deal with probable over- and underflows.
Attila Kinali
-- Linux ist... wenn man einfache Dinge auch mit einer kryptischen post-fix Sprache loesen kann -- Daniel Hottinger
|
 |