Debian Codegraph @

opcodes/randi.xml

raw symbols SCIP
1
2 <refentry id="randi">
3 <indexterm id="IndexRandi"><primary>randi</primary></indexterm>
4 <refentryinfo><title>Signal Generators:Random (Noise) Generators</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>randi</refentrytitle>
7 </refmeta>
8
9
10
11 <refnamediv>
12 <refname>rand</refname>
13 <refpurpose>
14 Generates a controlled random number series with interpolation between each new number.
15 </refpurpose>
16 </refnamediv>
17
18 <refsect1>
19 <title>Description</title>
20 <para>
21 Generates a controlled random number series with interpolation between each new number.
22 </para>
23 </refsect1>
24
25 <refsect1>
26 <title>Syntax</title>
27 <synopsis>ares <command>randi</command> xamp, xcps [, iseed] [, isize] [, ioffset]</synopsis>
28
29 <synopsis>kres <command>randi</command> kamp, kcps [, iseed] [, isize] [, ioffset]</synopsis>
30 </refsect1>
31
32 <refsect1>
33 <title>Initialization</title>
34 <para>
35 <emphasis>iseed</emphasis> (optional, default=0.5) -- seed value for the recursive pseudo-random formula. A value between 0 and +1 will produce an initial output of <emphasis>kamp * iseed.</emphasis> A negative value will cause seed re-initialization to be skipped. A value greater than 1 will seed from system time, this is the best option to generate a different random sequence for each run.
36 </para>
37
38 <para>
39 <emphasis>isize</emphasis> (optional, default=0) -- if zero, a 16 bit number is generated. If non-zero, a 31-bit random number is generated. Default is 0.
40 </para>
41
42 <para>
43 <emphasis>ioffset</emphasis> (optional, default=0) -- a base value added to the random result. New in Csound version 4.03.
44 </para>
45 </refsect1>
46
47 <refsect1>
48 <title>Performance</title>
49 <para>
50 <emphasis>kamp, xamp</emphasis> -- range over which random numbers are distributed.
51 </para>
52
53 <para>
54 <emphasis>kcps, xcps</emphasis> -- the frequency which new random numbers are generated.
55 </para>
56
57 <para>
58 The internal pseudo-random formula produces values which are uniformly distributed over the range <emphasis>kamp</emphasis> to <emphasis>-kamp</emphasis>. <emphasis>rand</emphasis> will thus generate uniform white noise with an R.M.S value of <emphasis>kamp / root 2</emphasis>.
59 </para>
60
61 <para>
62 The remaining units produce band-limited noise: the <emphasis>kcps</emphasis> and <emphasis>xcps</emphasis> parameters permit the user to specify that new random numbers are to be generated at a rate less than the sampling or control frequencies. <emphasis>randi</emphasis> will produce straight-line interpolation between each new number and the next.
63 </para>
64 </refsect1>
65
66 <refsect1>
67 <title>Examples</title>
68 <para>
69 Here is an example of the randi opcode. It uses the file <ulink url="examples/randi.csd"><citetitle>randi.csd</citetitle></ulink>.
70 <example>
71 <title>Example of the randi opcode.</title>
72 <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>
73 <xi:include href="examples-xml/randi.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
74 </example>
75 </para>
76 <para>
77 The example will produce the following output:
78 <screen>
79 i 1 time 0.00067: 50.00000
80 i 1 time 0.50000: -75.81672
81 i 1 time 1.00000: 95.93833
82
83 WARNING: Seeding from current time 1482746120
84
85 i 2 time 2.00067: -17.94434
86 i 2 time 2.50000: -14.11875
87 i 2 time 3.00000: -72.41545
88 </screen>
89 </para>
90 </refsect1>
91
92 <refsect1>
93 <title>See also</title>
94 <para><link linkend="SiggenNoise"><citetitle>Random (Noise) Generators</citetitle></link>
95 <link linkend="randh"><citetitle>randh</citetitle></link>,
96 <link linkend="rand"><citetitle>rand</citetitle></link>
97 </para>
98 </refsect1>
99
100 </refentry>