Sophie

Sophie

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

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>setksmps</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="setctrl.html" title="setctrl" />
    <link rel="next" href="setscorepos.html" title="setscorepos" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">setksmps</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="setctrl.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="setscorepos.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="setksmps">
      <a id="setksmps"></a>
      <div class="titlepage"></div>
      <a id="IndexSetksmps" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">setksmps</span>
        </h2>
        <p>setksmps — 
      Sets the local ksmps value in a user-defined opcode block.
    </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp42215328"></a>
        <h2>Description</h2>
        <p>
      Sets the local ksmps value in a user-defined opcode block.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp42216000"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>setksmps</strong></span> iksmps</pre>
      </div>
      <div class="refsect1" title="Initialization">
        <a id="idp42226456"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>iksmps</em></span> -- sets the local ksmps value.
    </p>
        <p>
      If <span class="emphasis"><em>iksmps</em></span> is set to zero, the <span class="emphasis"><em>ksmps</em></span> of the caller instrument or opcode is used (this is the default behavior).
    </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>
        The local <span class="emphasis"><em>ksmps</em></span> is implemented by splitting up a control period into smaller sub-kperiods and temporarily modifying internal Csound global variables. This also requires converting the rate of k-rate input and output arguments (input variables receive the same value in all sub-kperiods, while outputs are written only in the last one). It also means that you cannot use a local <a class="link" href="ksmps.html" title="ksmps"><em class="citetitle">ksmps</em></a> that is higher than the global <a class="link" href="ksmps.html" title="ksmps"><em class="citetitle">ksmps</em></a>.
      </p>
              </td>
            </tr>
          </table>
        </div>
        <div class="warning" title="Warning about local ksmps" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Warning: Warning about local ksmps">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Warning]" src="images/warning.png" />
              </td>
              <th align="left">Warning about local ksmps</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
        When the local <span class="emphasis"><em>ksmps</em></span> is not the same as the orchestra level <span class="emphasis"><em>ksmps</em></span> value (as specified in the orchestra header), global a-rate operations must not be used in the user-defined opcode block.
      </p>
                <p>
        These include:

        </p>
                <div class="itemizedlist">
                  <ul class="itemizedlist" type="disc">
                    <li class="listitem">
                      <p>any access to <span class="quote">“<span class="quote">ga</span>”</span> variables</p>
                    </li>
                    <li class="listitem">
                      <p>a-rate zak opcodes (<a class="link" href="zar.html" title="zar"><em class="citetitle">zar</em></a>, <a class="link" href="zaw.html" title="zaw"><em class="citetitle">zaw</em></a>, etc.)</p>
                    </li>
                    <li class="listitem">
                      <p><a class="link" href="tablera.html" title="tablera"><em class="citetitle">tablera</em></a> and <a class="link" href="tablewa.html" title="tablewa"><em class="citetitle">tablewa</em></a> (these two opcodes may in fact work, but caution is needed)</p>
                    </li>
                    <li class="listitem">
                      <p>The <span class="emphasis"><em>in</em></span> and <span class="emphasis"><em>out</em></span> opcode family (these read from, and write to global a-rate buffers)</p>
                    </li>
                  </ul>
                </div>
                <p>
      </p>
                <p>
        In general, the local <span class="emphasis"><em>ksmps</em></span> should be used with care as it is an experimental feature. Though it works correctly in most cases.
      </p>
              </td>
            </tr>
          </table>
        </div>
        <p>
      The <span class="emphasis"><em>setksmps</em></span> statement can be used to set the local <a class="link" href="ksmps.html" title="ksmps"><em class="citetitle">ksmps</em></a> value of the user-defined opcode block. It has one i-time parameter specifying the new <span class="emphasis"><em>ksmps</em></span> value (which is left unchanged if zero is used). <span class="emphasis"><em>setksmps</em></span> should be used before any other opcodes (but allowed after <a class="link" href="xin.html" title="xin"><em class="citetitle">xin</em></a>), otherwise unpredictable results may occur.
    </p>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp42271568"></a>
        <h2>Performance</h2>
        <p>
      The syntax of a user-defined opcode block is as follows:

      </p>
        <pre class="programlisting">
<span class="oblock">opcode</span>  name, outtypes, intypes
xinarg1 [, xinarg2] [, xinarg3] ... [xinargN]  <span class="opc">xin</span>
[<span class="opc">setksmps</span>  iksmps]
... the rest of the instrument's code.
<span class="opc">xout</span>  xoutarg1 [, xoutarg2] [, xoutarg3] ... [xoutargN]
<span class="oblock">endop</span>
      </pre>
        <p>
    </p>
        <p>
      The new opcode can then be used with the usual syntax:

      </p>
        <div class="literallayout">
          <p><br />
[xinarg1] [, xinarg2] ... [xinargN]  name  [xoutarg1] [, xoutarg2] ... [xoutargN] [, iksmps]<br />
      </p>
        </div>
        <p>
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp42275272"></a>
        <h2>Examples</h2>
        <p>
      See the example for the <a class="link" href="opcode.html" title="opcode"><em class="citetitle">opcode</em></a> opcode.
    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp42276392"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="endop.html" title="endop"><em class="citetitle">endop</em></a>, 
      <a class="link" href="opcode.html" title="opcode"><em class="citetitle">opcode</em></a>, 
      <a class="link" href="xin.html" title="xin"><em class="citetitle">xin</em></a>, 
      <a class="link" href="xout.html" title="xout"><em class="citetitle">xout</em></a>
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp42278856"></a>
        <h2>Credits</h2>
        <p>Author: Istvan Varga, 2002; based on code by Matt J. Ingalls</p>
        <p>New in version 4.22</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="setctrl.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="setscorepos.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">setctrl </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> setscorepos</td>
        </tr>
      </table>
    </div>
  </body>
</html>