Help - Search - Members - Calendar
Full Version: Frequency spectrum of PRN from LFSR
Hydrogenaudio Forums > Hydrogenaudio Forum > Scientific/R&D Discussion
2Bdecided
Read any (appropriate) text book, and it will describe generating pseudo random numbers from linear feedback shift registers.

You can find suitable feedback configurations to give maximum length sequences in many books too. As long as you don't pick the one that locks it, the seed doesn't matter.

I've tried this, both for 16 bits and 19 bits, and for some reason I can't make it workas I expect. I get a maximum length sequence, uniform PDF, single spike autocorrelation, but non-flat frequency response. It is 10dB higher at low frequencies than high frequencies.

Any idea what I might be doing wrong?

Cheers,
David.
benski
Maybe the problem lies in your spectral analysis. Are you properly windowing and overlapping the data? Maybe your 10dB low frequency boost is caused by the impulse generated by a rectangular window? Have you tried a 'natural' noise source to see if you're seeing the same thing?
2Bdecided
Thanks for the hint benski, but it wasn't the window.

It was something even more silly, which I realised in the bath this morning(!).

I will share it in case anyone else ever makes the same mistake...

For 8-bits of dither, I was just grabbing the bottom 8 bits of the LFSR. On the next clock, I was doing the same. So I only had one new bit each time!

This meant each dither sample was equal to the previous, multiplied (or divided) by 2, plus a small (or large) noise signal (i.e. the new bit). You could look at it as an IIR filter with noise at the input, and noise added to the output. The frequency response of this inner filter is what I was seeing.

Clocking the LFSR 8 times per 8-bit sample gives me 8 new bits each time, and solves the problem.

Cheers,
David.
ilo
Bit independence is a major deal for cryptography people, who use many methods for testing PRNGs for "true randomness". It's probably overkill for an audio dither generator, but it's nonetheless interesting to look at the methods and quality measures used in the cryptography community (a starting point can be this or this or this).
2Bdecided
Very interesting, thank you!

Cheers,
David.
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.