| 1 | |
| 2 | <refentry id="GEN42"> |
| 3 | <indexterm id="IndexGEN42"><primary>GEN42</primary></indexterm> |
| 4 | <refmeta> |
| 5 | <refentrytitle>GEN42</refentrytitle> |
| 6 | </refmeta> |
| 7 | |
| 8 | <refnamediv> |
| 9 | <refname>GEN42</refname> |
| 10 | <refpurpose> |
| 11 | Generates a random distribution of discrete ranges of values. |
| 12 | </refpurpose> |
| 13 | </refnamediv> |
| 14 | |
| 15 | <refsect1> |
| 16 | <title>Description</title> |
| 17 | <para> |
| 18 | Generates a random distribution function of discrete ranges of values by giving a list of groups of three numbers. |
| 19 | </para> |
| 20 | </refsect1> |
| 21 | |
| 22 | <refsect1> |
| 23 | <title>Syntax</title> |
| 24 | <synopsis><command>f</command> # time size -42 min1 max1 prob1 min2 max2 prob2 min3 max3 prob3 ... minN maxN probN</synopsis> |
| 25 | </refsect1> |
| 26 | |
| 27 | <refsect1> |
| 28 | <title>Performance</title> |
| 29 | <para> |
| 30 | The first number of each group is a the minimum value of the range, the second is the maximum value and the third is the probability of that an element belonging to that range of values can be chosen by a random algorithm. Probabilities for a range should be a fraction of 1, and the sum of the probabilities for all the ranges should total 1.0. |
| 31 | </para> |
| 32 | |
| 33 | <para> |
| 34 | This subroutine is designed to be used together with duserrnd and <link linkend="urd"><citetitle>urd</citetitle></link> opcodes (see <link linkend="duserrnd">duserrnd</link> for more information). Since both duserrnd and urd do not use any interpolation, it is suggested to give a size reasonably big. |
| 35 | </para> |
| 36 | </refsect1> |
| 37 | |
| 38 | <refsect1> |
| 39 | <title>Examples</title> |
| 40 | <para> |
| 41 | Here is an example of the GEN42 generator. It uses the file <ulink url="examples/gen42.csd"><citetitle>gen42.csd</citetitle></ulink>. |
| 42 | <example> |
| 43 | <title>Example of the GEN42 generator.</title> |
| 44 | <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> |
| 45 | <xi:include href="examples-xml/gen42.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 46 | </example> |
| 47 | Its output should include lines like these: |
| 48 | <screen> |
| 49 | i1 184.61538 |
| 50 | i1 130.76923 |
| 51 | i1 169.23077 |
| 52 | i1 12.00000 |
| 53 | ....... |
| 54 | |
| 55 | WARNING: Seeding from current time 3751086165 |
| 56 | |
| 57 | i2 138.46154 |
| 58 | i2 12.00000 |
| 59 | i2 123.07692 |
| 60 | i2 161.53846 |
| 61 | i2 123.07692 |
| 62 | i2 153.84615 |
| 63 | ...... |
| 64 | </screen> |
| 65 | |
| 66 | <textobject> |
| 67 | <phrase>This is the diagram of the waveform of the GEN42 routine, as used in the example:</phrase> |
| 68 | </textobject> |
| 69 | <para> |
| 70 | </para> |
| 71 | <mediaobject> |
| 72 | <imageobject> |
| 73 | <imagedata fileref="images/gen42.png" format="PNG"/> |
| 74 | </imageobject> |
| 75 | |
| 76 | <textobject> |
| 77 | <phrase> f 1 0 -20 -42 10 20 .3 100 200 .7</phrase> |
| 78 | </textobject> |
| 79 | |
| 80 | <caption> |
| 81 | <para> f 1 0 -20 -42 10 20 .3 100 200 .7</para> |
| 82 | </caption> |
| 83 | </mediaobject> |
| 84 | </para> |
| 85 | </refsect1> |
| 86 | |
| 87 | <refsect1> |
| 88 | <title>Credits</title> |
| 89 | <para>Author: &namegabriel;</para> |
| 90 | </refsect1> |
| 91 | </refentry> |