| 1 | |
| 2 | <refentry id="GEN13"> |
| 3 | <indexterm id="IndexGEN13"><primary>GEN13</primary></indexterm> |
| 4 | <refmeta> |
| 5 | <refentrytitle>GEN13</refentrytitle> |
| 6 | </refmeta> |
| 7 | |
| 8 | <refnamediv> |
| 9 | <refname>GEN13</refname> |
| 10 | <refpurpose> |
| 11 | Stores a polynomial whose coefficients derive from the Chebyshev polynomials of the first kind. |
| 12 | </refpurpose> |
| 13 | </refnamediv> |
| 14 | |
| 15 | <refsect1> |
| 16 | <title>Description</title> |
| 17 | <para> |
| 18 | Uses Chebyshev coefficients to generate stored polynomial functions which, under waveshaping, can be used to split a sinusoid into harmonic partials having a pre-definable spectrum. |
| 19 | </para> |
| 20 | </refsect1> |
| 21 | |
| 22 | <refsect1> |
| 23 | <title>Syntax</title> |
| 24 | <synopsis><command>f</command> # time size 13 xint xamp h0 h1 h2 ...</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 a power-of-2 plus 1 (see <link linkend="f"><citetitle>f statement</citetitle></link>). The normal value is power-of-2 plus 1. |
| 31 | </para> |
| 32 | |
| 33 | <para> |
| 34 | <emphasis>xint</emphasis> -- provides the left and right values [<emphasis>-xint, +xint</emphasis>] of the x interval over which the polynomial is to be drawn. These subroutines both call <link linkend="GEN03"><citetitle>GEN03</citetitle></link> to draw their functions; the p5 value here is therefor expanded to a negative-positive p5, p6 pair before <emphasis>GEN03</emphasis> is actually called. The normal value is 1. |
| 35 | </para> |
| 36 | |
| 37 | <para> |
| 38 | <emphasis>xamp </emphasis> -- amplitude scaling factor of the sinusoid input that is expected to produce the following spectrum. |
| 39 | </para> |
| 40 | |
| 41 | <para> |
| 42 | <emphasis>h0, h1, h2,</emphasis> etc. -- relative strength of partials 0 (DC), 1 (fundamental), 2 ... that will result when a sinusoid of amplitude |
| 43 | |
| 44 | <literallayout> |
| 45 | xamp * int(size/2)/xint |
| 46 | </literallayout> |
| 47 | |
| 48 | is waveshaped using this function table. These values thus describe a frequency spectrum associated with a particular factor <emphasis>xamp</emphasis> of the input signal. |
| 49 | </para> |
| 50 | |
| 51 | <para> |
| 52 | <emphasis>GEN13</emphasis> is the function generator normally employed in standard waveshaping. It stores a polynomial whose coefficients derive from the Chebyshev polynomials of the first kind, so that a driving sinusoid of strength <emphasis>xamp</emphasis> will exhibit the specified spectrum at output. Note that the evolution of this spectrum is generally not linear with varying <emphasis>xamp</emphasis>. However, it is bandlimited (the only partials to appear will be those specified at generation time); and the partials will tend to occur and to develop in ascending order (the lower partials dominating at low <emphasis>xamp</emphasis>, and the spectral richness increasing for higher values of <emphasis>xamp</emphasis>). A negative <emphasis>hn</emphasis> value implies a 180 degree phase shift of that partial; the requested full-amplitude spectrum will not be affected by this shift, although the evolution of several of its component partials may be. The pattern +,+,-,-,+,+,... for <emphasis>h0,h1,h2..</emphasis>. will minimize the normalization problem for low <emphasis>xamp</emphasis> values (see above), but does not necessarily provide the smoothest pattern of evolution. |
| 53 | </para> |
| 54 | </refsect1> |
| 55 | |
| 56 | <refsect1> |
| 57 | <title>Examples</title> |
| 58 | <para> |
| 59 | Here is an example of the GEN13 generator. It uses the file <ulink url="examples/gen13.csd"><citetitle>gen13.csd</citetitle></ulink>. |
| 60 | <example> |
| 61 | <title>Example of the GEN13 generator.</title> |
| 62 | <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> |
| 63 | <xi:include href="examples-xml/gen13.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 64 | </example> |
| 65 | <textobject> |
| 66 | <phrase>These are the diagrams of the waveforms of the GEN13 routines, as used in the example:</phrase> |
| 67 | </textobject> |
| 68 | |
| 69 | <mediaobject> |
| 70 | <imageobject> |
| 71 | <imagedata fileref="images/gen13_1.png" format="PNG"/> |
| 72 | </imageobject> |
| 73 | |
| 74 | <textobject> |
| 75 | <phrase>f1 0 513 13 1 1 0 100 -50 -33 25 20 -16.7 -14.2 12.5 11.1 -10 -9.09 8.333 7.69 -7.14 -6.67 6.25 5.88 -5.55 -5.26 5 - quasi sawtooth transfer function</phrase> |
| 76 | </textobject> |
| 77 | |
| 78 | <caption> |
| 79 | <para>f1 0 513 13 1 1 0 100 -50 -33 25 20 -16.7 -14.2 12.5 11.1 -10 -9.09 8.333 7.69 -7.14 -6.67 6.25 5.88 -5.55 -5.26 5 - quasi sawtooth transfer function</para> |
| 80 | </caption> |
| 81 | </mediaobject> |
| 82 | |
| 83 | <mediaobject> |
| 84 | <imageobject> |
| 85 | <imagedata fileref="images/gen13_2.png" format="PNG"/> |
| 86 | </imageobject> |
| 87 | |
| 88 | <textobject> |
| 89 | <phrase>f3 0 513 13 1 1 0 100 0 -33 0 20 0 -14.2 0 11.1 0 -9.09 0 7.69 0 -6.67 0 5.88 0 -5.26 - quasi square wave transfer function</phrase> |
| 90 | </textobject> |
| 91 | |
| 92 | <caption> |
| 93 | <para>f3 0 513 13 1 1 0 100 0 -33 0 20 0 -14.2 0 11.1 0 -9.09 0 7.69 0 -6.67 0 5.88 0 -5.26 - quasi square wave transfer function</para> |
| 94 | </caption> |
| 95 | </mediaobject> |
| 96 | |
| 97 | <mediaobject> |
| 98 | <imageobject> |
| 99 | <imagedata fileref="images/gen13_3.png" format="PNG"/> |
| 100 | </imageobject> |
| 101 | |
| 102 | <textobject> |
| 103 | <phrase>f5 0 513 13 1 1 0 100 0 -11.11 0 4 0 -2.04 0 1.23 0 -.826 0 .59 0 -.444 0 .346 0 -.277 - quasi triangle wave transfer function</phrase> |
| 104 | </textobject> |
| 105 | |
| 106 | <caption> |
| 107 | <para>f5 0 513 13 1 1 0 100 0 -11.11 0 4 0 -2.04 0 1.23 0 -.826 0 .59 0 -.444 0 .346 0 -.277 - quasi triangle wave transfer function</para> |
| 108 | </caption> |
| 109 | </mediaobject> |
| 110 | |
| 111 | <mediaobject> |
| 112 | <imageobject> |
| 113 | <imagedata fileref="images/gen13_4.png" format="PNG"/> |
| 114 | </imageobject> |
| 115 | |
| 116 | <textobject> |
| 117 | <phrase>f7 0 513 13 1 1 0 1 -.8 0 .6 0 0 0 .4 0 0 0 0 .1 -.2 -.3 .5 - transfer function 1</phrase> |
| 118 | </textobject> |
| 119 | |
| 120 | <caption> |
| 121 | <para>f7 0 513 13 1 1 0 1 -.8 0 .6 0 0 0 .4 0 0 0 0 .1 -.2 -.3 .5 - transfer function 1</para> |
| 122 | </caption> |
| 123 | </mediaobject> |
| 124 | |
| 125 | <mediaobject> |
| 126 | <imageobject> |
| 127 | <imagedata fileref="images/gen13_5.png" format="PNG"/> |
| 128 | </imageobject> |
| 129 | |
| 130 | <textobject> |
| 131 | <phrase>f9 0 513 13 1 1 0 0 0 -.1 0 .3 0 -.5 0 .7 0 -.9 0 1 0 -1 0 - transfer function 2</phrase> |
| 132 | </textobject> |
| 133 | |
| 134 | <caption> |
| 135 | <para>f9 0 513 13 1 1 0 0 0 -.1 0 .3 0 -.5 0 .7 0 -.9 0 1 0 -1 0 - transfer function 2</para> |
| 136 | </caption> |
| 137 | </mediaobject> |
| 138 | |
| 139 | <mediaobject> |
| 140 | <imageobject> |
| 141 | <imagedata fileref="images/gen13_6.png" format="PNG"/> |
| 142 | </imageobject> |
| 143 | |
| 144 | <textobject> |
| 145 | <phrase>f11 0 513 13 1 1 0 0 0 0 0 0 0 -1 0 1 0 0 -.1 0 .1 0 -.2 .3 0 -.7 0 .2 0 -.1 - transfer function 3</phrase> |
| 146 | </textobject> |
| 147 | |
| 148 | <caption> |
| 149 | <para>f11 0 513 13 1 1 0 0 0 0 0 0 0 -1 0 1 0 0 -.1 0 .1 0 -.2 .3 0 -.7 0 .2 0 -.1 - transfer function 3</para> |
| 150 | </caption> |
| 151 | </mediaobject> |
| 152 | |
| 153 | <mediaobject> |
| 154 | <imageobject> |
| 155 | <imagedata fileref="images/gen13_7.png" format="PNG"/> |
| 156 | </imageobject> |
| 157 | |
| 158 | <textobject> |
| 159 | <phrase>f13 0 513 13 1 1 0 5 0 3 0 1 - split a sinusoid into 3 odd-harmonic partials of relative strength 5:3:1</phrase> |
| 160 | </textobject> |
| 161 | |
| 162 | <caption> |
| 163 | <para>f13 0 513 13 1 1 0 5 0 3 0 1 - split a sinusoid into 3 odd-harmonic partials of relative strength 5:3:1</para> |
| 164 | </caption> |
| 165 | </mediaobject> |
| 166 | |
| 167 | </para> |
| 168 | </refsect1> |
| 169 | |
| 170 | <refsect1> |
| 171 | <title>See Also</title> |
| 172 | <para> |
| 173 | <link linkend="GEN03"><citetitle>GEN03</citetitle></link>, |
| 174 | <link linkend="GEN14"><citetitle>GEN14</citetitle></link>, and |
| 175 | <link linkend="GEN15"><citetitle>GEN15</citetitle></link>. |
| 176 | <para> Information about the Chebyshev polynomials on Wikipedia: <ulink url="http://en.wikipedia.org/wiki/Chebyshev_polynomials"><citetitle>http://en.wikipedia.org/wiki/Chebyshev_polynomials</citetitle></ulink></para> |
| 177 | </para> |
| 178 | </refsect1> |
| 179 | </refentry> |