| 1 | |
| 2 | <refentry id="GEN20"> |
| 3 | <indexterm id="IndexGEN20"><primary>GEN20</primary></indexterm> |
| 4 | <refmeta> |
| 5 | <refentrytitle>GEN20</refentrytitle> |
| 6 | </refmeta> |
| 7 | |
| 8 | <refnamediv> |
| 9 | <refname>GEN20</refname> |
| 10 | <refpurpose> |
| 11 | Generates functions of different windows. |
| 12 | </refpurpose> |
| 13 | </refnamediv> |
| 14 | |
| 15 | <refsect1> |
| 16 | <title>Description</title> |
| 17 | <para> |
| 18 | This subroutine generates functions of different windows. These windows are usually used for spectrum analysis or for grain envelopes. |
| 19 | </para> |
| 20 | </refsect1> |
| 21 | |
| 22 | <refsect1> |
| 23 | <title>Syntax</title> |
| 24 | <synopsis><command>f</command> # time size 20 window max [opt]</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 ( + 1). |
| 31 | </para> |
| 32 | |
| 33 | <para> |
| 34 | <emphasis>window</emphasis> -- Type of window to generate: |
| 35 | |
| 36 | <itemizedlist> |
| 37 | <listitem> |
| 38 | <para>1 = Hamming</para> |
| 39 | </listitem> |
| 40 | <listitem> |
| 41 | <para>2 = Hanning</para> |
| 42 | </listitem> |
| 43 | <listitem> |
| 44 | <para>3 = Bartlett ( triangle)</para> |
| 45 | </listitem> |
| 46 | <listitem> |
| 47 | <para>4 = Blackman ( 3-term)</para> |
| 48 | </listitem> |
| 49 | <listitem> |
| 50 | <para>5 = Blackman - Harris ( 4-term)</para> |
| 51 | </listitem> |
| 52 | <listitem> |
| 53 | <para>6 = Gaussian</para> |
| 54 | </listitem> |
| 55 | <listitem> |
| 56 | <para>7 = Kaiser</para> |
| 57 | </listitem> |
| 58 | <listitem> |
| 59 | <para>8 = Rectangle</para> |
| 60 | </listitem> |
| 61 | <listitem> |
| 62 | <para>9 = Sinc</para> |
| 63 | </listitem> |
| 64 | </itemizedlist> |
| 65 | </para> |
| 66 | |
| 67 | <para> |
| 68 | <emphasis>max</emphasis> -- For negative p4 this will be the absolute |
| 69 | value at window peak point. If p4 is positive or p4 is negative |
| 70 | and p6 is missing the table will be post-rescaled to a maximum |
| 71 | value of 1. |
| 72 | </para> |
| 73 | |
| 74 | <para> |
| 75 | <emphasis>opt</emphasis> -- Optional argument required by the |
| 76 | Gaussian window, the Kaiser window and the Sinc window. |
| 77 | </para> |
| 78 | </refsect1> |
| 79 | |
| 80 | <refsect1> |
| 81 | <title>Examples</title> |
| 82 | <para> |
| 83 | <informalexample> |
| 84 | <programlisting> |
| 85 | <emphasis role="stamnt">f</emphasis> 1 0 1024 20 5</programlisting> |
| 86 | </informalexample> |
| 87 | |
| 88 | This creates a function which contains a 4 - term Blackman - Harris window with maximum value of 1. |
| 89 | </para> |
| 90 | |
| 91 | <para> |
| 92 | <informalexample> |
| 93 | <programlisting> |
| 94 | <emphasis role="stamnt">f</emphasis> 1 0 1024 -20 2 456</programlisting> |
| 95 | </informalexample> |
| 96 | |
| 97 | This creates a function that contains a Hanning window with a maximum value of 456. |
| 98 | </para> |
| 99 | |
| 100 | <para> |
| 101 | <informalexample> |
| 102 | <programlisting> |
| 103 | <emphasis role="stamnt">f</emphasis> 1 0 1024 -20 1</programlisting> |
| 104 | </informalexample> |
| 105 | |
| 106 | This creates a function that contains a Hamming window with a maximum value of 1. |
| 107 | </para> |
| 108 | |
| 109 | <para> |
| 110 | <informalexample> |
| 111 | <programlisting> |
| 112 | <emphasis role="stamnt">f</emphasis> 1 0 1024 20 7 1 2</programlisting> |
| 113 | </informalexample> |
| 114 | |
| 115 | This creates a function that contains a Kaiser window with a maximum value of 1. The extra argument specifies how "open" the window is, for example a value of 0 results in a rectangular window and a value of 10 in a Hamming like window. |
| 116 | </para> |
| 117 | |
| 118 | <para> |
| 119 | <informalexample> |
| 120 | <programlisting> |
| 121 | <emphasis role="stamnt">f</emphasis> 1 0 1024 20 6 1 2</programlisting> |
| 122 | </informalexample> |
| 123 | |
| 124 | This creates a function that contains a Gaussian window with a |
| 125 | maximum value of 1. The extra argument specifies how broad the |
| 126 | window is, as the standard deviation of the curve; in this |
| 127 | example the s.d. is 2. The default value is 1. |
| 128 | </para> |
| 129 | |
| 130 | <para> |
| 131 | <informalexample> |
| 132 | <programlisting> |
| 133 | <emphasis role="stamnt">f</emphasis> 1 0 1024 20 9 1 3</programlisting> |
| 134 | </informalexample> |
| 135 | |
| 136 | This creates a function that contains a Sinc window with a |
| 137 | maximum value of 1. The extra argument specifies the range of the function as multiple of π. The default value is 1. |
| 138 | </para> |
| 139 | |
| 140 | <para> |
| 141 | For all diagrams, see <link linkend="MiscWindows"><citetitle>Window Functions</citetitle></link> |
| 142 | </para> |
| 143 | |
| 144 | <para> |
| 145 | Here is an example of the GEN20 routine. It uses the file <ulink url="examples/gen20.csd"><citetitle>gen20.csd</citetitle></ulink>. |
| 146 | |
| 147 | <example> |
| 148 | <title>Example of the GEN20 routine.</title> |
| 149 | <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> |
| 150 | <xi:include href="examples-xml/gen20.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 151 | </example> |
| 152 | <textobject> |
| 153 | <phrase>These are the diagrams of the waveforms of the GEN20 routines, as used in the example:</phrase> |
| 154 | </textobject> |
| 155 | |
| 156 | <mediaobject> |
| 157 | <imageobject> |
| 158 | <imagedata fileref="images/gen20_1.png" format="PNG"/> |
| 159 | </imageobject> |
| 160 | |
| 161 | <textobject> |
| 162 | <phrase> f 1 0 512 20 2 - Hanning window</phrase> |
| 163 | </textobject> |
| 164 | |
| 165 | |
| 166 | <caption> |
| 167 | <para> f 1 0 512 20 2 - Hanning window</para> |
| 168 | </caption> |
| 169 | </mediaobject> |
| 170 | |
| 171 | <mediaobject> |
| 172 | <imageobject> |
| 173 | <imagedata fileref="images/gen20_2.png" format="PNG"/> |
| 174 | </imageobject> |
| 175 | |
| 176 | <textobject> |
| 177 | <phrase> f 2 0 512 20 6 1 - Gaussian window</phrase> |
| 178 | </textobject> |
| 179 | |
| 180 | <caption> |
| 181 | <para> f 2 0 512 20 6 1 - Gaussian window</para> |
| 182 | </caption> |
| 183 | </mediaobject> |
| 184 | |
| 185 | </para> |
| 186 | </refsect1> |
| 187 | |
| 188 | <refsect1> |
| 189 | <title>Credits</title> |
| 190 | <para> |
| 191 | <simplelist> |
| 192 | <member>Author: &nameparis;</member> |
| 193 | <member>MIT, Cambridge</member> |
| 194 | <member>1995</member> |
| 195 | </simplelist> |
| 196 | </para> |
| 197 | |
| 198 | <para> |
| 199 | <simplelist> |
| 200 | <member>Author: &namejohn;</member> |
| 201 | <member>University of Bath/Codemist Ltd.</member> |
| 202 | <member>Bath, UK</member> |
| 203 | </simplelist> |
| 204 | </para> |
| 205 | |
| 206 | <para>New in Csound version 3.2</para> |
| 207 | <para>Optional argument to Gaussian added in 5.10</para> |
| 208 | </refsect1> |
| 209 | </refentry> |