Sophie

Sophie

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

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>GEN12</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="GEN11.html" title="GEN11" />
    <link rel="next" href="GEN13.html" title="GEN13" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">GEN12</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="GEN11.html">Prev</a> </td>
          <th width="60%" align="center">Score Statements and GEN Routines</th>
          <td width="20%" align="right"> <a accesskey="n" href="GEN13.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="GEN12">
      <a id="GEN12"></a>
      <div class="titlepage"></div>
      <a id="IndexGEN12" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">GEN12</span>
        </h2>
        <p>GEN12 — 
      Generates the log of a modified Bessel function of the second kind.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp77513000"></a>
        <h2>Description</h2>
        <p>
      This generates the log of a modified Bessel function of the second kind, order 0, suitable for use in amplitude-modulated FM.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp77513888"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>f</strong></span> # time size 12 xint</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp77517144"></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> -- specifies the <span class="emphasis"><em>x</em></span> interval [0 to <span class="emphasis"><em>+xint</em></span>] over which the function is defined.
    </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>
              This subroutine draws the natural log of a modified Bessel function of the second kind, order 0 (commonly written as <span class="emphasis"><em>I</em></span> subscript 0), over the x-interval requested. The call should have rescaling inhibited.
            </p>
                    </li>
                    <li class="listitem">
                      <p>
              The function is useful as an amplitude scaling factor in cycle-synchronous amplitude-modulated FM. (See Palamin &amp; Palamin, <span class="emphasis"><em>J. Audio Eng. Soc., 36/9</em></span>, Sept. 1988, pp.671-684.) The algorithm is interesting because it permits the normally symmetric FM spectrum to be made asymmetric around a frequency other than the carrier, and is thereby useful for formant positioning. By using a table lookup index of <span class="emphasis"><em>I</em></span>(r - 1/r), where <span class="emphasis"><em>I</em></span> is the FM modulation index and <span class="emphasis"><em>r</em></span> is an exponential parameter affecting partial strengths, the Palamin algorithm becomes relatively efficient, requiring only oscil's, table lookups, and a single <span class="emphasis"><em>exp</em></span> call.
            </p>
                    </li>
                  </ul>
                </div>
                <p>
      </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp77574440"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the GEN12 opcode. It uses the file <a class="ulink" href="examples/gen12.csd" target="_top"><em class="citetitle">gen12.csd</em></a>.
           </p>
        <div class="example">
          <a id="idp77575384"></a>
          <p class="title">
            <strong>Example 1048. Example of the GEN12 opcode.</strong>
          </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>
-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 gen12.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 87</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
icarfrq <span class="op">=</span>       p5
imodfrq <span class="op">=</span>       p6          
aenv    <span class="opc">expseg</span>  .01, idur<span class="op">*</span>.1, iamp, idur<span class="op">*</span>.8, iamp<span class="op">*</span>.75, idur<span class="op">*</span>.1, .01
i1      <span class="op">=</span>       p7<span class="op">*</span>imodfrq			<span class="comment">;p7=modulation index start</span>
i2      <span class="op">=</span>       p8<span class="op">*</span>imodfrq			<span class="comment">;p8=modulation index end</span>
adev    <span class="opc">line</span>    i1, idur, i2			<span class="comment">;modulation frequency</span>
aindex  <span class="opc">line</span>    p7, idur, p8			<span class="comment">;modulation index</span>

ar      <span class="opc">linseg</span>  1, .1, p9, p3<span class="op">-</span>.2, p10, .1, 1	<span class="comment">; r value envelope: p9-p10 =exp. partial strength parameter start and end</span>
amp1    <span class="op">=</span>       (aindex<span class="op">*</span>(ar<span class="op">+</span>(1<span class="op">/</span>ar)))<span class="op">/</span>2
afmod   <span class="opc">oscili</span>  amp1, imodfrq, 1		<span class="comment">;FM modulator (sine)</span>
atab    <span class="op">=</span>       (aindex<span class="op">*</span>(ar<span class="op">-</span>(1<span class="op">/</span>ar)))<span class="op">/</span>2		<span class="comment">;index to table</span>
alook   <span class="opc">tablei</span>  atab, 37			<span class="comment">;table lookup to GEN12</span>
aamod   <span class="opc">oscili</span>  atab, adev, 2			<span class="comment">;am modulator (cosine)</span>
aamod   <span class="op">=</span>       (<span class="opc">exp</span>(alook<span class="op">+</span>aamod))<span class="op">*</span>aenv
acar    <span class="opc">oscili</span>  aamod, afmod<span class="op">+</span>icarfrq, 1		<span class="comment">;AFM (carrier)</span>
asig    <span class="opc">balance</span> acar, aenv
        <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   8192    10  1               
<span class="stamnt">f</span> 2     0   8192    9   1 1 90          
<span class="stamnt">f</span>37 0   1024    -12 40		<span class="comment">;Bessel function-defined from 0 to 40</span>

<span class="stamnt">i</span> 1  0  2  .2  800  800    1    6   .1   2
<span class="stamnt">i</span> 1  +  .  .   1900 147    8    1    4   .2
<span class="stamnt">i</span> 1  .  .  .   1100 380    2    9   .5   2
<span class="stamnt">i</span> 1  .  10 .   100  100    11   3   .2   5
<span class="stamnt">s</span>
<span class="stamnt">i</span> 1  0  1 .1   200 100     1    6   .1   2
<span class="stamnt">i</span> 1  +  .  &lt;   &lt;    &lt;      &lt;    &lt;   &lt;    &lt;
<span class="stamnt">i</span> 1  +  .  .   &lt;    &lt;      &lt;    &lt;   &lt;    &lt;
<span class="stamnt">i</span> 1  +  .  .   &lt;    &lt;      &lt;    &lt;   &lt;    &lt;
<span class="stamnt">i</span> 1  +  .  .   &lt;    &lt;      &lt;    &lt;   &lt;    &lt;
<span class="stamnt">i</span> 1  +  .  .   &lt;    &lt;      &lt;    &lt;   &lt;    &lt;
<span class="stamnt">i</span> 1  +  .  .   &lt;    &lt;      &lt;    &lt;   &lt;    &lt;
<span class="stamnt">i</span> 1  +  10 .2  800  800    9    1   .9   6
<span class="stamnt">s</span>
<span class="stamnt">i</span> 1  0  11 .25 50   51     1    6   .1   2
<span class="stamnt">i</span> 1  1  9  .05 700  401    1    6   .1   2
<span class="stamnt">i</span> 1  2  8  .   900  147    8    1    4   .2
<span class="stamnt">i</span> 1  3  7  .   1100 381    2    9   .5   2
<span class="stamnt">i</span> 1  4  6  .   200  102    11   3   .2   5
<span class="stamnt">i</span> 1  5  6  .   800  803    9    1   .9   6
<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 GEN12 routines, as used in the example:</span>

      </p>
        <div class="mediaobject">
          <img src="images/gen12.png" alt="f 37 0 1024 -12 40 - Bessel function-defined from 0 to 40" />
          <div class="caption">
            <p>f 37 0 1024 -12 40 - Bessel function-defined from 0 to 40</p>
          </div>
        </div>
        <p>
   
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp77579880"></a>
        <h2>Credits</h2>
        <p>
      Example is, with minor modifications, taken from The Csound Book (page 87).
    </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="GEN11.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="GEN13.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">GEN11 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> GEN13</td>
        </tr>
      </table>
    </div>
  </body>
</html>