| 1 | |
| 2 | <refentry id="lfsr"> |
| 3 | <indexterm id="IndexLfsr"><primary>lfsr</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Generators:Random (Noise) Generators</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>lfsr</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>lfsr</refname> |
| 11 | <refpurpose> |
| 12 | Linear Feedback Shift Register (LFSR). |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | Output is a series of pseudo-random positive integers. This is the technique |
| 20 | used in so-called "Turing machine" synth modules and is usually used to |
| 21 | generate melodic sequences. This implementation is adapted from the firmware |
| 22 | for the Ornament & Crime module, as used in the Quantermain and Meta-Q apps. |
| 23 | </para> |
| 24 | </refsect1> |
| 25 | |
| 26 | <refsect1> |
| 27 | <title>Syntax</title> |
| 28 | <synopsis>knum <command>lfsr</command> ilen, iprob [, iseed]</synopsis> |
| 29 | </refsect1> |
| 30 | |
| 31 | <refsect1> |
| 32 | <title>Initialization</title> |
| 33 | <para> |
| 34 | <emphasis>ilen</emphasis> -- length of shift register, valid values are 1-31 (inclusive). The |
| 35 | larger the length, the larger the resulting integers in the output. You |
| 36 | can use this to constrain the output to a suitable range. |
| 37 | </para> |
| 38 | <para> |
| 39 | <emphasis>iprob</emphasis> -- probability, valid values 1-255 (inclusive). Controls the spread |
| 40 | of the output; larger values result in a wider spread of values. |
| 41 | </para> |
| 42 | <para> |
| 43 | <emphasis>iseed</emphasis> (optional, default -1) -- initial state of the shift register, as a |
| 44 | pattern of bits. The value is treated as an unsigned integer, so the default |
| 45 | of -1 is effectivly all bits on (0b11111111...). |
| 46 | </para> |
| 47 | </refsect1> |
| 48 | |
| 49 | <refsect1> |
| 50 | <title>Performance</title> |
| 51 | <para> |
| 52 | <emphasis>knum</emphasis> -- integer output |
| 53 | </para> |
| 54 | </refsect1> |
| 55 | |
| 56 | <refsect1> |
| 57 | <title>Examples</title> |
| 58 | <para> |
| 59 | Here is an example of the lfsr opcode. It uses the file <ulink url="examples/lfsr.csd"><citetitle>lfsr.csd</citetitle></ulink>. |
| 60 | <example> |
| 61 | <title>Example of the lfsr opcode.</title> |
| 62 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 63 | <xi:include href="examples-xml/lfsr.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 64 | </example> |
| 65 | </para> |
| 66 | </refsect1> |
| 67 | |
| 68 | <refsect1> |
| 69 | <title>See also</title> |
| 70 | <para><link linkend="SiggenNoise"><citetitle>Random (Noise) Generators</citetitle></link> |
| 71 | </para> |
| 72 | </refsect1> |
| 73 | |
| 74 | <refsect1> |
| 75 | <title>Credits</title> |
| 76 | <para>By: &namedave; 2020</para> |
| 77 | <para>Based on code by Patrick Dowling in the Ornament & Crime firmware.</para> |
| 78 | <para>New in version 6.16</para> |
| 79 | </refsect1> |
| 80 | |
| 81 | </refentry> |