| 1 | |
| 2 | <refentry id="gauss"> |
| 3 | <indexterm id="IndexGaussXClass"><primary>x-class noise generators</primary></indexterm> |
| 4 | |
| 5 | <indexterm id="IndexGauss"><primary>gauss</primary></indexterm> |
| 6 | <refentryinfo><title>Signal Generators:Random (Noise) Generators</title></refentryinfo> |
| 7 | <refmeta> |
| 8 | <refentrytitle>gauss</refentrytitle> |
| 9 | </refmeta> |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>gauss</refname> |
| 13 | <refpurpose> |
| 14 | Gaussian distribution random number generator. |
| 15 | </refpurpose> |
| 16 | </refnamediv> |
| 17 | |
| 18 | <refsect1> |
| 19 | <title>Description</title> |
| 20 | <para> |
| 21 | Gaussian distribution random number generator. This is an x-class noise generator. |
| 22 | </para> |
| 23 | </refsect1> |
| 24 | |
| 25 | <refsect1> |
| 26 | <title>Syntax</title> |
| 27 | <synopsis>ares <command>gauss</command> krange</synopsis> |
| 28 | |
| 29 | <synopsis>ires <command>gauss</command> irange</synopsis> |
| 30 | |
| 31 | <synopsis>kres <command>gauss</command> krange</synopsis> |
| 32 | |
| 33 | <synopsis>ares <command>gauss</command> kmean, ksdev</synopsis> |
| 34 | |
| 35 | <synopsis>ires <command>gauss</command> imean, isdev</synopsis> |
| 36 | |
| 37 | <synopsis>kres <command>gauss</command> kmean, ksdev</synopsis> |
| 38 | |
| 39 | |
| 40 | </refsect1> |
| 41 | |
| 42 | <refsect1> |
| 43 | <title>Performance</title> |
| 44 | <para> |
| 45 | <emphasis>krange</emphasis> -- the range of the random numbers (-<emphasis>krange</emphasis> to +<emphasis>krange</emphasis>). Outputs both positive and negative numbers. |
| 46 | </para> |
| 47 | <para> |
| 48 | <emphasis>kmean</emphasis> -- normal distribution mean. |
| 49 | </para> |
| 50 | <para> |
| 51 | <emphasis>ksdev</emphasis> -- normal distribution standard deviation. |
| 52 | </para> |
| 53 | <para> |
| 54 | The first version of <emphasis>gauss</emphasis> returns random numbers following a normal distribution centered around 0.0 (mu = 0.0) with a variance (sigma) of <emphasis>krange</emphasis> / 3.83. Thus more than 99.99% |
| 55 | of the random values generated are in the range -<emphasis>krange</emphasis> to +<emphasis>krange</emphasis>. If a mean value different of 0.0 is desired, this mean value has to |
| 56 | be added to the generated numbers (see example below). |
| 57 | </para> |
| 58 | |
| 59 | <para> |
| 60 | The second version takes mean and standard deviation as |
| 61 | parameters. They use the more mathematically sound Box-Muller |
| 62 | algorithm to compute the normal distribution. |
| 63 | </para> |
| 64 | |
| 65 | <para> |
| 66 | For more detailed explanation of these distributions, see: |
| 67 | <orderedlist> |
| 68 | <listitem> |
| 69 | <para>C. Dodge - T.A. Jerse 1985. Computer music. Schirmer books. pp.265 - 286</para> |
| 70 | </listitem> |
| 71 | |
| 72 | <listitem> |
| 73 | <para>D. Lorrain. A panoply of stochastic cannons. In C. Roads, ed. 1989. Music machine . Cambridge, Massachusetts: MIT press, pp. 351 - 379.</para> |
| 74 | </listitem> |
| 75 | </orderedlist> |
| 76 | </para> |
| 77 | </refsect1> |
| 78 | |
| 79 | <refsect1> |
| 80 | <title>Examples</title> |
| 81 | <para> |
| 82 | Here is an example of the gauss opcode. It uses the file <ulink url="examples/gauss.csd"><citetitle>gauss.csd</citetitle></ulink>. |
| 83 | |
| 84 | <example> |
| 85 | <title>Example of the gauss opcode.</title> |
| 86 | <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> |
| 87 | <xi:include href="examples-xml/gauss.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 88 | </example> |
| 89 | |
| 90 | Its output should include lines like this: |
| 91 | <screen> |
| 92 | mean = 0.000, std = 0.260, samples inside the given range: 99.993% |
| 93 | mean = 0.005, std = 0.999, samples inside the given range: 99.998% |
| 94 | mean = 2.700, std = 1.497, samples inside the given range: 100.000%</screen> |
| 95 | </para> |
| 96 | </refsect1> |
| 97 | |
| 98 | <refsect1> |
| 99 | <title>See also</title> |
| 100 | <para><link linkend="SiggenNoise"><citetitle>Random (Noise) Generators</citetitle></link></para> |
| 101 | </refsect1> |
| 102 | |
| 103 | <refsect1> |
| 104 | <title>Credits</title> |
| 105 | <para> |
| 106 | <simplelist> |
| 107 | <member>Author (first version): &nameparis; </member> |
| 108 | <member>MIT, Cambridge</member> |
| 109 | <member>1995</member> |
| 110 | <member>Author (second version): Victor Lazzarini</member> |
| 111 | <member>Maynooth University, Ireland</member> |
| 112 | <member>2020</member> |
| 113 | </simplelist> |
| 114 | </para> |
| 115 | <para>Precisions about mu and sigma added by &namepinot; after a discussion with |
| 116 | Joachim Heintz on the Csound List, December 2010.</para> |
| 117 | <para>Example written by &namepinot;, adapted from a csd file by Joachim Heintz, December 2010.</para> |
| 118 | <para>Existed in 3.30</para> |
| 119 | </refsect1> |
| 120 | </refentry> |