[sdiy] Non maximal-length LFSR

rsdio at audiobanshee.com rsdio at audiobanshee.com
Fri Mar 4 11:05:02 CET 2016


A) Doing a little more research, the Wikipedia entry shows a few register lengths that do have adjacent taps. 15-bit, 22-bit, 60-bit, and 63-bit registers all have 2 taps that are adjacent. Seems rather unintuitive to me that what works for some register lengths does not work for others.

B) You could just implement a 47-word register so that 2 taps is a viable option, but I don't really know how you're handling the modulo calculations. Seems like you'd need to stick to 2^N values like 32-word or 64-word, but none of those have 2-tap options.

If you need to produce 48 samples per millisecond frame, then you'll either need 48 separate 16-bit parallel LFSR implementations, our you'll need to run 48 iterations on a single 16-bit parallel LFSR and adjust your length expectations accordingly.

Brian


On Mar 3, 2016, at 10:43 PM, rsdio at audiobanshee.com wrote:
> I partly understood what you're doing.
> 
> I had started to ask whether you needed to pull 1 bit from each array to produce a 16-bit sample, and then I realized that you are effectively running 16 LFSRs in parallel. That much makes sense.
> 
> My problem is two-fold:
> 
> A) that you're XOR'ing two "bits" that are adjacent. If you look at r250.c, that example takes bits that are very far apart. As I mentioned in my first reply, I usually see at least two bit cells between each bit that is taken for the XOR, and certainly more than 0.
> 
> B) I don't understand why your LFSR length has to be related to your 48 kHz sample rate. You're not using more than one word of your 48-word buffer, are you? That won't really work well, because each word is related to the others in the buffer, and you'd produce the exact same noise signal with a phase shift. My understanding is that you can really only use one word from your LFSR buffer, and you merely need to make the buffer long enough that the maximum length before repetition is long enough to avoid detection. The unused words in the buffer are merely there to provide a long enough state history that the signal produced by the 1 word you use won't repeat too soon.




More information about the Synth-diy mailing list