Sophie

Sophie

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

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>GEN06</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="GEN05.html" title="GEN05" />
    <link rel="next" href="GEN07.html" title="GEN07" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">GEN06</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="GEN05.html">Prev</a> </td>
          <th width="60%" align="center">Score Statements and GEN Routines</th>
          <td width="20%" align="right"> <a accesskey="n" href="GEN07.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="GEN06">
      <a id="GEN06"></a>
      <div class="titlepage"></div>
      <a id="IndexGEN06" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">GEN06</span>
        </h2>
        <p>GEN06 — 
      Generates a function comprised of segments of cubic polynomials.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp77269056"></a>
        <h2>Description</h2>
        <p>
      This subroutine will generate a function comprised of segments of cubic polynomials, spanning specified points just three at a time.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp77256336"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>f</strong></span>  #   time   size   6   a   n1   b   n2   c   n3   d ...</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp77257392"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>size</em></span> -- number of points in the table. Must be a power off 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, c, e, ...</em></span> -- local maxima or minima of successive segments, depending on the relation of these points to adjacent inflexions. May be either positive or negative.
    </p>
        <p>
      <span class="emphasis"><em>b, d, f, ...</em></span> -- ordinate values of points of inflexion at the ends of successive curved segments. May be positive or negative.
    </p>
        <p>
      <span class="emphasis"><em>n1, n2, n3 ...</em></span> -- number of stored values between specified points. Cannot be negative, but a zero is meaningful for specifying discontinuities. The sum <span class="emphasis"><em>n1</em></span> + <span class="emphasis"><em>n2</em></span> + ... will normally equal size for fully specified functions. (for details, see <a class="link" href="GEN05.html" title="GEN05"><em class="citetitle">GEN05</em></a>).
    </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>
        <span class="emphasis"><em>GEN06</em></span> constructs a stored function from segments of cubic polynomial functions. Segments link ordinate values in groups of 3: point of inflexion, maximum/minimum, point of inflexion. The first complete segment encompasses <span class="emphasis"><em>b</em></span>, <span class="emphasis"><em>c</em></span>, <span class="emphasis"><em>d</em></span> and has length <span class="emphasis"><em>n2</em></span> + <span class="emphasis"><em>n3</em></span>, the next encompasses <span class="emphasis"><em>d</em></span>, <span class="emphasis"><em>e</em></span>, <span class="emphasis"><em>f</em></span> and has length <span class="emphasis"><em>n4</em></span> + <span class="emphasis"><em>n5</em></span>, etc. The first segment (<span class="emphasis"><em>a</em></span>, <span class="emphasis"><em>b</em></span> with length <span class="emphasis"><em>n1</em></span>) is partial with only one inflexion; the last segment may be partial too. Although the inflexion points <span class="emphasis"><em>b</em></span>, <span class="emphasis"><em>d</em></span>, <span class="emphasis"><em>f</em></span> ... each figure in two segments (to the left and right), the slope of the two segments remains independent at that common point (i.e. the 1st derivative will likely be discontinuous). When <span class="emphasis"><em>a</em></span>, <span class="emphasis"><em>c</em></span>, <span class="emphasis"><em>e</em></span>... are alternately maximum and minimum, the inflexion joins will be relatively smooth; for successive maxima or successive minima the inflexions will be comb-like.
      </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp77317816"></a>
        <h2>Examples</h2>
        <p>
	    Here is an example of the GEN06 routine. It uses the files <a class="ulink" href="examples/gen06.csd" target="_top"><em class="citetitle">gen06.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp77318792"></a>
          <p class="title">
            <strong>Example 1042. An example of the GEN06 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   <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 gen06.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

ifn  <span class="op">=</span> p4				<span class="comment">;choose between tables</span>
kcps <span class="opc">init</span> 1<span class="op">/</span>p3				<span class="comment">;create index over duration of note.</span>
kndx <span class="opc">phasor</span> kcps
ixmode <span class="op">=</span> 1
kval <span class="opc">table</span> kndx, ifn, ixmode		<span class="comment">;normalize mode</span>

kfreq <span class="op">=</span> kval <span class="op">*</span> 30			<span class="comment">;scale frequency to emphasixe effect</span>
asig  <span class="opc">poscil</span> .7, 220 <span class="op">+</span> kfreq, 1		<span class="comment">;add to frequency</span>
      <span class="opc">outs</span> asig, asig
  
<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 16384 10 1 <span class="comment">;sine wave.</span>
<span class="stamnt">f</span> 2 0 513 6 1 128 -1 128 1 64 -.5 64 .5 16 -.5 8 1 16 -.5 8 1 16 -.5 84 1 16 -.5 8 .1 16 -.1 17 0
<span class="stamnt">f</span> 3 0 513 6 0 128 0.5 128 1 128 0 129 -1

<span class="stamnt">i</span> 1 0 3 2
<span class="stamnt">i</span> 1 4 3 3
<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>These are the diagrams of the waveforms of the GEN06 routines, as used in the example:</span>

      </p>
        <div class="mediaobject">
          <img src="images/gen06_1.png" alt="f 2 0 513 6 1 128 -1 128 1 64 -.5 64 .5 16 -.5 8 1 16 -.5 8 1 16 -.5 84 1 16 -.5 8 .1 16 -.1 17 0 - a not-so-smooth curve" />
          <div class="caption">
            <p>f 2 0 513 6 1 128 -1 128 1 64 -.5 64 .5 16 -.5 8 1 16 -.5 8 1 16 -.5 84 1 16 -.5 8 .1 16 -.1 17 0 - a not-so-smooth curve</p>
          </div>
        </div>
        <p>

      </p>
        <div class="mediaobject">
          <img src="images/gen06_2.png" alt="f 3 0 513 6 0 128 0.5 128 1 128 0 129 -1 - a curve running 0 to 1 to -1, with a minimum, maximum and minimum at these values respectively. Inflexions are at .5 and 0 and are relatively smooth" />
          <div class="caption">
            <p>f 3 0 513 6 0 128 0.5 128 1 128 0 129 -1 - a curve running 0 to 1 to -1, with a minimum, maximum and minimum at these values respectively. Inflexions are at .5 and 0 and are relatively smooth</p>
          </div>
        </div>
        <p>

    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp77324128"></a>
        <h2>See Also</h2>
        <p>
       <a class="link" href="GEN05.html" title="GEN05"><em class="citetitle">GEN05</em></a>,
       <a class="link" href="GEN07.html" title="GEN07"><em class="citetitle">GEN07</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="GEN05.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="GEN07.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">GEN05 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> GEN07</td>
        </tr>
      </table>
    </div>
  </body>
</html>