summaryrefslogtreecommitdiff
path: root/scoregens/gen08.xml
blob: 5a2d6005ed1333c62cf78de07864f620ac796c81 (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
<refentry id="GEN08">
      <indexterm id="IndexGEN08"><primary>GEN08</primary></indexterm>
  <refmeta>
    <refentrytitle>GEN08</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>GEN08</refname>
    <refpurpose>
      Generate a piecewise cubic spline curve.
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      This subroutine will generate a piecewise cubic spline curve, the smoothest possible through all specified points.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis><command>f</command> # time size 8 a n1 b n2 c n3 d ...</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>a, b, c,</emphasis> etc. -- ordinate values of the function.
    </para>

    <para>
      <emphasis>n1, n2, n3 ... </emphasis> -- length of each segment measured in stored values. May not be zero, but may be fractional. A particular segment may or may not actually store any values; stored values will be generated at integral points from the beginning of the function. The sum <emphasis>n1</emphasis> + <emphasis>n2</emphasis> + ... will normally equal <emphasis>size</emphasis> for fully specified functions.
    </para>

    <note>
      <title>Note</title>
      <para>
        <itemizedlist>
          <listitem>
            <para>
              <emphasis>GEN08</emphasis> constructs a stored table from segments of cubic polynomial functions. Each segment runs between two specified points but depends as well on their neighbors on each side. Neighboring segments will agree in both value and slope at their common point. (The common slope is that of a parabola through that point and its two neighbors). The slope at the two ends of the function is constrained to be zero (flat).
            </para>
          </listitem>

          <listitem>
            <para>
              <emphasis>Hint:</emphasis> to make a discontinuity in slope or value in the function as stored, arrange a series of points in the interval between two stored values; likewise for a non-zero boundary slope.
            </para>
          </listitem>
        </itemizedlist>
      </para>
    </note>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>
      Here is a simple example of the GEN08 routine. It uses the file <ulink url="examples/gen08.csd"><citetitle>gen08.csd</citetitle></ulink>. It will create a curve with a smooth hump in the middle, going briefly negative outside the hump then flat at its ends. Here is its diagram:
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/gen08.png" format="PNG"/>
        </imageobject>

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

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

      <example>
        <title>A simple example of the GEN08 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/gen08.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
      </example>
    </para>
  </refsect1>

  <refsect1>
     <title>See Also</title>
     <para>
       <link linkend="GEN05"><citetitle>GEN05</citetitle></link>,
       <link linkend="GEN06"><citetitle>GEN06</citetitle></link>, and
       <link linkend="GEN07"><citetitle>GEN07</citetitle></link>
     </para>
  </refsect1>
</refentry>