<?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>ksmps</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="OpcodesTop.html" title="Orchestra Opcodes and Operators" /> <link rel="prev" href="kr.html" title="kr" /> <link rel="next" href="lenarray.html" title="lenarray" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">ksmps</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="kr.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="lenarray.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry"> <a id="ksmps"></a> <div class="titlepage"></div> <a id="IndexKsmps" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">ksmps</span> </h2> <p>ksmps — Sets the number of samples in a control period. </p> </div> <div class="refsect1"> <a id="idm281472921306408"></a> <h2>Description</h2> <p> These statements are global value <a class="link" href="assign.html" title="="><em class="citetitle">assignments</em></a>, made at the beginning of an orchestra, before any instrument block is defined. Their function is to set certain <a class="link" href="OrchKvar.html#VariableTypes" title="Table 3. Types of Variables"><em class="citetitle">reserved symbol variables</em></a> that are required for performance. Once set, these reserved symbols can be used in expressions anywhere in the orchestra. </p> </div> <div class="refsect1"> <a id="idm281472921230824"></a> <h2>Syntax</h2> <pre class="synopsis"><span class="command"><strong>ksmps</strong></span> = iarg</pre> </div> <div class="refsect1"> <a id="idm281472921228808"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>ksmps</em></span> = (optional) -- set the number of samples in a control period. This value must equal<span class="emphasis"><em> sr/kr</em></span>. The default value is 10. </p> <p> In addition, any <a class="link" href="OrchKvar.html#GlobalVariables"><em class="citetitle">global variable</em></a> can be initialized by an <span class="emphasis"><em>init-time assignment</em></span> anywhere before the first <a class="link" href="instr.html" title="instr"><em class="citetitle">instr statement</em></a>. All of the above assignments are run as instrument 0 (i-pass only) at the start of real performance. </p> <p> Beginning with Csound version 3.46, either <span class="emphasis"><em>ksmps</em></span> may be omitted. Csound will attempt to calculate the omitted value from the specified <a class="link" href="sr.html" title="sr"><em class="citetitle">sr</em></a> and <a class="link" href="kr.html" title="kr"><em class="citetitle">kr</em></a>values, but it should evaluate to an integer. </p> <div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"> <table border="0" summary="Warning: Warning"> <tr> <td rowspan="2" align="center" valign="top" width="25"> <img alt="[Warning]" src="images/warning.png" /> </td> <th align="left">Warning</th> </tr> <tr> <td align="left" valign="top"> <p> ksmps must be an integer value. </p> </td> </tr> </table> </div> </div> <div class="refsect1"> <a id="idm281472921219784"></a> <h2>Examples</h2> <p> </p> <div class="informalexample"> <pre class="programlisting"> <span class="ohdr">sr</span> <span class="op">=</span> 10000 <span class="ohdr">kr</span> <span class="op">=</span> 500 <span class="ohdr">ksmps</span> <span class="op">=</span> 20 gi1 <span class="op">=</span> <span class="ohdr">sr</span><span class="op">/</span>2. ga <span class="opc">init</span> 0 itranspose <span class="op">=</span> <span class="opc">octpch</span>(.0l)</pre> </div> <p> </p> </div> <div class="refsect1"> <a id="idm281472921209784"></a> <h2>See Also</h2> <p> <a class="link" href="kr.html" title="kr"><em class="citetitle">kr</em></a>, <a class="link" href="nchnls.html" title="nchnls"><em class="citetitle">nchnls</em></a>, <a class="link" href="nchnls_i.html" title="nchnls_i"><em class="citetitle">nchnls_i</em></a>, <a class="link" href="sr.html" title="sr"><em class="citetitle">sr</em></a> </p> </div> <div class="refsect1"> <a id="idm281472921204888"></a> <h2>Credits</h2> <p>Thanks to a note from Gabriel Maldonado, added a warning about integer values.</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="kr.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="lenarray.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">kr </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> lenarray</td> </tr> </table> </div> </body> </html>