| 1 | |
| 2 | <refentry id="GEN09"> |
| 3 | <indexterm id="IndexGEN09"><primary>GEN09</primary></indexterm> |
| 4 | <refmeta> |
| 5 | <refentrytitle>GEN09</refentrytitle> |
| 6 | </refmeta> |
| 7 | |
| 8 | <refnamediv> |
| 9 | <refname>GEN09</refname> |
| 10 | <refpurpose> |
| 11 | Generate composite waveforms made up of weighted sums of simple sinusoids. |
| 12 | </refpurpose> |
| 13 | </refnamediv> |
| 14 | |
| 15 | <refsect1> |
| 16 | <title>Description</title> |
| 17 | <para> |
| 18 | These subroutines generate composite waveforms made up of weighted sums of simple sinusoids. The specification of each contributing partial requires 3 p-fields using <emphasis>GEN09</emphasis>. |
| 19 | </para> |
| 20 | </refsect1> |
| 21 | |
| 22 | <refsect1> |
| 23 | <title>Syntax</title> |
| 24 | <synopsis><command>f</command> # time size 9 pna stra phsa pnb strb phsb ...</synopsis> |
| 25 | </refsect1> |
| 26 | |
| 27 | <refsect1> |
| 28 | <title>Initialization</title> |
| 29 | <para> |
| 30 | <emphasis>size</emphasis> -- number of points in the table. Must be a power of 2 or power-of-2 plus 1 (see <link linkend="f"><citetitle>f statement</citetitle></link>). |
| 31 | </para> |
| 32 | |
| 33 | <para> |
| 34 | <emphasis>pna, pnb</emphasis>, etc. -- partial no. (relative to a fundamental that would occupy <emphasis>size</emphasis> locations per cycle) of sinusoid a, sinusoid b, etc. Must be positive, but need not be a whole number, i.e., non-harmonic partials are permitted. Partials may be in any order. |
| 35 | </para> |
| 36 | |
| 37 | <para> |
| 38 | <emphasis>stra, strb</emphasis>, etc. -- strength of partials <emphasis>pna, pnb</emphasis>, etc. These are relative strengths, since the composite waveform may be rescaled later. Negative values are permitted and imply a 180 degree phase shift. |
| 39 | </para> |
| 40 | |
| 41 | <para> |
| 42 | <emphasis>phsa, phsb</emphasis>, etc. -- initial phase of partials <emphasis>pna, pnb,</emphasis> etc., expressed in degrees (0-360). |
| 43 | </para> |
| 44 | |
| 45 | <note> |
| 46 | <title>Note</title> |
| 47 | <para> |
| 48 | <itemizedlist> |
| 49 | <listitem> |
| 50 | <para> |
| 51 | These subroutines generate stored functions as sums of sinusoids of different frequencies. The two major restrictions on <emphasis>GEN10</emphasis> that the partials be harmonic and in phase do not apply to <emphasis>GEN09</emphasis> or <emphasis>GEN19</emphasis>. |
| 52 | </para> |
| 53 | |
| 54 | <para> |
| 55 | In each case the composite wave, once drawn, is then rescaled to unity if p4 was positive. A negative p4 will cause rescaling to be skipped. |
| 56 | </para> |
| 57 | </listitem> |
| 58 | </itemizedlist> |
| 59 | </para> |
| 60 | </note> |
| 61 | </refsect1> |
| 62 | |
| 63 | <refsect1> |
| 64 | <title>Examples</title> |
| 65 | <para> |
| 66 | Here is an example of the GEN09 routine. It uses the files <ulink url="examples/gen09.csd"><citetitle>gen09.csd</citetitle></ulink>. |
| 67 | |
| 68 | <example> |
| 69 | <title>Example of the GEN09 routine.</title> |
| 70 | <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> |
| 71 | <xi:include href="examples-xml/gen09.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 72 | </example> |
| 73 | |
| 74 | <textobject> |
| 75 | <phrase>These are the diagrams of the waveforms of the GEN09 routines, as used in the example:</phrase> |
| 76 | </textobject> |
| 77 | |
| 78 | <mediaobject> |
| 79 | <imageobject> |
| 80 | <imagedata fileref="images/gen09_1.png" format="PNG"/> |
| 81 | </imageobject> |
| 82 | |
| 83 | <textobject> |
| 84 | <phrase>gi1 ftgen 1,0,2^10,9, 1,3,0, 3,1,0, 9,0.333,180 - approximation of a square wave</phrase> |
| 85 | </textobject> |
| 86 | |
| 87 | <caption> |
| 88 | <para>gi1 ftgen 1,0,2^10,9, 1,3,0, 3,1,0, 9,0.333,180 - approximation of a square wave</para> |
| 89 | </caption> |
| 90 | </mediaobject> |
| 91 | |
| 92 | <mediaobject> |
| 93 | <imageobject> |
| 94 | <imagedata fileref="images/gen09_2.png" format="PNG"/> |
| 95 | </imageobject> |
| 96 | |
| 97 | <textobject> |
| 98 | <phrase>gi2 ftgen 2,0,2^10,9, 1,3,180, 3,1,0, 9,0.333,0 - same values as gi1, except phase value</phrase> |
| 99 | </textobject> |
| 100 | |
| 101 | <caption> |
| 102 | <para>gi2 ftgen 2,0,2^10,9, 1,3,180, 3,1,0, 9,0.333,0 - same values as gi1, except phase value</para> |
| 103 | </caption> |
| 104 | </mediaobject> |
| 105 | |
| 106 | <mediaobject> |
| 107 | <imageobject> |
| 108 | <imagedata fileref="images/gen09_3.png" format="PNG"/> |
| 109 | </imageobject> |
| 110 | |
| 111 | <textobject> |
| 112 | <phrase>gi3 ftgen 3,0,2^10,9, 1,2,0, 3,2,0, 9,0.333,180 - inharmonic partials, but with distortion due to the sudden jump in ending and beginning of the wave</phrase> |
| 113 | </textobject> |
| 114 | |
| 115 | <caption> |
| 116 | <para>gi3 ftgen 3,0,2^10,9, 1,2,0, 3,2,0, 9,0.333,180 - inharmonic partials, but with distortion due to the sudden jump in ending and beginning of the wave</para> |
| 117 | </caption> |
| 118 | </mediaobject> |
| 119 | |
| 120 | <mediaobject> |
| 121 | <imageobject> |
| 122 | <imagedata fileref="images/gen09_4.png" format="PNG"/> |
| 123 | </imageobject> |
| 124 | |
| 125 | <textobject> |
| 126 | <phrase>gi4 ftgen 4,0,2^10,9, 1,2,180, 3,2,0, 9,0.333,0 - same ratio as gi3, except with less artefacts</phrase> |
| 127 | </textobject> |
| 128 | |
| 129 | <caption> |
| 130 | <para>gi4 ftgen 4,0,2^10,9, 1,2,180, 3,2,0, 9,0.333,0 - same ratio as gi3, except with less artefacts</para> |
| 131 | </caption> |
| 132 | </mediaobject> |
| 133 | |
| 134 | </para> |
| 135 | </refsect1> |
| 136 | |
| 137 | <refsect1> |
| 138 | <title>See Also</title> |
| 139 | <para> |
| 140 | <link linkend="GEN10"><citetitle>GEN10</citetitle></link>, |
| 141 | <link linkend="GEN19"><citetitle>GEN19</citetitle></link> |
| 142 | </para> |
| 143 | </refsect1> |
| 144 | |
| 145 | </refentry> |