lfsr
Linear Feedback Shift Register (LFSR).
Output is a series of pseudo-random positive integers. This is the technique used in so-called "Turing machine" synth modules and is usually used to generate melodic sequences. This implementation is adapted from the firmware for the Ornament & Crime module, as used in the Quantermain and Meta-Q apps.
Syntax
Initialization
ilen -- length of shift register, valid values are 1-31 (inclusive). The larger the length, the larger the resulting integers in the output. You can use this to constrain the output to a suitable range.
iprob -- probability, valid values 1-255 (inclusive). Controls the spread of the output; larger values result in a wider spread of values.
iseed (optional, default -1) -- initial state of the shift register, as a pattern of bits. The value is treated as an unsigned integer, so the default of -1 is effectivly all bits on (0b11111111...).
Performance
knum -- integer output
Examples
Here is an example of the lfsr opcode. It uses the file lfsr.csd.
See also
Credits
By: Dave Seidel 2020
Based on code by Patrick Dowling in the Ornament & Crime firmware.
New in version 6.16