<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="kr">
  <refmeta>
    <refentrytitle>kr</refentrytitle>
  </refmeta>

  <refnamediv>
    <refname>kr</refname>

    <refpurpose>
      Sets the control rate.
      <indexterm id="IndexKr"><primary>kr</primary></indexterm>
    </refpurpose>
  </refnamediv>
  
  <refsect1>
    <title>Description</title>
    <para> 
      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.
    </para>
  </refsect1>

  <refsect1>
    <title>Syntax</title>
    <synopsis><command>kr</command> = iarg</synopsis>
  </refsect1>

  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>kr</emphasis> = (optional) -- set control rate to <emphasis>iarg</emphasis> samples per second. The default value is 1000.
    </para>

    <para>
      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.
    </para>

    <para>
      Beginning with Csound version 3.46, <emphasis>kr</emphasis> can be omitted. Csound will attempt to calculate the omitted value from the specified values, but it should evaluate to an integer.
    </para>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>
      <informalexample>
        <programlisting>
<command>sr</command> = 10000
<command>kr</command> = 500
<command>ksmps</command> = 20
gi1 <command>= </command>sr/2.
ga <command>init </command>0
itranspose <command>= </command>octpch(.0l)
        </programlisting>
      </informalexample>
    </para>
  </refsect1>

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="ksmps"><citetitle>ksmps</citetitle></link>,
      <link linkend="nchnls"><citetitle>nchnls</citetitle></link>,
      <link linkend="sr"><citetitle>sr</citetitle></link>
    </para>
  </refsect1>
</refentry>
