| 1 | |
| 2 | <refentry id="GEN07"> |
| 3 | <indexterm id="IndexGEN07"><primary>GEN07</primary></indexterm> |
| 4 | <refmeta> |
| 5 | <refentrytitle>GEN07</refentrytitle> |
| 6 | </refmeta> |
| 7 | |
| 8 | <refnamediv> |
| 9 | <refname>GEN07</refname> |
| 10 | <refpurpose> |
| 11 | Constructs functions from segments of straight lines. |
| 12 | </refpurpose> |
| 13 | </refnamediv> |
| 14 | |
| 15 | <refsect1> |
| 16 | <title>Description</title> |
| 17 | <para> |
| 18 | Constructs functions from segments of straight lines. |
| 19 | </para> |
| 20 | </refsect1> |
| 21 | |
| 22 | <refsect1> |
| 23 | <title>Syntax</title> |
| 24 | <synopsis><command>f</command> # time size 7 a n1 b n2 c ...</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>a, b, c,</emphasis> etc. -- ordinate values, in odd-numbered pfields p5, p7, p9, . . . |
| 35 | </para> |
| 36 | |
| 37 | <para> |
| 38 | <emphasis>n1, n2</emphasis>, etc. -- length of segment (no. of storage locations), in even-numbered pfields. Cannot be negative, but a zero is meaningful for specifying discontinuous waveforms (e.g. in the example below). The sum <emphasis>n1</emphasis> + <emphasis>n2</emphasis> + .... will normally equal <emphasis>size</emphasis> for fully specified functions. If the sum is smaller, the function locations not included will be set to zero; if the sum is greater, only the first <emphasis>size</emphasis> locations will be stored. |
| 39 | </para> |
| 40 | |
| 41 | <note> |
| 42 | <title>Note</title> |
| 43 | <para> |
| 44 | <itemizedlist> |
| 45 | <listitem> |
| 46 | <para> |
| 47 | If p4 is positive, functions are post-normalized (rescaled to a maximum absolute value of 1 after generation). A negative p4 will cause rescaling to be skipped. |
| 48 | </para> |
| 49 | </listitem> |
| 50 | |
| 51 | <listitem> |
| 52 | <para> |
| 53 | Discrete-point linear interpolation implies an increase or decrease along a segment by equal differences between adjacent locations; exponential interpolation implies that the progression is by equal ratio. In both forms the interpolation from <emphasis>a</emphasis> to <emphasis>b</emphasis> is such as to assume that the value <emphasis>b</emphasis> will be attained in the n + 1th location. For discontinuous functions, and for the segment encompassing the end location, this value will not actually be reached, although it may eventually appear as a result of final scaling. |
| 54 | </para> |
| 55 | </listitem> |
| 56 | </itemizedlist> |
| 57 | </para> |
| 58 | </note> |
| 59 | </refsect1> |
| 60 | |
| 61 | <refsect1> |
| 62 | <title>Examples</title> |
| 63 | <para> |
| 64 | Here is an example of the GEN07 routine. It uses the files <ulink url="examples/gen07.csd"><citetitle>gen07.csd</citetitle></ulink>. |
| 65 | <example> |
| 66 | <title>An example of the GEN07 routine.</title> |
| 67 | <xi:include href="examples-xml/gen07.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 68 | </example> |
| 69 | |
| 70 | <textobject> |
| 71 | <phrase>These are the diagrams of the waveforms of the GEN07 routines, as used in the example:</phrase> |
| 72 | </textobject> |
| 73 | |
| 74 | <mediaobject> |
| 75 | <imageobject> |
| 76 | <imagedata fileref="images/gen07_1.png" format="PNG"/> |
| 77 | </imageobject> |
| 78 | |
| 79 | <textobject> |
| 80 | <phrase>f 2 0 1024 7 0 512 1 0 -1 512 0 - sawtooth up and down, starting and ending at 0</phrase> |
| 81 | </textobject> |
| 82 | |
| 83 | <caption> |
| 84 | <para>f 2 0 1024 7 0 512 1 0 -1 512 0 - sawtooth up and down, starting and ending at 0</para> |
| 85 | </caption> |
| 86 | </mediaobject> |
| 87 | |
| 88 | <mediaobject> |
| 89 | <imageobject> |
| 90 | <imagedata fileref="images/gen07_2.png" format="PNG"/> |
| 91 | </imageobject> |
| 92 | |
| 93 | <textobject> |
| 94 | <phrase>f 3 0 1024 7 1 512 1 0 -1 512 -1 - a square from positive to negative</phrase> |
| 95 | </textobject> |
| 96 | |
| 97 | <caption> |
| 98 | <para>f 3 0 1024 7 1 512 1 0 -1 512 -1 - a square from positive to negative</para> |
| 99 | </caption> |
| 100 | </mediaobject> |
| 101 | |
| 102 | <mediaobject> |
| 103 | <imageobject> |
| 104 | <imagedata fileref="images/gen07_3.png" format="PNG"/> |
| 105 | </imageobject> |
| 106 | |
| 107 | <textobject> |
| 108 | <phrase>f 4 0 1024 7 1 1024 -1 - sawtooth down, a straight line from positive to negative</phrase> |
| 109 | </textobject> |
| 110 | |
| 111 | <caption> |
| 112 | <para>f 4 0 1024 7 1 1024 -1 - sawtooth down, a straight line from positive to negative</para> |
| 113 | </caption> |
| 114 | </mediaobject> |
| 115 | |
| 116 | </para> |
| 117 | </refsect1> |
| 118 | |
| 119 | <refsect1> |
| 120 | <title>See Also</title> |
| 121 | <para> |
| 122 | <link linkend="GEN05"><citetitle>GEN05</citetitle></link>, |
| 123 | <link linkend="GEN06"><citetitle>GEN06</citetitle></link>, and |
| 124 | <link linkend="GEN08"><citetitle>GEN08</citetitle></link> |
| 125 | </para> |
| 126 | </refsect1> |
| 127 | </refentry> |