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
|
<refentry id="randh">
<indexterm id="IndexRandh"><primary>randh</primary></indexterm>
<refentryinfo><title>Signal Generators:Random (Noise) Generators</title></refentryinfo>
<refmeta>
<refentrytitle>randh</refentrytitle>
</refmeta>
<refnamediv>
<refname>randh</refname>
<refpurpose>
Generates random numbers and holds them for a period of time.
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<para>
Generates random numbers and holds them for a period of time.
</para>
</refsect1>
<refsect1>
<title>Syntax</title>
<synopsis>ares <command>randh</command> xamp, xcps [, iseed] [, isize] [, ioffset]</synopsis>
<synopsis>kres <command>randh</command> kamp, kcps [, iseed] [, isize] [, ioffset]</synopsis>
</refsect1>
<refsect1>
<title>Initialization</title>
<para>
<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.
</para>
<para>
<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.
</para>
<para>
<emphasis>ioffset</emphasis> (optional, default=0) -- a base value added to the random result. New in Csound version 4.03.
</para>
</refsect1>
<refsect1>
<title>Performance</title>
<para>
<emphasis>kamp, xamp</emphasis> -- range over which random numbers are distributed.
</para>
<para>
<emphasis>kcps, xcps</emphasis> -- the frequency which new random numbers are generated.
</para>
<para>
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>.
</para>
<para>
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>randh</emphasis> will hold each new number for the period of the specified cycle.
</para>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
Here is an example of the randh opcode. It uses the file <ulink url="examples/randh.csd"><citetitle>randh.csd</citetitle></ulink>.
<example>
<title>Example of the randh 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/randh.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
</example>
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<link linkend="rand"><citetitle>rand</citetitle></link>,
<link linkend="randi"><citetitle>randi</citetitle></link>
</para>
</refsect1>
<refsect1>
<title>Credits</title>
<para>Example written by &namekevin;.</para>
</refsect1>
</refentry>
|