Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 5fcfcb7517038d1f44ab4e478e6e61fa > files > 143

csound-doc-6.10.0-1.mga7.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>GEN20</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <link rel="stylesheet" type="text/css" href="syntax-highlighting.css" />
    <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" />
    <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="GEN19.html" title="GEN19" />
    <link rel="next" href="GEN21.html" title="GEN21" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">GEN20</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="GEN19.html">Prev</a> </td>
          <th width="60%" align="center">Score Statements and GEN Routines</th>
          <td width="20%" align="right"> <a accesskey="n" href="GEN21.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="GEN20"></a>
      <div class="titlepage"></div>
      <a id="IndexGEN20" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">GEN20</span>
        </h2>
        <p>GEN20 — 
      Generates functions of different windows.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472819235976"></a>
        <h2>Description</h2>
        <p>
      This subroutine generates functions of different windows. These windows are usually used for spectrum analysis or for grain envelopes.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472819234632"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>f</strong></span> # time size 20 window max [opt]</pre>
      </div>
      <div class="refsect1">
        <a id="idm281472819153608"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>size</em></span> -- number of points in the table. Must be a power of 2 ( + 1).
    </p>
        <p>
      <span class="emphasis"><em>window</em></span> -- Type of window to generate:

      </p>
        <div class="itemizedlist">
          <ul class="itemizedlist" style="list-style-type: disc; ">
            <li class="listitem">
              <p>1 = Hamming</p>
            </li>
            <li class="listitem">
              <p>2 = Hanning</p>
            </li>
            <li class="listitem">
              <p>3 = Bartlett ( triangle)</p>
            </li>
            <li class="listitem">
              <p>4 = Blackman ( 3-term)</p>
            </li>
            <li class="listitem">
              <p>5 = Blackman - Harris ( 4-term)</p>
            </li>
            <li class="listitem">
              <p>6 = Gaussian</p>
            </li>
            <li class="listitem">
              <p>7 = Kaiser</p>
            </li>
            <li class="listitem">
              <p>8 = Rectangle</p>
            </li>
            <li class="listitem">
              <p>9 = Sync</p>
            </li>
          </ul>
        </div>
        <p>
    </p>
        <p>
      <span class="emphasis"><em>max</em></span> -- For negative p4 this will be the absolute 
      value at window peak point. If p4 is positive or p4 is negative
      and p6 is missing the table will be post-rescaled to a maximum
      value of 1. 
    </p>
        <p>
      <span class="emphasis"><em>opt</em></span> -- Optional argument required by the 
      Gaussian window and the Kaiser window.
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472819141768"></a>
        <h2>Examples</h2>
        <p>
      </p>
        <div class="informalexample">
          <pre class="programlisting">
<span class="stamnt">f</span>       1       0       1024    20      5</pre>
        </div>
        <p>

      This creates a function which contains a 4 - term Blackman - Harris window with maximum value of 1.
    </p>
        <p>
      </p>
        <div class="informalexample">
          <pre class="programlisting">
<span class="stamnt">f</span>       1       0       1024    -20     2       456</pre>
        </div>
        <p>

      This creates a function that contains a Hanning window with a maximum value of 456.
    </p>
        <p>
      </p>
        <div class="informalexample">
          <pre class="programlisting">
<span class="stamnt">f</span>       1       0       1024    -20     1</pre>
        </div>
        <p>

      This creates a function that contains a Hamming window with a maximum value of 1.
    </p>
        <p>
      </p>
        <div class="informalexample">
          <pre class="programlisting">
<span class="stamnt">f</span>       1       0       1024    20      7       1       2</pre>
        </div>
        <p>

      This creates a function that contains a Kaiser window with a maximum value of 1. The extra argument specifies how "open" the window is, for example a value of 0 results in a rectangular window and a value of 10 in a Hamming like window.
    </p>
        <p>
      </p>
        <div class="informalexample">
          <pre class="programlisting">
<span class="stamnt">f</span>       1       0       1024    20      6       1       2</pre>
        </div>
        <p>

      This creates a function that contains a Gaussian window with a
      maximum value of 1.  The extra argument specifies how broad the
      window is, as the standard deviation of the curve; in this
      example the s.d. is 2.  The default value is 1.
    </p>
        <p>
      For all diagrams, see <a class="link" href="MiscWindows.html" title="Appendix F. Window Functions"><em class="citetitle">Window Functions</em></a>
    </p>
        <p>
      Here is an example of the GEN20 routine. It uses the file <a class="ulink" href="examples/gen20.csd" target="_top"><em class="citetitle">gen20.csd</em></a>.

           </p>
        <div class="example">
          <a id="idm281472819126296"></a>
          <p class="title">
            <strong>Example 1201. Example of the GEN20 routine.</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>
            <div class="refsect1">
              <a id="idm281472680605176"></a>
              <pre class="programlisting">
<span class="nt">&lt;CsoundSynthesizer&gt;</span> 
<span class="nt">&lt;CsOptions&gt;</span> 
<span class="c1">; Select audio/midi flags here according to platform </span>
-odac     <span class="c1">;;;realtime audio out </span>
<span class="c1">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too </span>
<span class="c1">; For Non-realtime ouput leave only the line below: </span>
<span class="c1">; -o gen20.wav -W ;;; for file output any platform </span>
<span class="nt">&lt;/CsOptions&gt;</span> 
<span class="nt">&lt;CsInstruments&gt;</span> 

<span class="vg">sr</span> <span class="o">=</span> <span class="mi">44100</span> 
<span class="vg">ksmps</span> <span class="o">=</span> <span class="mi">32</span> 
<span class="vg">nchnls</span> <span class="o">=</span> <span class="mi">2</span> 
<span class="vg">0dbfs</span>  <span class="o">=</span> <span class="mi">1</span> 

<span class="kd">instr</span> <span class="nf">1</span> 

i<span class="n">nsnd</span>   <span class="o">=</span> <span class="mi">10</span> 				<span class="c1">;"fox.wav"</span>
i<span class="n">basfrq</span> <span class="o">=</span> <span class="mi">44100</span> <span class="o">/</span> <span class="nb">ftlen</span><span class="p">(</span>i<span class="n">nsnd</span><span class="p">)</span>		<span class="c1">;use original sample rate of insnd file </span>

k<span class="n">amp</span>   <span class="nb">expseg</span> <span class="mf">.001</span><span class="p">,</span> <span class="nb">p3</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span> <span class="mf">.7</span><span class="p">,</span> <span class="nb">p3</span><span class="o">/</span><span class="mi">2</span><span class="p">,</span> <span class="mf">.8</span>	<span class="c1">;envelope</span>
k<span class="n">pitch</span> <span class="nb">line</span> i<span class="n">basfrq</span><span class="p">,</span> <span class="nb">p3</span><span class="p">,</span> i<span class="n">basfrq</span> <span class="o">*</span> <span class="mf">.8</span> 
k<span class="n">dens</span>  <span class="nb">line</span> <span class="mi">600</span><span class="p">,</span> <span class="nb">p3</span><span class="p">,</span> <span class="mi">10</span> 
k<span class="n">aoff</span>  <span class="nb">line</span> <span class="mi">0</span><span class="p">,</span> <span class="nb">p3</span><span class="p">,</span> <span class="mf">.1</span>
k<span class="n">poff</span>  <span class="nb">line</span> <span class="mi">0</span><span class="p">,</span> <span class="nb">p3</span><span class="p">,</span> i<span class="n">basfrq</span> <span class="o">*</span> <span class="mf">.5</span> 
k<span class="n">gdur</span>  <span class="nb">line</span> <span class="mf">.04</span><span class="p">,</span> <span class="nb">p3</span><span class="p">,</span> <span class="mf">.001</span>		<span class="c1">;shorten duration of grain during note</span>
i<span class="n">maxgdur</span> <span class="o">=</span>  <span class="mf">.5</span> 
i<span class="n">gfn</span> <span class="o">=</span> <span class="nb">p4</span> 				<span class="c1">;different windows</span>
a<span class="n">sigL</span>  <span class="nb">grain</span> k<span class="n">amp</span><span class="p">,</span> k<span class="n">pitch</span><span class="p">,</span> k<span class="n">dens</span><span class="p">,</span> k<span class="n">aoff</span><span class="p">,</span> k<span class="n">poff</span><span class="p">,</span> k<span class="n">gdur</span><span class="p">,</span> i<span class="n">nsnd</span><span class="p">,</span> i<span class="n">gfn</span><span class="p">,</span> i<span class="n">maxgdur</span><span class="p">,</span> <span class="mf">0.0</span> 
a<span class="n">sigR</span>  <span class="nb">grain</span> k<span class="n">amp</span><span class="p">,</span> k<span class="n">pitch</span><span class="p">,</span> k<span class="n">dens</span><span class="p">,</span> k<span class="n">aoff</span><span class="p">,</span> k<span class="n">poff</span><span class="p">,</span> k<span class="n">gdur</span><span class="p">,</span> i<span class="n">nsnd</span><span class="p">,</span> i<span class="n">gfn</span><span class="p">,</span> i<span class="n">maxgdur</span><span class="p">,</span> <span class="mf">0.0</span> 
       <span class="nb">outs</span> a<span class="n">sigL</span><span class="p">,</span> a<span class="n">sigR</span>

<span class="kd">endin</span> 
<span class="nt">&lt;/CsInstruments&gt;</span> 
<span class="nt">&lt;CsScore&gt;</span> 
<span class="nb">f</span><span class="mi">1</span>  <span class="mi">0</span> <span class="mi">512</span>  <span class="mi">20</span> <span class="mi">2</span>		<span class="c1">;Hanning window </span>
<span class="nb">f</span><span class="mi">2</span>  <span class="mi">0</span> <span class="mi">512</span>  <span class="mi">20</span> <span class="mi">6</span> <span class="mi">1</span>	<span class="c1">;Gaussian window </span>
<span class="nb">f</span><span class="mi">10</span> <span class="mi">0</span> <span class="mi">16384</span> <span class="mi">1</span> <span class="s">"fox.wav"</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">0</span> 

<span class="nb">i</span><span class="mi">1</span> <span class="mi">0</span> <span class="mi">5</span> <span class="mi">1</span>		<span class="c1">;use Hanning window </span>
<span class="nb">i</span><span class="mi">1</span> <span class="o">+</span> <span class="mi">5</span> <span class="mi">2</span>		<span class="c1">;use Gaussian window</span>
<span class="nb">e</span> 
<span class="nt">&lt;/CsScore&gt;</span> 
<span class="nt">&lt;/CsoundSynthesizer&gt;</span> 
</pre>
            </div>
          </div>
        </div>
        <p><br class="example-break" />  
        <span class="phrase">These are the diagrams of the waveforms of the GEN20 routines, as used in the example:</span>

      </p>
        <div class="mediaobject">
          <img src="images/gen20_1.png" alt="f 1 0 512 20 2 - Hanning window" />
          <div class="caption">
            <p>  f 1  0 512 20 2 - Hanning window</p>
          </div>
        </div>
        <p>

      </p>
        <div class="mediaobject">
          <img src="images/gen20_2.png" alt="f 2 0 512 20 6 1 - Gaussian window" />
          <div class="caption">
            <p>  f 2  0 512 20 6 1 - Gaussian window</p>
          </div>
        </div>
        <p>
   
    </p>
      </div>
      <div class="refsect1">
        <a id="idm281472819114920"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Paris Smaragdis</td>
          </tr>
          <tr>
            <td>MIT, Cambridge</td>
          </tr>
          <tr>
            <td>1995</td>
          </tr>
        </table>
        <p>
    </p>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: John ffitch</td>
          </tr>
          <tr>
            <td>University of Bath/Codemist Ltd.</td>
          </tr>
          <tr>
            <td>Bath, UK</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 3.2</p>
        <p>Optional argument to Gaussian added in 5.10</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="GEN19.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="GEN21.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">GEN19 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> GEN21</td>
        </tr>
      </table>
    </div>
  </body>
</html>