Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-release > by-pkgid > b707d9a4ee443103660a75ccb6e51334 > files > 137

csound-doc-5.19.01-10.mga5.noarch.rpm

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>GEN17</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.76.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="ScoregensTop.html" title="Score Statements and GEN Routines" />
    <link rel="prev" href="GEN16.html" title="GEN16" />
    <link rel="next" href="GEN18.html" title="GEN18" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">GEN17</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="GEN16.html">Prev</a> </td>
          <th width="60%" align="center">Score Statements and GEN Routines</th>
          <td width="20%" align="right"> <a accesskey="n" href="GEN18.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="GEN17">
      <a id="GEN17"></a>
      <div class="titlepage"></div>
      <a id="IndexGEN17" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">GEN17</span>
        </h2>
        <p>GEN17 — 
      Creates a step function from given x-y pairs.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp77762120"></a>
        <h2>Description</h2>
        <p>
      This subroutine creates a step function from given x-y pairs.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp77762792"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>f</strong></span> # time size 17 x1 a x2 b x3 c  ...</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp77773128"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>size</em></span> -- number of points in the table. Must be a power of 2 or a power-of-2 plus 1 (see <a class="link" href="f.html" title="f Statement (or Function Table Statement)"><em class="citetitle">f statement</em></a>). The normal value is power-of-2 plus 1.
    </p>
        <p>
      <span class="emphasis"><em>x1, x2, x3,</em></span> etc. -- x-ordinate values, in ascending order, 0 first.
    </p>
        <p>
      <span class="emphasis"><em>a, b, c,</em></span> etc. -- y-values at those x-ordinates, held until the next x-ordinate.
    </p>
        <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Note: Note">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Note]" src="images/note.png" />
              </td>
              <th align="left">Note</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
        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 <a class="link" href="loscil.html" title="loscil"><em class="citetitle">loscil</em></a>).
      </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp77813952"></a>
        <h2>Examples</h2>
        <p>
      </p>
        <div class="informalexample">
          <pre class="programlisting">
<span class="stamnt">f</span>  1  0  128  -17   0  1   12  2   24  3   36  4   48  5  60  6   72  7   84  8</pre>
        </div>
        <p>

      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.
    </p>
        <p>
	    Here is a complete example of the GEN17 routine. It uses the files <a class="ulink" href="examples/gen17.csd" target="_top"><em class="citetitle">gen17.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp77816360"></a>
          <p class="title">
            <strong>Example 1053. An example of the GEN17 routine.</strong>
          </p>
          <div class="example-contents">
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac  -M0 -+rtmidi=virtual    <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o gen17.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100 
<span class="ohdr">ksmps</span> <span class="op">=</span> 32 
<span class="ohdr">nchnls</span> <span class="op">=</span> 2 
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1 

 <span class="oblock">instr</span> 1
 
inote  <span class="opc">cpsmidi</span>	 
iveloc <span class="opc">ampmidi</span> .5
ictl   <span class="opc">midictrl</span> 5				<span class="comment">;move slider of controller 5 to change ftable</span>
itab   <span class="opc">table</span> ictl, 2
aout   <span class="opc">poscil</span> iveloc, inote, itab
       <span class="opc">outs</span> aout, aout

<span class="oblock">endin</span>	 
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">f</span> 1 0 8193 10 1
<span class="stamnt">f</span> 2 0 128 -17 0 10 32 20 64 30 96 40			<span class="comment">;inhibit rescaling</span>

<span class="stamnt">f</span> 10 0 16384 10 1                                       <span class="comment">; Sine</span>
<span class="stamnt">f</span> 20 0 16384 10 1 0.5 0.3 0.25 0.2 0.167 0.14 0.125 .111<span class="comment">; Sawtooth</span>
<span class="stamnt">f</span> 30 0 16384 10 1 0   0.3 0    0.2 0     0.14 0     .111<span class="comment">; Square</span>
<span class="stamnt">f</span> 40 0 16384 10 1 1   1   1    0.7 0.5   0.3  0.1       <span class="comment">; Pulse</span>

<span class="stamnt">f</span> 0 30	<span class="comment">;run for 30 seconds</span>
<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />

        <span>This is the diagram of the waveform of the GEN17 routine, as used in the example:</span>

      </p>
        <div class="mediaobject">
          <img src="images/gen17.png" alt="f 2 0 128 -17 0 10 32 20 64 30 96 40 - a step function with 4 equal levels, each 32 locations wide except the last which extends its value to the end of the table" />
          <div class="caption">
            <p>f 2 0 128 -17 0 10 32 20 64 30 96 40 - a step function with 4 equal levels, each 32 locations wide except the last which extends its value to the end of the table</p>
          </div>
        </div>
        <p>

    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp77819696"></a>
        <h2>See Also</h2>
        <p>
       <a class="link" href="GEN02.html" title="GEN02"><em class="citetitle">GEN02</em></a>
     </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="GEN16.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="ScoregensTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="GEN18.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">GEN16 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> GEN18</td>
        </tr>
      </table>
    </div>
  </body>
</html>