Sophie

Sophie

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

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>GENtanh</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="GEN52.html" title="GEN52" />
    <link rel="next" href="GENexp.html" title="GENexp" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">GENtanh</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="GEN52.html">Prev</a> </td>
          <th width="60%" align="center">Score Statements and GEN Routines</th>
          <td width="20%" align="right"> <a accesskey="n" href="GENexp.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="GENtanh">
      <a id="GENtanh"></a>
      <div class="titlepage"></div>
      <a id="IndexGENtanh" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">GENtanh</span>
        </h2>
        <p>"tanh" — 
      Generate a table with values on the tanh function.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp78534984"></a>
        <h2>Description</h2>
        <p>
      Creates an ftable with values of the tanh function.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp78535648"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>f</strong></span> # time size "tanh" start end rescale</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp78546224"></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>start, end</em></span> -- first and last value to be stored; the GEN draws a curve that goes from start to end: tanh(start) .... tanh(end). The points stored are uniformly spaced between these to the table size
    </p>
        <p>
      <span class="emphasis"><em>rescale</em></span> -- if not zero the table is not rescaled
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp78583088"></a>
        <h2>Examples</h2>
        <p>
      Here is a simple example of the GENtanh routine. It uses the file <a class="ulink" href="examples/gentanh.csd" target="_top"><em class="citetitle">gentanh.csd</em></a>.
           </p>
        <div class="example">
          <a id="idp78584048"></a>
          <p class="title">
            <strong>Example 1073. Example of the GENtanh 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>
            <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 gentanh.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

aswp	<span class="opc">linseg</span>	0.01, p3<span class="op">*</span>.5, .49, p3<span class="op">*</span>.5, 0.01		<span class="comment">;index sweep function</span>
aindex	<span class="opc">poscil</span>	aswp, 110, 1				<span class="comment">;sound to waveshape</span>
atable	<span class="opc">tablei</span>	aindex, p4, 1, .5			<span class="comment">;waveshape index</span>
aenv	<span class="opc">linen</span>	0.8, .01, p3, .02			<span class="comment">;amplitude envelope</span>
asig	<span class="op">=</span> (atable<span class="op">*</span>aenv)<span class="op">*</span>p5				<span class="comment">;impose envelope and scale</span>
asig    <span class="opc">dcblock2</span> asig					<span class="comment">;get rid of DC</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 8192 10 1	<span class="comment">;sine wave</span>
<span class="stamnt">f</span> 2 0 8192 "tanh" -100 100 0	<span class="comment">;symmetrical transfer fuction</span>
<span class="stamnt">f</span> 3 0 8192 "tanh" -10  10  0	<span class="comment">;symmetrical</span>
<span class="stamnt">f</span> 4 0 8192 "tanh"   0  10  0	<span class="comment">;not symmetrical</span>

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

      </p>
        <div class="mediaobject">
          <img src="images/gentanh_1.png" alt="f 2 0 8192 &quot;tanh&quot; -100 100 0 - lots of distortion" />
          <div class="caption">
            <p>  f 2 0 8192 "tanh" -100 100 0 - lots of distortion</p>
          </div>
        </div>
        <p>

      </p>
        <div class="mediaobject">
          <img src="images/gentanh_2.png" alt="f 3 0 8192 &quot;tanh&quot; -10 10 0 - less distortion than f2" />
          <div class="caption">
            <p>  f 3 0 8192 "tanh" -10 10 0 - less distortion than f2</p>
          </div>
        </div>
        <p>

      </p>
        <div class="mediaobject">
          <img src="images/gentanh_3.png" alt="f 4 0 8192 &quot;tanh&quot; -10 15 0" />
          <div class="caption">
            <p>  f 4 0 8192 "tanh" -10 15 0</p>
          </div>
        </div>
        <p>
    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp78591784"></a>
        <h2>See Also</h2>
        <p>
       <a class="link" href="GENexp.html" title="GENexp"><em class="citetitle">GENexp</em></a> and
       <a class="link" href="GENsone.html" title="GENsone"><em class="citetitle">GENsone</em></a>.
          </p>
        <p> More information on this routine: <a class="ulink" href="http://www.csounds.com/journal/issue11/distortionSynthesis.html" target="_top"><em class="citetitle">http://www.csounds.com/journal/issue11/distortionSynthesis</em></a>, written by Victor Lazzarini</p>
        <p>
     </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp78594096"></a>
        <h2>Credits</h2>
        <p>Written by John ffitch</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="GEN52.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="GENexp.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">GEN52 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> GENexp</td>
        </tr>
      </table>
    </div>
  </body>
</html>