Sophie

Sophie

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

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>GEN15</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="GEN14.html" title="GEN14" />
    <link rel="next" href="GEN16.html" title="GEN16" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">GEN15</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="GEN14.html">Prev</a> </td>
          <th width="60%" align="center">Score Statements and GEN Routines</th>
          <td width="20%" align="right"> <a accesskey="n" href="GEN16.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="GEN15">
      <a id="GEN15"></a>
      <div class="titlepage"></div>
      <a id="IndexGEN15" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">GEN15</span>
        </h2>
        <p>GEN15 — 
      Creates two tables of stored polynomial functions.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp77660728"></a>
        <h2>Description</h2>
        <p>
      This subroutine creates two tables of stored polynomial functions, suitable for use in phase quadrature operations.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp77661456"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>f</strong></span> # time size 15 xint xamp h0 phs0 h1 phs1 h2 phs2 ...</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp77722496"></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>xint</em></span> -- provides the left and right values [<span class="emphasis"><em>-xint</em></span>, <span class="emphasis"><em>+xint</em></span>] of the <span class="emphasis"><em>x</em></span> interval over which the polynomial is to be drawn. This subroutine will eventually call <a class="link" href="GEN03.html" title="GEN03"><em class="citetitle">GEN03</em></a> to draw both functions; this p5 value is therefor expanded to a negative-positive p5, p6 pair before <span class="emphasis"><em>GEN03</em></span> is actually called. The normal value is 1.
    </p>
        <p>
      <span class="emphasis"><em>xamp </em></span> -- amplitude scaling factor of the sinusoid input that is expected to produce the following spectrum.
    </p>
        <p>
      <span class="emphasis"><em>h0, h1, h2, ... hn</em></span> -- relative strength of partials 0 (DC), 1 (fundamental), 2 ... that will result when a sinusoid of amplitude 

      </p>
        <div class="literallayout">
          <p><br />
xamp * int(size/2)/xint<br />
      </p>
        </div>
        <p>

      is waveshaped using this function table. These values thus describe a frequency spectrum associated with a particular factor <span class="emphasis"><em>xamp</em></span> of the input signal.
    </p>
        <p>
      <span class="emphasis"><em>phs0, phs1, ... </em></span> -- phase in degrees of desired harmonics <span class="emphasis"><em>h0, h1, ...</em></span> when the two functions of <span class="emphasis"><em>GEN15</em></span> are used with phase quadrature.
    </p>
        <div class="note" title="Notes" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Note: Notes">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Note]" src="images/note.png" />
              </td>
              <th align="left">Notes</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
        <span class="emphasis"><em>GEN15</em></span> creates two tables of equal size, labeled <span class="emphasis"><em>f </em></span># and <span class="emphasis"><em>f</em></span> # + 1. Table # will contain a Chebyshev function of the first kind, drawn using <a class="link" href="GEN13.html" title="GEN13"><em class="citetitle">GEN13</em></a> with partial strengths <span class="emphasis"><em>h0cos(phs0), h1cos(phs1), ...</em></span> Table #+1 will contain a Chebyshev function of the 2nd kind by calling <a class="link" href="GEN14.html" title="GEN14"><em class="citetitle">GEN14</em></a> with partials <span class="emphasis"><em>h1sin(phs1), h2sin(phs2),...</em></span> (note the harmonic displacement). The two tables can be used in conjunction in a waveshaping network that exploits phase quadrature.
      </p>
                <p>
        Before version 5.16 there was a bug (pointed out by Menno Knevel and fixed
        by François Pinot) on the number of pfields transmitted to gen13 and gen14 by
        gen15. The consequence is that all the csd, or orc and sco files that used
        gen15 before this bug was fixed, are likely to sound different now.
      </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp77732448"></a>
        <h2>Examples</h2>
        <p>
	    Here is an example of the GEN15 routine. It uses the files <a class="ulink" href="examples/gen15.csd" target="_top"><em class="citetitle">gen15.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp77733360"></a>
          <p class="title">
            <strong>Example 1051. An example of the GEN15 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 gen15.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">;example from the Csound Book, page 85</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

idur  <span class="op">=</span> p3
iamp  <span class="op">=</span> p4
ifrq  <span class="op">=</span> <span class="opc">cpspch</span>(p5)        <span class="comment">;pitch</span>
iswp1 <span class="op">=</span> p6
iswp2 <span class="op">=</span> p7
kswp  <span class="opc">line</span>   iswp1, p3, iswp2      <span class="comment">;amplitude sweep values</span>
acosi <span class="opc">oscili</span> kswp<span class="op">*</span>.5, ifrq, 2      <span class="comment">;f2=cosine wave</span>
asine <span class="opc">oscili</span> kswp, ifrq, 1         <span class="comment">;f1=sine wave</span>
atab1 <span class="opc">tablei</span> acosi, 33, 1, .5      <span class="comment">;tables a1 to GEN13</span>
atab2 <span class="opc">tablei</span> acosi, 34, 1, .5      <span class="comment">;tables a1 to GEN14</span>
knrm1 <span class="opc">tablei</span> kswp, 35, 1           <span class="comment">;normalizing f35</span>
knrm2 <span class="opc">tablei</span> kswp, 36, 1           <span class="comment">;normalizing f36</span>
anrm1 <span class="op">=</span> atab1<span class="op">*</span>knrm1                <span class="comment">;normalize GEN13 signal</span>
anrm2 <span class="op">=</span> atab2<span class="op">*</span>knrm2<span class="op">*</span>asine          <span class="comment">;normalize GEN14 signal</span>
amix  <span class="op">=</span> anrm1<span class="op">+</span>anrm2                <span class="comment">;mix GEN13 and GEN14</span>
kenv  <span class="opc">expseg</span> .001, idur<span class="op">*</span>.1, iamp, idur<span class="op">*</span>.1, iamp<span class="op">*</span>.8, idur<span class="op">*</span>.8, .001  
asig  <span class="op">=</span> amix<span class="op">*</span>kenv  
      <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 8193 10  1        <span class="comment">;sine wave</span>
<span class="stamnt">f</span> 2 0 8193  9  1 1 90   <span class="comment">;cosine wave</span>

<span class="comment">; Note that all the f33 tables in the following sections are defined with p4=-15,</span>
<span class="comment">; which means that tables 33 and 34 will not be normalized. Thus if we display</span>
<span class="comment">; tables when running this example, we'll get correct diagrams even if one table</span>
<span class="comment">; has very small values instead of 0 values, due to cpu approximations in processing</span>
<span class="comment">; sin(180), as in sections 2, 4, and 5. This has no consequence on the audio result,</span>
<span class="comment">; because of the use of amp normalization (tables 35 and 36).</span>

<span class="stamnt">f</span> 33 0 8193 -15 1 1 1 0 1 180 .8 45 .6 270 .5 90 .4 225 .2 135 .1 315  <span class="comment">;makes function tables 33 and 34</span>
<span class="stamnt">f</span> 35 0 4097  4  33 1    <span class="comment">;amp normalization for f33</span>
<span class="stamnt">f</span> 36 0 4097  4  34 1    <span class="comment">;amp normalization for f34</span>
<span class="stamnt">i</span> 1 0 5  .6  8.00 0   1
<span class="stamnt">i</span> 1 + .  .6  8.00 1   0
<span class="stamnt">s</span>
<span class="comment">;even harmonics with no phase shift, odd harmonics with phase shift</span>
<span class="stamnt">f</span> 33 0 8193 -15 1 1 1 0 1 0 1 180 1 180 1 0 1 0 1 180 1 180 1 0 1 0 1 180 1 180
<span class="stamnt">f</span> 35 0 4097  4  33 1    <span class="comment">;amp normalization for f33</span>
<span class="stamnt">f</span> 36 0 4097  4  34 1    <span class="comment">;amp normalization for f34</span>
<span class="stamnt">i</span> 1 0  5 .6  8.00 0   1
<span class="stamnt">i</span> 1 +  . .6  8.00 1   0
<span class="stamnt">s</span>
<span class="comment">;different harmonic strenghts and phases</span>
<span class="stamnt">f</span> 33 0 8193 -15 1 1 1 0 1 0 .9 180 .5 270 .75 90 .4 45 .2 225 .1 0
<span class="stamnt">f</span> 35 0 4097  4  33 1    <span class="comment">;amp normalization for f33</span>
<span class="stamnt">f</span> 36 0 4097  4  34 1    <span class="comment">;amp normalization for f34</span>
<span class="stamnt">i</span> 1 0 5 .6  8.00 0  1
<span class="stamnt">i</span> 1 + . .6  8.00 1  0
<span class="stamnt">s</span>
<span class="comment">;lower harmonics no phase shift, upper harmonics with phase shift</span>
<span class="stamnt">f</span> 33 0 8193 -15 1  1  1 0 1 0 .5 0 .9 0 .3 0 .75 0 .2 180 .6 180 .15 180 .5 180 .1 180  
<span class="stamnt">f</span> 35 0 4097  4  33 1    <span class="comment">;amp normalization for f33</span>
<span class="stamnt">f</span> 36 0 4097  4  34 1    <span class="comment">;amp normalization for f34</span>
<span class="stamnt">i</span> 1 0 5 .6  8.00 0   1
<span class="stamnt">i</span> 1 + . .6  8.00 1   0

<span class="stamnt">s</span>
<span class="comment">;lower harmonics with phase shift, upper harmonics no phase shift</span>
<span class="stamnt">f</span> 33 0 8193 -15 1 1 1 180 1 180 .5 180 .9 180 .3 180 .75 180 .2 0 .6 0 .15 0 .5 0 .1 0  
<span class="stamnt">f</span> 35 0 4097 4 33 1    <span class="comment">;amp normalization for f33</span>
<span class="stamnt">f</span> 36 0 4097 4 34 1    <span class="comment">;amp normalization for f34</span>
<span class="stamnt">i</span> 1 0 5 .6  8.00 0  1
<span class="stamnt">i</span> 1 + . .6  8.00 1  0
<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 GEN15 routine, as used in the example
        (in each diagram, the curve in blue is for ftable 33 and the curve in green is for
        table 34):</span>

      </p>
        <div class="mediaobject">
          <img src="images/gen15-1.png" alt="f 33 0 8193 -15 1 1 1 0 1 180 .8 45 .6 270 .5 90 .4 225 .2 135 .1 315" />
          <div class="caption">
            <p>f 33 0 8193 -15 1 1 1 0 1 180 .8 45 .6 270 .5 90 .4 225 .2 135 .1 315</p>
          </div>
        </div>
        <p>

      </p>
        <div class="mediaobject">
          <img src="images/gen15-2.png" alt="f 33 0 8193 -15 1 1 1 0 1 0 1 180 1 180 1 0 1 0 1 180 1 180 1 0 1 0 1 180 1 180" />
          <div class="caption">
            <p>f 33 0 8193 -15 1 1 1 0 1 0 1 180 1 180 1 0 1 0 1 180 1 180 1 0 1 0 1 180 1 180</p>
          </div>
        </div>
        <p>

      </p>
        <div class="mediaobject">
          <img src="images/gen15-3.png" alt="f 33 0 8193 -15 1 1 1 0 1 0 .9 180 .5 270 .75 90 .4 45 .2 225 .1 0" />
          <div class="caption">
            <p>f 33 0 8193 -15 1 1 1 0 1 0 .9 180 .5 270 .75 90 .4 45 .2 225 .1 0</p>
          </div>
        </div>
        <p>

      </p>
        <div class="mediaobject">
          <img src="images/gen15-4.png" alt="f 33 0 8193 -15 1 1 1 0 1 0 .5 0 .9 0 .3 0 .75 0 .2 180 .6 180 .15 180 .5 180 .1 180" />
          <div class="caption">
            <p>f 33 0 8193 -15 1  1  1 0 1 0 .5 0 .9 0 .3 0 .75 0 .2 180 .6 180 .15 180 .5 180 .1 180</p>
          </div>
        </div>
        <p>

      </p>
        <div class="mediaobject">
          <img src="images/gen15-5.png" alt="f 33 0 8193 -15 1 1 1 180 1 180 .5 180 .9 180 .3 180 .75 180 .2 0 .6 0 .15 0 .5 0 .1 0" />
          <div class="caption">
            <p>f 33 0 8193 -15 1 1 1 180 1 180 .5 180 .9 180 .3 180 .75 180 .2 0 .6 0 .15 0 .5 0 .1 0</p>
          </div>
        </div>
        <p>
    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp77743512"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="GEN13.html" title="GEN13"><em class="citetitle">GEN13</em></a>, and
      <a class="link" href="GEN14.html" title="GEN14"><em class="citetitle">GEN14</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="GEN14.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="GEN16.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">GEN14 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> GEN16</td>
        </tr>
      </table>
    </div>
  </body>
</html>