summaryrefslogtreecommitdiff
path: root/scoregens/gen09.xml
blob: c59e757d4513e8852b070f5deccc999450c3bdd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<refentry id="GEN09">
      <indexterm id="IndexGEN09"><primary>GEN09</primary></indexterm>
  <refmeta>
    <refentrytitle>GEN09</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>GEN09</refname>
    <refpurpose>
      Generate composite waveforms made up of weighted sums of simple sinusoids.
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      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>.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis><command>f</command> # time size 9 pna stra phsa pnb strb phsb ...</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <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>).
    </para>

    <para>
      <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.
    </para>

    <para>
      <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.
    </para>

    <para>
      <emphasis>phsa, phsb</emphasis>, etc. -- initial phase of partials <emphasis>pna, pnb,</emphasis> etc., expressed in degrees (0-360).
    </para>

    <note>
      <title>Note</title>
      <para>
        <itemizedlist>
          <listitem>
            <para>
              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>.
            </para>

            <para>
              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.
            </para>
          </listitem>
        </itemizedlist>
      </para>
    </note>
  </refsect1>
 
  <refsect1>
    <title>Examples</title>
    <para>
      Here is a simple example of the GEN09 routine. It uses the file <ulink url="examples/gen09.csd"><citetitle>gen09.csd</citetitle></ulink>.  It will generate a cosine wave, a sine wave with an initial phase of 90 degrees. Here is its diagram:
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/gen09.png" format="PNG"/>
        </imageobject>

        <textobject>
          <phrase>Diagram of the waveform generated by GEN09.</phrase>
        </textobject>

        <caption>
          <para>Diagram of the waveform generated by GEN09.</para>
        </caption>
      </mediaobject>

      <example>
        <title>A simple example of the GEN09 routine.</title>

        <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>
        <xi:include href="examples-xml/gen09.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
      </example>
    </para>

    <para>
      Here is another example of the GEN09 routine. It uses the file <ulink url="examples/gen09square.csd"><citetitle>gen09square.csd</citetitle></ulink>. It combines partials l, 3 and 9 in the relative strengths in which they are found in a square wave, except that partial 9 is upside down. It will be rescaled, here is its diagram:
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/gen09square.png" format="PNG"/>
        </imageobject>

        <textobject>
          <phrase>Diagram of the waveform generated by GEN09.</phrase>
        </textobject>

        <caption>
          <para>Diagram of the waveform generated by GEN09.</para>
        </caption>
      </mediaobject>

      <example>
        <title>A square wave generated by the GEN09 routine.</title>
          <xi:include href="examples-xml/gen09square.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
      </example>
    </para>
  </refsect1>

  <refsect1>
     <title>See Also</title>
     <para>
       <link linkend="GEN10"><citetitle>GEN10</citetitle></link>, 
       <link linkend="GEN19"><citetitle>GEN19</citetitle></link>
     </para>
  </refsect1>

  <refsect1>
    <title>Credits</title>
    <para>The simple example was written by &namekevin;.</para>
  </refsect1>
</refentry>