[sdiy] Non maximal-length LFSR

Tom Wiltshire tom at electricdruid.net
Thu Mar 3 22:33:51 CET 2016

On 3 Mar 2016, at 21:19, "Richie Burnett" <rburnett at richieburnett.co.uk> wrote:

>> You are still using bits from the same sequence (each LFSR, a bitslice of
>> your 48 registers, has the same structure), so you need to carefully
>> initialize the LFSR states to have a large enough distance.  You reduce the
>> correlation length by a factor of 16, which is inconsequential if you keep
>> the sequences the maximum of 2^44 cycles apart, but could have unintended
>> results if they are quite close together.
> Hmmm, this is very true.  At present I've just been seeding the LFSRs using 48 iterations of a 16-bit Linear Congruential Generator, without much thought being put into the initial states.  I just checked the spectrum of the white noise output from the algorithm and thought that any short-term correlation between the bits in each word would result in FIR filtering of the noise and therefore result in magnitude ripple in the spectrum.

Wouldn't it be best to have the "sequence read points" spaced out as much as possible? E.g. Start each separate LFSR with a value roughly 1/16th further through the whole sequence. Obviously finding those values is going to involve either "hard sums" or exhaustive testing, but it's offline, so that's not impossible.

>> If you really want just 16 random
>> bits per cycle, one of the pseudo-random generators that are used elsewhere
>> might actually be much less of a headache.  You don't need one that's
>> cryptographically secure, so there are lots of existing examples around.
> I can always fall back on something more well known.  I thought I'd uncovered a clever implementation, but now I'm not so sure that the advantages of saving a few CPU cycles outweigh the additional complications and setup concerns!

I think generating a whole random word in two instructions is pretty clever. I'd stick with it. I think you're onto something.


More information about the Synth-diy mailing list