[sdiy] Long LFSRs (Was Psych Tone)

Richie Burnett rburnett at richieburnett.co.uk
Sat Jan 5 23:44:47 CET 2019


Ralph Moonen<ralph at tink.org> wrote:

> Love this!
>
> lfsr’s are used a lot in cryptography where they need to be as random as 
> possible.
> in music that might be different. Has anyone here built (not-so-random) 
> lfsr
> sequencers for melodic generation? Something I will ponder over the 
> weekend :-)

Yes, we also use them for spread-spectrum comms stuff at work too.

One thing that I didn't realise is that longer LFSRs are not necessarily 
better for audio noise generation!  I once tried coding up a 127-bit LFSR to 
generate Pseudo-random Noise, thinking that it would be easy to do and that 
one would never hear the PN sequence repeat within a lifetime.  I was quite 
shocked when i heard the result though.  It didn't sound like white noise at 
all.  It sounded more like a dialup modem or an old home computer loading 
something from tape.  It was full of tonal blips, squeaks and chirps present 
in the output, despite having chosen the taps wisely to get a maximal length 
sequence.

Someone at work then explained to me that very long PN sequences have a 
large number of runs of 1's and 0's and other long sequences, and that these 
can sound tonal.  Because of the long sequence length, they don't come 
around very often, but these patterned runs don't sound like white noise at 
all, and are very objectionable.  They also take a very long time to break 
up if the register length is long!  You can obviously initialise the LFSR 
state to better choices that don't give you the objectionable chirps and 
buzzes at the start, but they will still come round again eventually!

Here's the sound of the first 15 seconds of a 127-bit LFSR with initial 
state set to one.

http://www.richieburnett.co.uk/temp/127-bit_LFSR.wav

Sound like white noise to you?! Lesson learned.

-Richie,





More information about the Synth-diy mailing list