# [sdiy] Non maximal-length LFSR

mskala at ansuz.sooke.bc.ca mskala at ansuz.sooke.bc.ca
Thu Mar 3 12:55:40 CET 2016

```On Thu, 3 Mar 2016, Tom Wiltshire wrote:
> Since all maximal length sequences produce the same values, and are
> similarly distributed, I don't see how one could sound significantly
> different to another. The distribution is key, since a rising binary
> count also produces all the output values, but it doesn't sound remotely
> random.

Two different maximal-length sequences will contain the same subsequences
up to the length of the register.  They'll contain very different sets
of subsequences of any greater length.  For instance, here are two
different maximal-length sequences for registers of length 5 (Perl code
below my signature):

taps at 5 and 2:
1010111011000111110011010010000

taps at 5, 4, 3, and 2:
1011010100011101111100100110000

One of these contains a string of 8 ones and 1 zero; the other does not
contain any nine-bit sequence with that much bias in either direction.
This will make a difference in what comes out if they go through an
integrator or low pass filter.  *I haven't tried it*, but it's reasonable
to guess that they might also sound different if changed into audio
waveforms.  The fact that people working on semiconductor testing do find
reasons to prefer some polynomials over others even though the preferred
ones are more expensive to build - and those people care a lot about
saving implementation complexity and wouldn't use the more expensive
polynomials without good reason - suggests that there are at least some
real ways in which different maximal-length sequences differ from each
other.

--
Matthew Skala
mskala at ansuz.sooke.bc.ca                 People before principles.
http://ansuz.sooke.bc.ca/

#!/usr/bin/perl

\$x=1;

# \$poly=0x12;
\$poly=0x1E;

for (\$y=0;\$y<31;\$y++) {
print (\$x&1);
if (\$x&1) {
\$x>>=1;
\$x^=\$poly;
} else {
\$x>>=1;
}
}

print "\n";

```