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

    <refpurpose>
      Read absolute time in k-rate cycles.
      <indexterm id="IndexTimek"><primary>timek</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Read absolute time, in k-rate cycles, since the start of the performance.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis>ir <command>timek</command></synopsis>

    <synopsis>kr <command>timek</command></synopsis>
  </refsect1>

  <refsect1>
    <title>Performance</title>
    <para>
      <emphasis>timek</emphasis> is for time in k-rate cycles. So with:

      <informalexample>
        <programlisting>
  <emphasis>sr</emphasis>    = 44100 
  <emphasis>kr</emphasis>    = 6300 
  <emphasis>ksmps</emphasis> = 7
        </programlisting>
      </informalexample>

      then after half a second, the <emphasis>timek</emphasis> opcode would report 3150. It will always report an integer.
    </para>

    <para>
      <emphasis>timek</emphasis> can produce a k-rate variable for output. There are no input parameters.
    </para>

    <para>
      <emphasis>timek</emphasis> can also operate only at the start of the instance of the instrument. It produces an i-rate variable (starting with <emphasis>i</emphasis> or <emphasis>gi</emphasis>) as its output.
    </para>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>
      Here is an example of the timek opcode. It uses the files <ulink url="examples/timek.orc"><citetitle>timek.orc</citetitle></ulink> and <ulink url="examples/timek.sco"><citetitle>timek.sco</citetitle></ulink>.

      <example>
        <title>Example of the timek opcode.</title>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/timek.orc" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/timek.sco" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>
      </example>

      Its output should include lines like this:
      <screen>
k1 = 1.000000 samples
k1 = 2205.000000 samples
k1 = 4410.000000 samples
k1 = 6615.000000 samples
k1 = 8820.000000 samples
      </screen>
    </para>
  </refsect1>

  <refsect1>
    <title>See Also</title>
    <para>
      <link linkend="timeinstk"><citetitle>timeinstk</citetitle></link>, <link linkend="timeinsts"><citetitle>timensts</citetitle></link>, <link linkend="times"><citetitle>times</citetitle></link>
    </para>
  </refsect1>

  <refsect1>
    <title>Credits</title>
    <para>
      <simplelist>
        <member>Author: Robin Whittle</member>
        <member>Australia</member>
        <member>May 1997</member>
      </simplelist>
    </para>
    <para>Example written by &namekevin;.</para>
  </refsect1>
</refentry>
