Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 6ed14ebfd686aa32f7956e552aa2e21d > files > 171

csound-manual-5.13.0-5.fc15.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>GEN07</title>
    <link rel="stylesheet" href="csound.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.75.2" />
    <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="GEN06.html" title="GEN06" />
    <link rel="next" href="GEN08.html" title="GEN08" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">GEN07</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="GEN06.html">Prev</a> </td>
          <th width="60%" align="center">Score Statements and GEN Routines</th>
          <td width="20%" align="right"> <a accesskey="n" href="GEN08.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="GEN07">
      <a id="GEN07"></a>
      <div class="titlepage"></div>
      <a id="IndexGEN07" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">GEN07</span>
        </h2>
        <p>GEN07 — 
      Constructs functions from segments of straight lines.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="id3731538"></a>
        <h2>Description</h2>
        <p>
      Constructs functions from segments of straight lines.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="id3731551"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>f</strong></span>  #    time    size   7   a   n1   b   n2   c  ...</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="id3731567"></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 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>).
    </p>
        <p>
      <span class="emphasis"><em>a, b, c,</em></span> etc. -- ordinate values, in odd-numbered pfields p5, p7, p9, . . .
    </p>
        <p>
      <span class="emphasis"><em>n1, n2</em></span>, etc. -- length of segment (no. of storage locations), in even-numbered pfields. Cannot be negative, but a zero is meaningful for specifying discontinuous waveforms (e.g. in the example below). The sum <span class="emphasis"><em>n1</em></span> + <span class="emphasis"><em>n2</em></span> + .... will normally equal <span class="emphasis"><em>size</em></span> for fully specified functions. If the sum is smaller, the function locations not included will be set to zero; if the sum is greater, only the first <span class="emphasis"><em>size</em></span> locations will be stored.
    </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>
        </p>
                <div class="itemizedlist">
                  <ul class="itemizedlist" type="disc">
                    <li class="listitem">
                      <p>
              If p4 is positive, functions are post-normalized (rescaled to a maximum absolute value of 1 after generation). A negative p4 will cause rescaling to be skipped.
            </p>
                    </li>
                    <li class="listitem">
                      <p>
              Discrete-point linear interpolation implies an increase or decrease along a segment by equal differences between adjacent locations; exponential interpolation implies that the progression is by equal ratio. In both forms the interpolation from <span class="emphasis"><em>a</em></span> to <span class="emphasis"><em>b</em></span> is such as to assume that the value <span class="emphasis"><em>b</em></span> will be attained in the n + 1th location. For discontinuous functions, and for the segment encompassing the end location, this value will not actually be reached, although it may eventually appear as a result of final scaling.
            </p>
                    </li>
                  </ul>
                </div>
                <p>
      </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1" title="Examples">
        <a id="id3732524"></a>
        <h2>Examples</h2>
        <p>
      Here is a simple example of the GEN07 routine. It uses the file <a class="ulink" href="examples/gen07.csd" target="_top"><em class="citetitle">gen07.csd</em></a>. It will create a single-cycle sawtooth whose discontinuity is mid-way in the stored function. Here is its diagram:
      </p>
        <div class="mediaobject">
          <img src="images/gen07.png" alt="Diagram of the waveform generated by GEN07." />
          <div class="caption">
            <p>Diagram of the waveform generated by GEN07.</p>
          </div>
        </div>
        <p>

      </p>
        <div class="example">
          <a id="id3732573"></a>
          <p class="title">
            <b>Example 738. A simple example of the GEN07 routine.</b>
          </p>
          <div class="example-contents">
            <p>
          See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.
        </p>
            <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>
<span class="comment">; Audio out   Audio in</span>
-odac           -iadc    <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o gen07.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="comment">; Initialize the global variables.</span>
<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">kr</span> <span class="op">=</span> 4410
<span class="ohdr">ksmps</span> <span class="op">=</span> 10
<span class="ohdr">nchnls</span> <span class="op">=</span> 1

<span class="comment">; Instrument #1.</span>
<span class="oblock">instr</span> 1
  kamp <span class="op">=</span> 30000
  kcps <span class="op">=</span> 440
  ifn <span class="op">=</span> 1

  <span class="comment">; Play the sine wave stored in Table #1.</span>
  a1 <span class="opc">oscil</span> kamp, kcps, ifn
  <span class="opc">out</span> a1
<span class="oblock">endin</span>


<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="comment">; Table #1: a sawtooth wave (using GEN07).</span>
<span class="stamnt">f</span> 1 0 256 7 0 128 1 0 -1 128 0

<span class="comment">; Play Instrument #1 for 2 seconds.</span>
<span class="stamnt">i</span> 1 0 2
<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" />
    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="id3732612"></a>
        <h2>See Also</h2>
        <p>
       <a class="link" href="GEN05.html" title="GEN05"><em class="citetitle">GEN05</em></a>,
       <a class="link" href="GEN06.html" title="GEN06"><em class="citetitle">GEN06</em></a>, and
       <a class="link" href="GEN08.html" title="GEN08"><em class="citetitle">GEN08</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="GEN06.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="GEN08.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">GEN06 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> GEN08</td>
        </tr>
      </table>
    </div>
  </body>
</html>