| 1 | |
| 2 | <refentry id="GEN40"> |
| 3 | <indexterm id="IndexGEN40"><primary>GEN40</primary></indexterm> |
| 4 | <refmeta> |
| 5 | <refentrytitle>GEN40</refentrytitle> |
| 6 | </refmeta> |
| 7 | |
| 8 | <refnamediv> |
| 9 | <refname>GEN40</refname> |
| 10 | <refpurpose> |
| 11 | Generates a random distribution using a distribution histogram. |
| 12 | </refpurpose> |
| 13 | </refnamediv> |
| 14 | |
| 15 | <refsect1> |
| 16 | <title>Description</title> |
| 17 | <para> |
| 18 | Generates a continuous random distribution function starting from the shape of a user-defined distribution histogram. |
| 19 | </para> |
| 20 | </refsect1> |
| 21 | |
| 22 | <refsect1> |
| 23 | <title>Syntax</title> |
| 24 | <synopsis><command>f</command> # time size 40 shapetab</synopsis> |
| 25 | </refsect1> |
| 26 | |
| 27 | <refsect1> |
| 28 | <title>Performance</title> |
| 29 | <para> |
| 30 | The shape of histogram must be stored in a previously defined table, in fact shapetab argument must be filled with the number of such table. |
| 31 | </para> |
| 32 | |
| 33 | <para> |
| 34 | Histogram shape can be generated with any other GEN routines. Since no interpolation is used when <link linkend="GEN40">GEN40</link> processes the translation, it is suggested that the size of the table containing the histogram shape to be reasonably big, in order to obtain more precision (however after the processing the shaping-table can be destroyed in order to re-gain memory). |
| 35 | </para> |
| 36 | |
| 37 | <para> |
| 38 | This subroutine is designed to be used together with cuserrnd opcode (see <link linkend="cuserrnd">cuserrnd</link> for more information). |
| 39 | </para> |
| 40 | </refsect1> |
| 41 | |
| 42 | <refsect1> |
| 43 | <title>Examples</title> |
| 44 | <para> |
| 45 | Here is an example of the GEN40 generator. It uses the file <ulink url="examples/gen40.csd"><citetitle>gen40.csd</citetitle></ulink>. |
| 46 | <example> |
| 47 | <title>Example of the GEN40 generator.</title> |
| 48 | <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> |
| 49 | <xi:include href="examples-xml/gen40.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 50 | </example> |
| 51 | Its output should include lines like these: |
| 52 | <screen> |
| 53 | i 1 time 0.00067: 53.14918 |
| 54 | i 1 time 0.20067: 0.00000 |
| 55 | i 1 time 0.40067: 0.00000 |
| 56 | i 1 time 0.60067: 96.80406 |
| 57 | i 1 time 0.80067: 94.20729 |
| 58 | i 1 time 1.00000: 0.00000 |
| 59 | i 1 time 1.20067: 86.13032 |
| 60 | i 1 time 1.40067: 31.37096 |
| 61 | i 1 time 1.60067: 70.35889 |
| 62 | i 1 time 1.80000: 0.00000 |
| 63 | i 1 time 2.00000: 49.18914 |
| 64 | |
| 65 | WARNING: Seeding from current time 2006647442 |
| 66 | |
| 67 | i 2 time 3.00067: 21.45002 |
| 68 | i 2 time 3.20067: 44.32333 |
| 69 | i 2 time 3.40067: 46.05420 |
| 70 | i 2 time 3.60000: 0.00000 |
| 71 | i 2 time 3.80067: 41.32175 |
| 72 | i 2 time 4.00000: 0.00000 |
| 73 | i 2 time 4.20000: 63.72019 |
| 74 | i 2 time 4.40067: 0.00000 |
| 75 | i 2 time 4.60067: 0.00000 |
| 76 | i 2 time 4.80067: 0.00000 |
| 77 | i 2 time 5.00000: 74.49330 |
| 78 | </screen> |
| 79 | |
| 80 | <textobject> |
| 81 | <phrase>This is the diagram of the waveform of the GEN40 routine, as used in the example:</phrase> |
| 82 | </textobject> |
| 83 | <para> |
| 84 | </para> |
| 85 | <mediaobject> |
| 86 | <imageobject> |
| 87 | <imagedata fileref="images/gen40.png" format="PNG"/> |
| 88 | </imageobject> |
| 89 | |
| 90 | <textobject> |
| 91 | <phrase>f 2 0 16384 40 1</phrase> |
| 92 | </textobject> |
| 93 | |
| 94 | <caption> |
| 95 | <para>f 2 0 16384 40 1</para> |
| 96 | </caption> |
| 97 | </mediaobject> |
| 98 | |
| 99 | </para> |
| 100 | </refsect1> |
| 101 | |
| 102 | <refsect1> |
| 103 | <title>Credits</title> |
| 104 | <para>Author: &namegabriel;</para> |
| 105 | </refsect1> |
| 106 | </refentry> |