Sophie

Sophie

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

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>times</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="timek.html" title="timek" />
    <link rel="next" href="timout.html" title="timout" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">times</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="timek.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="timout.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry" title="times">
      <a id="times"></a>
      <div class="titlepage"></div>
      <a id="IndexTimes" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">times</span>
        </h2>
        <p>times — 
      Read absolute time in seconds.
          </p>
      </div>
      <div class="refsect1" title="Description">
        <a id="idp48950048"></a>
        <h2>Description</h2>
        <p>
      Read absolute time, in seconds, since the start of the performance.
    </p>
      </div>
      <div class="refsect1" title="Syntax">
        <a id="idp48950824"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ires <span class="command"><strong>times</strong></span></pre>
        <pre class="synopsis">kres <span class="command"><strong>times</strong></span></pre>
      </div>
      <div class="refsect1" title="Performance">
        <a id="idp48961800"></a>
        <h2>Performance</h2>
        <p>
      Time in seconds is available with <span class="emphasis"><em>times</em></span>. This would return 0.5 after half a second. 
    </p>
        <p>
      <span class="emphasis"><em>times</em></span> can both produce a k-rate variable for output. There are no input parameters.
    </p>
        <p>
      <span class="emphasis"><em>times</em></span> can also operate at the start of the instance of the instrument. It produces an i-rate variable (starting with <span class="emphasis"><em>i</em></span> or <span class="emphasis"><em>gi</em></span>) as its output.
    </p>
      </div>
      <div class="refsect1" title="Examples">
        <a id="idp49026728"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the times opcode. It uses the file <a class="ulink" href="examples/times_complex.csd" target="_top"><em class="citetitle">times_complex.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp49027720"></a>
          <p class="title">
            <strong>Example 883. Example of the times opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
 
<span class="comment">; Select audio/midi flags here according to platform </span>
-odac     <span class="comment">;;;realtime audio out </span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too </span>
<span class="comment">; For Non-realtime ouput leave only the line below: </span>
<span class="comment">; -o times_complex.wav -W ;;; for file output any platform </span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>
 
<span class="comment">;by joachim heintz and rory walsh </span>
<span class="ohdr">sr</span> <span class="op">=</span> 44100 
<span class="ohdr">ksmps</span> <span class="op">=</span> 32 
<span class="ohdr">nchnls</span> <span class="op">=</span> 2 
<span class="ohdr">0dbfs</span> <span class="op">=</span> 1 

giWave   <span class="ohdr">ftgen</span>      0, 0, 1024, 10, 1, .5, .25 

<span class="oblock">instr</span> again 

instance <span class="op">=</span>          p4 
 <span class="comment">;reset the duration of this instance </span>
iDur     <span class="opc">rnd31</span>      5, 3				<span class="comment">;shorter values are more probable </span>
iDur     <span class="op">=</span>          <span class="opc">abs</span>(iDur) <span class="op">+</span> 0.2 
p3       <span class="op">=</span>          iDur 
 <span class="comment">;trigger the effect instrument of this instance </span>
         <span class="opc">event_i</span>    "i", "fx_processor", 0, iDur, instance 
 <span class="comment">;print the status quo </span>
kTime    <span class="opc">times</span> 
         <span class="opc">prints</span>     "instance <span class="op">=</span> <span class="op">%</span>d, start <span class="op">=</span> <span class="op">%</span>f, duration <span class="op">=</span> <span class="op">%</span>f\n", instance, <span class="opc">i</span>(kTime), iDur 
 <span class="comment">;make sound </span>
iamp     <span class="opc">active</span>     1					<span class="comment">;scale amplitudes </span>
iOct     <span class="opc">random</span>     5, 10				<span class="comment">;find pitch </span>
aEnv     <span class="opc">transeg</span>    0, 0.02, 0, 1<span class="op">/</span>iamp, p3<span class="op">-</span>0.02, <span class="op">-</span>6, 0	<span class="comment">;output envelope </span>
aSend    <span class="opc">poscil</span>     aEnv, <span class="opc">cpsoct</span>(iOct), giWave		<span class="comment">;audio signal </span>
 <span class="comment">;send signal to effect instrument </span>
Sbus     <span class="opc">sprintf</span>    "audio_<span class="op">%</span>d", instance		<span class="comment">;create unique software bus </span>
         <span class="opc">chnset</span>     aSend<span class="op">/</span>2, Sbus			<span class="comment">;send audio on this bus </span>
 <span class="comment">;get the last k-cycle of this instance and trigger the successor in it </span>
kLast    <span class="opc">release</span> 
         <span class="opc">schedkwhen</span> kLast, 0, 0, "again", 0, 1, instance<span class="op">+</span>1 
<span class="oblock">endin</span> 

<span class="oblock">instr</span> fx_processor 
 <span class="comment">;apply feedback delay to the above instrument </span>
iwhich    <span class="op">=</span>         p4					<span class="comment">;receive instance number ... </span>
Sbus      <span class="opc">sprintf</span>   "audio_<span class="op">%</span>d", iwhich			<span class="comment">; ... and related software bus </span>
audio     <span class="opc">chnget</span>    Sbus				<span class="comment">;receive audio on this bus </span>
irvbtim   <span class="opc">random</span>    1, 5				<span class="comment">;find reverb time </span>
p3        <span class="op">=</span>         p3<span class="op">+</span>irvbtim				<span class="comment">;adjust instrument duration </span>
iltptmL   <span class="opc">random</span>    .1, .5				<span class="comment">;find looptime left ... </span>
iltptmR   <span class="opc">random</span>    .1, .5				<span class="comment">;...and right </span>
ipan      <span class="opc">random</span>    0, 1				<span class="comment">; pan and ... </span>
imix      <span class="opc">random</span>    0, 1				<span class="comment">;... mix audio </span>
aL,aR     <span class="opc">pan2</span>      audio, ipan				<span class="comment">;create stereo </span>
awetL     <span class="opc">comb</span>      aL, irvbtim, iltptmL		<span class="comment">;comb filter </span>
awetR     <span class="opc">comb</span>      aR, irvbtim, iltptmR 
aoutL     <span class="opc">ntrpol</span>    aL, awetL, imix			<span class="comment">;wet-dry mix </span>
aoutR     <span class="opc">ntrpol</span>    aR, awetR, imix 
          <span class="opc">outs</span>      aoutL<span class="op">/</span>2, aoutR<span class="op">/</span>2 
<span class="oblock">endin</span> 

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
 
<span class="stamnt">i</span> "aga<span class="stamnt">i</span>n" 0 1 1 

<span class="stamnt">e</span> 3600 
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />

      Its output should include lines like these:
      </p>
        <pre class="screen">
new alloc for instr again:
instance = 1, start = 0.000000, duration = 0.650439
new alloc for instr fx_processor:
instance = 2, start = 0.650884, duration = 0.411043
new alloc for instr fx_processor:
instance = 3, start = 1.061587, duration = 0.231085
new alloc for instr fx_processor:
instance = 4, start = 1.292336, duration = 0.543473
new alloc for instr fx_processor:
instance = 5, start = 1.835828, duration = 1.777097
      </pre>
        <p>
    </p>
      </div>
      <div class="refsect1" title="See Also">
        <a id="idp49031280"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="timeinstk.html" title="timeinstk"><em class="citetitle">timeinstk</em></a>, <a class="link" href="timeinsts.html" title="timeinsts"><em class="citetitle">timeinsts</em></a>, <a class="link" href="timek.html" title="timek"><em class="citetitle">timek</em></a>
    </p>
      </div>
      <div class="refsect1" title="Credits">
        <a id="idp49033280"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Robin Whittle</td>
          </tr>
          <tr>
            <td>Australia</td>
          </tr>
          <tr>
            <td>May 1997</td>
          </tr>
        </table>
        <p>
    </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="timek.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="timout.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">timek </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> timout</td>
        </tr>
      </table>
    </div>
  </body>
</html>