| 1 | |
| 2 | <refentry id="ksmps"> |
| 3 | <indexterm id="IndexKsmps"><primary>ksmps</primary></indexterm> |
| 4 | <refentryinfo><title>Orchestra Syntax:Header</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>ksmps</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>ksmps</refname> |
| 11 | |
| 12 | <refpurpose> |
| 13 | Sets the number of samples in a control period. |
| 14 | </refpurpose> |
| 15 | </refnamediv> |
| 16 | |
| 17 | <refsect1> |
| 18 | <title>Description</title> |
| 19 | <para> |
| 20 | These statements are global value <link linkend="assign"><citetitle>assignments</citetitle></link>, made at the beginning of an orchestra, before any instrument block is defined. Their function is to set certain <link linkend="VariableTypes"><citetitle>reserved symbol variables</citetitle></link> that are required for performance. Once set, these reserved symbols can be used in expressions anywhere in the orchestra. |
| 21 | </para> |
| 22 | </refsect1> |
| 23 | |
| 24 | <refsect1> |
| 25 | <title>Syntax</title> |
| 26 | <synopsis><command>ksmps</command> = iarg</synopsis> |
| 27 | </refsect1> |
| 28 | |
| 29 | <refsect1> |
| 30 | <title>Initialization</title> |
| 31 | <para> |
| 32 | <emphasis>ksmps</emphasis> = (optional) -- set the number of samples in a control period. This value must equal<emphasis> sr/kr</emphasis>. The default value is 10. |
| 33 | </para> |
| 34 | |
| 35 | <para> |
| 36 | In addition, any <link linkend="GlobalVariables"><citetitle>global variable</citetitle></link> can be initialized by an <emphasis>init-time assignment</emphasis> anywhere before the first <link linkend="instr"><citetitle>instr statement</citetitle></link>. All of the above assignments are run as instrument 0 (i-pass only) at the start of real performance. |
| 37 | </para> |
| 38 | |
| 39 | <para> |
| 40 | Beginning with Csound version 3.46, either <emphasis>ksmps</emphasis> may be omitted. Csound will attempt to calculate the omitted value from the specified <link linkend="sr"><citetitle>sr</citetitle></link> and <link linkend="kr"><citetitle>kr</citetitle></link>values, but it should evaluate to an integer. |
| 41 | </para> |
| 42 | |
| 43 | <warning> |
| 44 | <title>Warning</title> |
| 45 | <para> |
| 46 | ksmps must be an integer value. |
| 47 | </para> |
| 48 | </warning> |
| 49 | </refsect1> |
| 50 | |
| 51 | <refsect1> |
| 52 | <title>Examples</title> |
| 53 | <para> |
| 54 | Here is an example of the ksmps opcode. It uses the file <ulink url="examples/ksmps.csd"><citetitle>ksmps.csd</citetitle></ulink>. |
| 55 | <example> |
| 56 | <title>Example of the ksmps opcode.</title> |
| 57 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 58 | <xi:include href="examples-xml/ksmps.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 59 | </example> |
| 60 | </para> |
| 61 | </refsect1> |
| 62 | |
| 63 | <refsect1> |
| 64 | <title>See also</title> |
| 65 | <para><link linkend="OrchHeader"><citetitle>Orchestra Header Statements</citetitle></link></para> |
| 66 | </refsect1> |
| 67 | |
| 68 | <refsect1> |
| 69 | <title>Credits</title> |
| 70 | <para>Thanks to a note from &namegabriel;, added a warning about integer values.</para> |
| 71 | </refsect1> |
| 72 | </refentry> |