Sophie

Sophie

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

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>init</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="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="inh.html" title="inh" />
    <link rel="next" href="initc14.html" title="initc14" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">init</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="inh.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="initc14.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="init">
      <a id="init"></a>
      <div class="titlepage"></div>
      <a id="IndexInit" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">init</span>
        </h2>
        <p>init — 
       Puts the value of the i-time expression into a k-, a-rate or t- variable.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp26916016"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ares <span class="command"><strong>init</strong></span> iarg</pre>
        <pre class="synopsis">ires <span class="command"><strong>init</strong></span> iarg</pre>
        <pre class="synopsis">kres <span class="command"><strong>init</strong></span> iarg</pre>
        <pre class="synopsis">ares, ...  <span class="command"><strong>init</strong></span> iarg, ...</pre>
        <pre class="synopsis">ires, ... <span class="command"><strong>init</strong></span> iarg, ...</pre>
        <pre class="synopsis">kres, ... <span class="command"><strong>init</strong></span> iarg, ...</pre>
        <pre class="synopsis">tab <span class="command"><strong>init</strong></span> isize[, ival]</pre>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp26958976"></a>
        <h2>Description</h2>
        <p> 
      Put the value of the i-time expression into a k- or a-rate variable.
    </p>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp26959656"></a>
        <h2>Initialization</h2>
        <p>
      Puts the value of the i-time expression
      <span class="emphasis"><em>iarg</em></span> into a k-, a-rate or t- variable, i.e.,
      initialize the result. Note that <span class="strong"><strong>init</strong></span> provides the only case of an
      init-time statement being permitted to write into a perf-time
      (k- or a-rate) result cell; the statement has no effect at
      perf-time.
    </p>
        <p>
      Since version 5.13 it is possible to initialise upto 24
      variables of the same class in one statement.  If there are more
      output variables than input expressions then the last one is
      repeated.  It is an error to have more inputs than outputs.
    </p>
        <p>
      The t-variable form was introduced in 5.14 and allocated space
      for a vector or the given size, initialised to the given value
      (default value is zero).
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp26962000"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the init opcode. It uses the file <a class="ulink" href="examples/init.csd" target="_top"><em class="citetitle">init.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp26962968"></a>
          <p class="title">
            <strong>Example 364. Example of the init 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>
-n  <span class="comment">;no sound output</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 <span class="comment">;shows what init does</span>
        kinit <span class="opc">init</span> 0 
        kinit <span class="op">=</span> kinit <span class="op">+</span> 1 
        <span class="opc">printk</span> .1, kinit 
<span class="oblock">endin</span> 

<span class="oblock">instr</span> 2 <span class="comment">;shows what an assignment does</span>
        knoinit <span class="op">=</span> 0 
        knoinit <span class="op">=</span> knoinit <span class="op">+</span> 1 
        <span class="opc">printk</span> .1, knoinit 
<span class="oblock">endin</span> 
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
 
<span class="comment">;play one second each</span>
<span class="stamnt">i</span>1 0 1 
<span class="stamnt">i</span>2 2 1 
<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" />
            Its output should include lines like these:
      </p>
        <pre class="screen">
 i   1 time     0.00073:     1.00000
 i   1 time     0.10014:   138.00000
 i   1 time     0.20027:   276.00000
 i   1 time     0.30041:   414.00000
 i   1 time     0.40054:   552.00000
 i   1 time     0.50068:   690.00000
 i   1 time     0.60009:   827.00000
 i   1 time     0.70023:   965.00000
 i   1 time     0.80036:  1103.00000
 i   1 time     0.90050:  1241.00000

 i   2 time     2.00054:     1.00000
 i   2 time     2.09995:     1.00000
 i   2 time     2.20009:     1.00000
 i   2 time     2.30023:     1.00000
 i   2 time     2.40036:     1.00000
 i   2 time     2.50050:     1.00000
 i   2 time     2.59991:     1.00000
 i   2 time     2.70005:     1.00000
 i   2 time     2.80018:     1.00000
 i   2 time     2.90032:     1.00000
      </pre>
        <p>
    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp26966376"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="assign.html" title="="><em class="citetitle">=</em></a>,
      <a class="link" href="divz.html" title="divz"><em class="citetitle">divz</em></a>,
      <a class="link" href="tival.html" title="tival"><em class="citetitle">tival</em></a>
    </p>
        <p> Other information on this opcode in the Floss Manuals: <a class="ulink" href="http://www.flossmanuals.net/csound/ch016_a-initialization-and-performance-pass" target="_top"><em class="citetitle">http://www.flossmanuals.net/csound/ch016_a-initialization-and-performance-pass</em></a></p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp26969128"></a>
        <h2>Credits</h2>
        <p>
      Init first appeared in the original Csound, but the extension to
      multiple values is by
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: John ffitch</td>
          </tr>
          <tr>
            <td>University of Bath, and Codemist Ltd.</td>
          </tr>
          <tr>
            <td>Bath, UK</td>
          </tr>
          <tr>
            <td>February 2010</td>
          </tr>
        </table>
        <p>
    </p>
        <p>Multiple form new in version 5.13; t-variable form new in 5.14.</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="inh.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="initc14.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">inh </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> initc14</td>
        </tr>
      </table>
    </div>
  </body>
</html>