summaryrefslogtreecommitdiff
path: root/scoregens/gen11.xml
blob: f09e4dd3f46b874e7694e3bf6f8c9414ba3b1c91 (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
<refentry id="GEN11">
      <indexterm id="IndexGEN11"><primary>GEN11</primary></indexterm>
  <refmeta>
    <refentrytitle>GEN11</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>GEN11</refname>
    <refpurpose>
      Generates an additive set of cosine partials.
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      This subroutine generates an additive set of cosine partials, in the manner of Csound generators <link linkend="buzz"><citetitle>buzz</citetitle></link> and <link linkend="gbuzz"><citetitle>gbuzz</citetitle></link>.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis><command>f</command> # time size 11 nh [lh] [r]</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>nh</emphasis> -- number of harmonics requested. Must be positive.
    </para>

    <para>
      <emphasis>lh</emphasis>(optional) -- lowest harmonic partial present. Can be positive, zero or negative. The set of partials can begin at any partial number and proceeds upwards; if <emphasis>lh</emphasis> is negative, all partials below zero will reflect in zero to produce positive partials without phase change (since cosine is an even function), and will add constructively to any positive partials in the set. The default value is 1
    </para>

    <para>
      <emphasis>r</emphasis>(optional) -- multiplier in an amplitude coefficient series. This is a power series: if the <emphasis>lh</emphasis>th partial has a strength coefficient of A the (<emphasis>lh</emphasis> + n)th partial will have a coefficient of A * r<superscript>n</superscript>, i.e. strength values trace an exponential curve. <emphasis>r</emphasis> may be positive, zero or negative, and is not restricted to integers. The default value is 1.
    </para>

    <note>
     <title>Note</title>
     <para>
       <itemizedlist>
         <listitem>
           <para>
             This subroutine is a non-time-varying version of the CSound <link linkend="buzz"><citetitle>buzz</citetitle></link>and <link linkend="gbuzz"><citetitle>gbuzz</citetitle></link> generators, and is similarly useful as a complex sound source in subtractive synthesis. With <emphasis>lh</emphasis> and <emphasis>r</emphasis> present it parallels <emphasis>gbuzz</emphasis>; with both absent or equal to 1 it reduces to the simpler <emphasis>buzz</emphasis> (i.e. <emphasis>nh</emphasis> equal-strength harmonic partials beginning with the fundamental).
           </para>
         </listitem>

         <listitem>
           <para>
             Sampling the stored waveform with an oscillator is more efficient than using the dynamic buzz units. However, the spectral content is invariant and care is necessary, lest the higher partials exceed the Nyquist during sampling to produce fold-over.
           </para>
         </listitem>
       </itemizedlist>
      </para>
    </note>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>
      Here is a simple example of the GEN11 routine. It uses the file <ulink url="examples/gen11.csd"><citetitle>gen11.csd</citetitle></ulink>.  It will generate a simple cosine wave. Here is its diagram:
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/gen11.png" format="PNG"/>
        </imageobject>

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

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

      <example>
        <title>A simple example of the GEN11 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/gen11.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>
     </para>
  </refsect1>

  <refsect1>
    <title>Credits</title>
    <para>Example written by &namekevin;</para>
  </refsect1>
</refentry>