| 1 |
|
| 2 |
<refentry id="vrandi"> |
| 3 |
<indexterm id="IndexVrandi"><primary>vrandi</primary></indexterm> |
| 4 |
<refentryinfo><title>Vectorial:Random</title></refentryinfo> |
| 5 |
<refmeta> |
| 6 |
<refentrytitle>vrandi</refentrytitle> |
| 7 |
</refmeta> |
| 8 |
|
| 9 |
<refnamediv> |
| 10 |
<refname>vrandi</refname> |
| 11 |
<refpurpose> |
| 12 |
Generate a sort of 'vectorial band-limited noise' |
| 13 |
</refpurpose> |
| 14 |
</refnamediv> |
| 15 |
|
| 16 |
<refsect1> |
| 17 |
<title>Description</title> |
| 18 |
<para> |
| 19 |
Generate a sort of 'vectorial band-limited noise' |
| 20 |
</para> |
| 21 |
</refsect1> |
| 22 |
|
| 23 |
<refsect1> |
| 24 |
<title>Syntax</title> |
| 25 |
<synopsis><command>vrandi</command> ifn, krange, kcps, ielements [, idstoffset] [, iseed] \ |
| 26 |
[, isize] [, ioffset]</synopsis> |
| 27 |
</refsect1> |
| 28 |
|
| 29 |
<refsect1> |
| 30 |
<title>Initialization</title> |
| 31 |
<para> |
| 32 |
<emphasis>ifn</emphasis> - number of the table where the vectorial signal will be generated |
| 33 |
</para> |
| 34 |
<para> |
| 35 |
<emphasis>ielements</emphasis> - number of elements to process |
| 36 |
</para> |
| 37 |
<para> |
| 38 |
<emphasis>idstoffset</emphasis> - (optional, default=0) -- index offset for the destination table |
| 39 |
</para> |
| 40 |
<para> |
| 41 |
<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</emphasis> * <emphasis>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. |
| 42 |
</para> |
| 43 |
<para> |
| 44 |
<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. |
| 45 |
</para> |
| 46 |
<para> |
| 47 |
<emphasis>ioffset</emphasis> - (optional, default=0) -- a base value added to the random result. |
| 48 |
</para> |
| 49 |
</refsect1> |
| 50 |
|
| 51 |
<refsect1> |
| 52 |
<title>Performance</title> |
| 53 |
<para> |
| 54 |
<emphasis>krange</emphasis> - range of random elements (from -<emphasis>krange</emphasis> to <emphasis>krange</emphasis>) |
| 55 |
</para> |
| 56 |
<para> |
| 57 |
<emphasis>kcps</emphasis> - rate of generated elements in cycles per seconds |
| 58 |
</para> |
| 59 |
<para> |
| 60 |
This opcode is similar to <link linkend="randi"><citetitle>randi</citetitle></link>, but operates on vectors instead of with scalar values. |
| 61 |
</para> |
| 62 |
<para> |
| 63 |
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). |
| 64 |
</para> |
| 65 |
<para> |
| 66 |
The output is a vector contained in <emphasis>ifn</emphasis> (that must be previously allocated). |
| 67 |
</para> |
| 68 |
<para> |
| 69 |
All these operators are designed to be used together with other opcodes that operate with vector such as <link linkend="adsynt"><citetitle>adsynt</citetitle></link>, etc. |
| 70 |
</para> |
| 71 |
|
| 72 |
|
| 73 |
</refsect1> |
| 74 |
|
| 75 |
<refsect1> |
| 76 |
<title>Examples</title> |
| 77 |
<para> |
| 78 |
Here is an example of the vrandi opcode. It uses the file <ulink url="examples/vrandi.csd"><citetitle>vrandi.csd</citetitle></ulink>. |
| 79 |
<example> |
| 80 |
<title>Example of the vrandi opcode.</title> |
| 81 |
<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> |
| 82 |
<xi:include href="examples-xml/vrandi.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 83 |
</example> |
| 84 |
</para> |
| 85 |
</refsect1> |
| 86 |
|
| 87 |
<refsect1> |
| 88 |
<title>See also</title> |
| 89 |
<para><link linkend="vectorialrandom"><citetitle>Vectorial Random Signal Generators</citetitle></link></para> |
| 90 |
</refsect1> |
| 91 |
|
| 92 |
<refsect1> |
| 93 |
<title>Credits</title> |
| 94 |
<para>Written by Gabriel Maldonado.</para> |
| 95 |
<para>New in Csound 5 (Previously available only on CsoundAV)</para> |
| 96 |
</refsect1> |
| 97 |
</refentry> |