<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="GEN17">
  <refmeta>
    <refentrytitle>GEN17</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>GEN17</refname>
    <refpurpose>
      Creates a step function from given x-y pairs.
      <indexterm id="IndexGEN17"><primary>GEN17</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      This subroutine creates a step function from given x-y pairs.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis><command>f</command> # time size 17 x1 a x2 b x3 c  ...</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>size</emphasis> -- number of points in the table. Must be a power of 2 or a power-of-2 plus 1 (see <link linkend="f"><citetitle>f statement</citetitle></link>). The normal value is power-of-2 plus 1.
    </para>

    <para>
      <emphasis>x1, x2, x3,</emphasis> etc. -- x-ordinate values, in ascending order, 0 first.
    </para>

    <para>
      <emphasis>a, b, c,</emphasis> etc. -- y-values at those x-ordinates, held until the next x-ordinate.
    </para>

    <note>
      <title>Note</title>
      <para>
        This subroutine creates a step function of x-y pairs whose y-values are held to the right. The right-most y-value is then held to the end of the table. The function is useful for mapping one set of data values onto another, such as MIDI note numbers onto sampled sound ftable numbers ( see <link linkend="loscil"><citetitle>loscil</citetitle></link>).
      </para>
    </note>
  </refsect1>
 
  <refsect1>
    <title>Examples</title>
    <para>
      <informalexample>
        <programlisting>
<emphasis>f</emphasis>  1  0  128  -17   0  1   12  2   24  3   36  4   48  5  60  6   72  7   84  8
        </programlisting>
      </informalexample>

      This describes a step function with 8 successively increasing levels, each 12 locations wide except the last which extends its value to the end of the table. Rescaling is inhibited. Indexing into this table with a MIDI note-number would retrieve a different value every octave up to the eighth, above which the value returned would remain the same.
    </para>
  </refsect1>

  <refsect1>
     <title>See Also</title>
     <para>
       <link linkend="GEN02"><citetitle>GEN02</citetitle></link>
     </para>
  </refsect1>
</refentry>
