1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
<refentry id="duserrnd">
<indexterm id="IndexDuserrnd"><primary>duserrnd</primary></indexterm>
<refentryinfo><title>Signal Generators:Random (Noise) Generators</title></refentryinfo>
<refmeta>
<refentrytitle>duserrnd</refentrytitle>
</refmeta>
<refnamediv>
<refname>duserrnd</refname>
<refpurpose>
Discrete USER-defined-distribution RaNDom generator.
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<para>
Discrete USER-defined-distribution RaNDom generator.
</para>
</refsect1>
<refsect1>
<title>Syntax</title>
<synopsis>aout <command>duserrnd</command> ktableNum</synopsis>
<synopsis>iout <command>duserrnd</command> itableNum</synopsis>
<synopsis>kout <command>duserrnd</command> ktableNum</synopsis>
</refsect1>
<refsect1>
<title>Initialization</title>
<para>
<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
</para>
</refsect1>
<refsect1>
<title>Performance</title>
<para>
<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
</para>
<para>
<emphasis>duserrnd</emphasis> (discrete user-defined-distribution random generator) generates random values according to a discrete random distribution created by the user. The user can create the discrete distribution histogram by using <link linkend="GEN41">GEN41</link>. In order to create that table, the user has to define an arbitrary amount of number pairs, the first number of each pair representing a value and the second representing its probability (see <link linkend="GEN41">GEN41</link> for more details).
</para>
<para>
When used as a function, the rate of generation depends by the rate type of input variable XtableNum. In this case it can be embedded into any formula. Table number can be varied at k-rate, allowing to change the distribution histogram during the performance of a single note. <emphasis>duserrnd</emphasis> is designed be used in algorithmic music generation.
</para>
<para>
<emphasis>duserrnd</emphasis> can also be used to generate values following a set of ranges of probabilities by using distribution functions generated by GEN42 (See <link linkend="GEN42">GEN42</link> for more details). In this case, in order to simulate continuous ranges, the length of table XtableNum should be reasonably big, as <emphasis>duserrnd</emphasis> does not interpolate between table elements.
</para>
<para>
For a tutorial about random distribution histograms and functions see:
<itemizedlist>
<listitem>
<para>
D. Lorrain. "A panoply of stochastic cannons". In C. Roads, ed. 1989. Music machine. Cambridge, Massachusetts: MIT press, pp. 351 - 379.
</para>
</listitem>
</itemizedlist>
</para>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
Here is an example of the duserrnd opcode. It uses the file <ulink url="examples/duserrnd.csd"><citetitle>duserrnd.csd</citetitle></ulink>.
<example>
<title>Example of the duserrnd opcode.</title>
<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>
<xi:include href="examples-xml/duserrnd.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</example>
Its output should include lines like these:
<screen>
i 1 time 0.00067: 8.00000
i 1 time 0.00133: 8.00000
i 1 time 0.00200: 8.00000
i 1 time 0.00267: 8.00000
i 1 time 0.00333: 2.00000
i 1 time 0.00400: 8.00000
i 1 time 0.00533: 8.00000
i 1 time 0.00600: 8.00000
..........
</screen>
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<link linkend="cuserrnd"><citetitle>cuserrnd</citetitle></link>,
<link linkend="urd"><citetitle>urd</citetitle></link>
</para>
</refsect1>
<refsect1>
<title>Credits</title>
<para>Author: &namegabriel;</para>
<para>New in Version 4.16</para>
</refsect1>
</refentry>
|