| 1 | |
| 2 | <refentry id="randomh"> |
| 3 | <indexterm id="IndexRandomh"><primary>randomh</primary></indexterm> |
| 4 | <refentryinfo><title>Signal Generators:Random (Noise) Generators</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>randomh</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>randomh</refname> |
| 11 | <refpurpose> |
| 12 | Generates random numbers with a user-defined limit and holds them for a period of time. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | Generates random numbers with a user-defined limit and holds them for a period of time. |
| 20 | </para> |
| 21 | </refsect1> |
| 22 | |
| 23 | <refsect1> |
| 24 | <title>Syntax</title> |
| 25 | <synopsis>ares <command>randomh</command> kmin, kmax, xcps [,imode] [,ifirstval]</synopsis> |
| 26 | |
| 27 | <synopsis>kres <command>randomh</command> kmin, kmax, kcps [,imode] [,ifirstval]</synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Initialization</title> |
| 32 | <para> |
| 33 | <emphasis>imode</emphasis> (optional, default=0) -- generation mode of the |
| 34 | first output value (see below) |
| 35 | </para> |
| 36 | |
| 37 | <para> |
| 38 | <emphasis>ifirstval</emphasis> (optional, default=0) -- first output value |
| 39 | </para> |
| 40 | </refsect1> |
| 41 | |
| 42 | <refsect1> |
| 43 | <title>Performance</title> |
| 44 | <para> |
| 45 | <emphasis>kmin</emphasis> -- minimum range limit |
| 46 | </para> |
| 47 | |
| 48 | <para> |
| 49 | <emphasis>kmax</emphasis> -- maximum range limit |
| 50 | </para> |
| 51 | |
| 52 | <para> |
| 53 | <emphasis>kcps, xcps</emphasis> -- rate of random break-point generation |
| 54 | </para> |
| 55 | |
| 56 | <para> |
| 57 | The <emphasis>randomh</emphasis> opcode is similar to <link linkend="randh"><citetitle>randh</citetitle></link> but allows the user to set arbitrary minimum and maximum values. |
| 58 | </para> |
| 59 | |
| 60 | <para> |
| 61 | When <emphasis>imode</emphasis> = 0 (the default), the <emphasis>kmin</emphasis> |
| 62 | argument value is outputted during <emphasis>1/kcps</emphasis> (resp. |
| 63 | <emphasis>1/xcps</emphasis>) seconds at the beginning of the note. Then, |
| 64 | the normal process takes place with a new random number generated and held |
| 65 | every <emphasis>1/kcps</emphasis> (resp. <emphasis>1/xcps</emphasis>) seconds. |
| 66 | </para> |
| 67 | |
| 68 | <para> |
| 69 | When <emphasis>imode</emphasis> = 2, the <emphasis>ifirstval</emphasis> |
| 70 | argument value is outputted during <emphasis>1/kcps</emphasis> (resp. |
| 71 | <emphasis>1/xcps</emphasis>) seconds at the beginning of the note. Then, |
| 72 | the normal process takes place with a new random number generated and held |
| 73 | every <emphasis>1/kcps</emphasis> (resp. <emphasis>1/xcps</emphasis>) seconds. |
| 74 | </para> |
| 75 | |
| 76 | <para> |
| 77 | When <emphasis>imode</emphasis> = 3, the generation process begins with a |
| 78 | random value from the initialization time. |
| 79 | </para> |
| 80 | </refsect1> |
| 81 | |
| 82 | <refsect1> |
| 83 | <title>Examples</title> |
| 84 | <para> |
| 85 | Here is an example of the randomh opcode. It uses the file <ulink url="examples/randomh.csd"><citetitle>randomh.csd</citetitle></ulink>. |
| 86 | |
| 87 | <example> |
| 88 | <title>Example of the randomh opcode.</title> |
| 89 | |
| 90 | <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> |
| 91 | <xi:include href="examples-xml/randomh.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 92 | </example> |
| 93 | |
| 94 | Its output should include lines like this: |
| 95 | <screen> |
| 96 | Mode: 0 |
| 97 | i1 220.00000 |
| 98 | i1 396.26079 |
| 99 | i1 240.75446 |
| 100 | i1 364.24577 |
| 101 | ... |
| 102 | |
| 103 | Mode: 2 |
| 104 | i1 330.00000 |
| 105 | i1 416.50935 |
| 106 | i1 356.11619 |
| 107 | i1 433.59324 |
| 108 | ... |
| 109 | |
| 110 | Mode: 3 |
| 111 | i1 261.17741 |
| 112 | i1 402.00891 |
| 113 | i1 393.86592 |
| 114 | i1 307.19839 |
| 115 | ...</screen> |
| 116 | <para> |
| 117 | Two musical examples featuring the randomh opcode: |
| 118 | <ulink url="examples/musical/FtmorfRandomh_Cucchi.csd"><citetitle>FtmorfRandomh_Cucchi.csd</citetitle></ulink> and |
| 119 | <ulink url="examples/musical/Ftmorf_Cucchi.csd"><citetitle>Ftmorf_Cucchi.csd</citetitle></ulink>, |
| 120 | both by Stefano Cucchi. |
| 121 | </para> |
| 122 | </para> |
| 123 | </refsect1> |
| 124 | |
| 125 | <refsect1> |
| 126 | <title>See also</title> |
| 127 | <para><link linkend="SiggenNoise"><citetitle>Random (Noise) Generators</citetitle></link> |
| 128 | </para> |
| 129 | </refsect1> |
| 130 | |
| 131 | <refsect1> |
| 132 | <title>Credits</title> |
| 133 | <para>Author: &namegabriel;</para> |
| 134 | <para>Arguments <emphasis>imode</emphasis> and <emphasis>ifirstval</emphasis> |
| 135 | added by &namepinot;, Jan. 2011, after a discussion with Peiman Khosravi on |
| 136 | the csnd list.</para> |
| 137 | </refsect1> |
| 138 | </refentry> |