summaryrefslogtreecommitdiff
path: root/opcodes/vrandi.xml
blob: 6bc0656b643976db32a84f122dc027260a4e5ba7 (plain)
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
<refentry id="vrandi">
<indexterm id="IndexVrandi"><primary>vrandi</primary></indexterm>
  <refentryinfo><title>Vectorial:Random</title></refentryinfo>
  <refmeta>
    <refentrytitle>vrandi</refentrytitle>
  </refmeta>

  <refnamediv>
    <refname>vrandi</refname>
    <refpurpose>
     Generate a sort of 'vectorial band-limited noise'
    </refpurpose>
  </refnamediv>

  <refsect1>
    <title>Description</title>
    <para>
      Generate a sort of 'vectorial band-limited noise'
    </para>
  </refsect1>
  <refsect1>
    <title>Syntax</title>
    <synopsis><command>vrandi</command>  ifn,  krange, kcps, ielements [, idstoffset] [, iseed]
      [, isize] [, ioffset]</synopsis>
  </refsect1>

  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>ifn</emphasis>  - number of the table where the vectorial signal will be generated
    </para>
       <para>
      <emphasis>ielements</emphasis> - number of elements to process
    </para>
    <para>
      <emphasis>idstoffset</emphasis> - (optional, default=0) -- index offset for the destination table
    </para>
    <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.
    </para>
  </refsect1>

  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>krange</emphasis> - range of random elements (from -krange to krange)
    </para>
    <para>
      <emphasis>kcps</emphasis> - rate of generated elements in cycles per seconds
    </para>
    <para>
      This opcode is similar to <link linkend="randi"><citetitle>randi</citetitle></link>, but operates on vectors instead of with scalar values.
    </para>
    <para>
      Though argument <emphasis>isize</emphasis> defaults to 0, thus using a 16-bit random number generator, using the newer 31-bit algorithm is recommended, as this will produce a random sequence with a longer period (more random numbers before the sequence starts repeating).
    </para>
    <para>
      The output is a vector contained in <emphasis>ifn</emphasis> (that must be previously allocated).
    </para>
    <para>
      All these operators are designed to be used together with other opocdes that operate with vector such as bmscan, <link linkend="adsynt"><citetitle>adsynt</citetitle></link> etc.
    </para>
    <para><emphasis>Note:</emphasis> bmscan not yet available on Canonical Csound
    </para>
  </refsect1>
  <refsect1>
    <title>Examples</title>
    <para>
      Here is an example of the vrandi opcode. It uses the file <ulink url="examples/vrandi.csd"><citetitle>vrandi.csd</citetitle></ulink>.

      <example>
        <title>Example of the vrandi 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/vrandi.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
      </example>
    </para>
  </refsect1>
  <refsect1>
    <title>See also</title>
    <para>
      <link linkend="vrandh"><citetitle>vrandh</citetitle></link>, 
      <link linkend="randi"><citetitle>randi</citetitle></link>
    </para>
  </refsect1>

  <refsect1>
    <title>Credits</title>
    <para>Written by Gabriel Maldonado.</para>
    <para>New in Csound 5 (Previously available only on CsoundAV)</para>
  </refsect1>
</refentry>