[sdiy] LFSR noise generators

Tom Wiltshire tom at electricdruid.net
Fri Dec 27 17:36:29 CET 2019


In my early naiveté about these things when writing the firmware for the NOISE1 chip, I thought a longer shift register would be better. Since I couldn’t find a quick way to run the necessary operations for a long shift register, I instead used two shorter registers and interlaced the outputs, first a bit from one, then a bit from the other. Like this, the overall sequence won’t repeat until both shift registers reset back to the beginning at the same time. This makes for huge repeat lengths with fairly short registers, even at high output rates. Another effect of interlacing one register with another like this is that some of these “longer sequence” problems are alleviated, both because the sequences themselves can be shorter, and because any runs are broken up by alternate samples of something else. I think in my innocence, I might have got lucky with a useful result.

One thing that I did with the two LFSRs that “felt right” but for which I have (and offer!) no justification whatsoever is that I tried to make the sample rate consistent. The same number of clock cycles are used to process one LFSR as the other, so the bits come out at a constant rate. Of course, there’s no necessary reason why this need be the case. It would be fairly easy to write code with half a dozen different interlaced shift registers that all ran in different numbers of instructions so samples might come out after 12 instruction clocks, then 8, then 10, then 15, then 7, then 9 (for example). It would even be possible to use a further LFSR (or even the output of the previous LFSR?) to randomise which LFSR came next. This would “smear” the output rate.

Whether this helps is an open question. It certainly isn’t hard to do.

Tom

==================
       Electric Druid
Synth & Stompbox DIY
==================

> On 27 Dec 2019, at 15:16, Richie Burnett <rburnett at richieburnett.co.uk> wrote:
> 
>> From: Bernard Arthur Hutchins, Jr
>> 
>> ....Once we have chosen a PRBS sequence length that will take perhaps 10 seconds to repeat, little is accomplished by making the register longer (it may in fact just make the anomalies last longer).  A length-N anomaly in a length-N register could be expected to take perhaps N full-register replacements to dissipate an anomaly, thus N^2 clockings to “wash out”....
>> 
>> Comments invited.
>> 
>> Bernie
> 
> Agreed!  Here's an extreme example...
> 
> Below is a link to a 127-stage LFSR (easy to implement on a low-end 8-bit micro) with two taps chosen for the generation of a maximal length sequence consisting of (2^127)-1 unique states.  It is playing back at a sample rate of 32kHz:
> 
> http://www.richieburnett.co.uk/temp/LFSR127.wav
> 
> The 127-stage register was pre-loaded with a value of 1 before being started, and the sequence would repeat after approximately 168,598,172,981,343,971,702,664,518 years!
> 
> You can judge for yourself whether you think it sounds like white noise or not.  You can certainly hear the runs of '0's and '1's cycling through the shift register at the start.  And if you compare the start and end of the 30 second recording you can hear how the texture of the noise has evolved during that time.
> 
> Initialised with a different starting value, or left long enough to "wash out" as Bernie put it, it sounds much more "noise-like", but remember that every value in the sequence is guaranteed to come around again eventually!
> 
> -Richie, 
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at synth-diy.org
> http://synth-diy.org/mailman/listinfo/synth-diy

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://synth-diy.org/pipermail/synth-diy/attachments/20191227/740eaea6/attachment.htm>


More information about the Synth-diy mailing list