| 1 | |
| 2 | <refentry id="cuserrnd"> |
| 3 | <indexterm id="IndexCuserrnd"><primary>cuserrnd</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Generators:Random (Noise) Generators</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>cuserrnd</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>cuserrnd</refname> |
| 13 | <refpurpose> |
| 14 | Continuous USER-defined-distribution RaNDom generator. |
| 15 | </refpurpose> |
| 16 | </refnamediv> |
| 17 | |
| 18 | <refsect1> |
| 19 | <title>Description</title> |
| 20 | <para> |
| 21 | Continuous USER-defined-distribution RaNDom generator. |
| 22 | </para> |
| 23 | </refsect1> |
| 24 | |
| 25 | <refsect1> |
| 26 | <title>Syntax</title> |
| 27 | <synopsis>aout <command>cuserrnd</command> kmin, kmax, ktableNum</synopsis> |
| 28 | |
| 29 | <synopsis>iout <command>cuserrnd</command> imin, imax, itableNum</synopsis> |
| 30 | |
| 31 | <synopsis>kout <command>cuserrnd</command> kmin, kmax, ktableNum</synopsis> |
| 32 | </refsect1> |
| 33 | |
| 34 | <refsect1> |
| 35 | <title>Initialization</title> |
| 36 | <para> |
| 37 | <emphasis>imin</emphasis> -- minimum range limit |
| 38 | </para> |
| 39 | |
| 40 | <para> |
| 41 | <emphasis>imax</emphasis> -- maximum range limit |
| 42 | </para> |
| 43 | |
| 44 | <para> |
| 45 | <emphasis>itableNum</emphasis> -- number of table containing the random-distribution function. Such table is generated by the user. See <link linkend="GEN40">GEN40</link>, <link linkend="GEN41">GEN41</link>, and <link linkend="GEN42">GEN42</link>. The table length does not need to be a power of 2 |
| 46 | </para> |
| 47 | </refsect1> |
| 48 | |
| 49 | <refsect1> |
| 50 | <title>Performance</title> |
| 51 | <para> |
| 52 | <emphasis>ktableNum</emphasis> -- number of table containing the random-distribution function. Such table is generated by the user. See <link linkend="GEN40">GEN40</link>, <link linkend="GEN41">GEN41</link>, and <link linkend="GEN42">GEN42</link>. The table length does not need to be a power of 2 |
| 53 | </para> |
| 54 | <para> |
| 55 | <emphasis>kmin</emphasis> -- minimum range limit |
| 56 | </para> |
| 57 | |
| 58 | <para> |
| 59 | <emphasis>kmax</emphasis> -- maximum range limit |
| 60 | </para> |
| 61 | |
| 62 | <para> |
| 63 | <emphasis>cuserrnd</emphasis> (continuous user-defined-distribution random generator) generates random values according to a continuous random distribution created by the user. In this case the shape of the distribution histogram can be drawn or generated by any GEN routine. The table containing the shape of such histogram must then be translated to a distribution function by means of GEN40 (see <link linkend="GEN40">GEN40</link> for more details). Then such function must be assigned to the XtableNum argument of cuserrnd. The output range can then be rescaled according to the Xmin and Xmax arguments. cuserrnd linearly interpolates between table elements, so it is not recommended for discrete distributions (<link linkend="GEN41">GEN41</link> and <link linkend="GEN42">GEN42</link>). |
| 64 | </para> |
| 65 | |
| 66 | <para> |
| 67 | For a tutorial about random distribution histograms and functions see: |
| 68 | |
| 69 | <itemizedlist> |
| 70 | <listitem> |
| 71 | <para> |
| 72 | D. Lorrain. "A panoply of stochastic cannons". In C. Roads, ed. 1989. Music machine. Cambridge, Massachusetts: MIT press, pp. 351 - 379. |
| 73 | </para> |
| 74 | </listitem> |
| 75 | </itemizedlist> |
| 76 | </para> |
| 77 | </refsect1> |
| 78 | |
| 79 | <refsect1> |
| 80 | <title>Examples</title> |
| 81 | <para> |
| 82 | Here is an example of the cuserrnd opcode. It uses the file <ulink url="examples/cuserrnd.csd"><citetitle>cuserrnd.csd</citetitle></ulink>. |
| 83 | <example> |
| 84 | <title>Example of the cuserrnd opcode.</title> |
| 85 | <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> |
| 86 | <xi:include href="examples-xml/cuserrnd.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 87 | </example> |
| 88 | Its output should include lines like these: |
| 89 | <screen> |
| 90 | i 1 time 0.00067: 53.14918 |
| 91 | i 1 time 0.20067: 0.00000 |
| 92 | i 1 time 0.40067: 0.00000 |
| 93 | i 1 time 0.60067: 96.80406 |
| 94 | i 1 time 0.80067: 94.20729 |
| 95 | i 1 time 1.00000: 0.00000 |
| 96 | i 1 time 1.20067: 86.13032 |
| 97 | i 1 time 1.40067: 31.37096 |
| 98 | i 1 time 1.60067: 70.35889 |
| 99 | i 1 time 1.80000: 0.00000 |
| 100 | i 1 time 2.00000: 49.18914 |
| 101 | |
| 102 | WARNING: Seeding from current time 2006647442 |
| 103 | |
| 104 | i 2 time 3.00067: 21.45002 |
| 105 | i 2 time 3.20067: 44.32333 |
| 106 | i 2 time 3.40067: 46.05420 |
| 107 | i 2 time 3.60000: 0.00000 |
| 108 | i 2 time 3.80067: 41.32175 |
| 109 | i 2 time 4.00000: 0.00000 |
| 110 | i 2 time 4.20000: 63.72019 |
| 111 | i 2 time 4.40067: 0.00000 |
| 112 | i 2 time 4.60067: 0.00000 |
| 113 | i 2 time 4.80067: 0.00000 |
| 114 | i 2 time 5.00000: 74.49330 |
| 115 | </screen> |
| 116 | </para> |
| 117 | </refsect1> |
| 118 | |
| 119 | <refsect1> |
| 120 | <title>See also</title> |
| 121 | <para><link linkend="SiggenNoise"><citetitle>Random (Noise) Generators</citetitle></link></para> |
| 122 | </refsect1> |
| 123 | |
| 124 | <refsect1> |
| 125 | <title>Credits</title> |
| 126 | <para>Author: &namegabriel;</para> |
| 127 | <para>New in Version 4.16</para> |
| 128 | </refsect1> |
| 129 | </refentry> |