<?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>tempo</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="tempest.html" title="tempest" /> <link rel="next" href="temposcal.html" title="temposcal" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">tempo</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="tempest.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="temposcal.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="tempo"> <a id="tempo"></a> <div class="titlepage"></div> <a id="IndexTempo" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">tempo</span> </h2> <p>tempo — Apply tempo control to an uninterpreted score. </p> </div> <div class="refsect1" title="Description"> <a id="idp48709712"></a> <h2>Description</h2> <p> Apply tempo control to an uninterpreted score. </p> </div> <div class="refsect1" title="Syntax"> <a id="idp48710448"></a> <h2>Syntax</h2> <pre class="synopsis"><span class="command"><strong>tempo</strong></span> ktempo, istartempo</pre> </div> <div class="refsect1" title="Initialization"> <a id="idp48755904"></a> <h2>Initialization</h2> <p> <span class="emphasis"><em>istartempo</em></span> -- initial tempo (in beats per minute). Typically 60. </p> </div> <div class="refsect1" title="Performance"> <a id="idp48756856"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>ktempo</em></span> -- The tempo to which the score will be adjusted. </p> <p> <span class="emphasis"><em>tempo</em></span> allows the performance speed of Csound scored events to be controlled from within an orchestra. It operates only in the presence of the Csound <a class="link" href="CommandFlags.html#FlagsMinusLowerT"><em class="citetitle">-t</em></a> flag. When that flag is set, scored events will be performed from their uninterpreted p2 and p3 (beat) parameters, initially at the given command-line tempo. When a <span class="emphasis"><em>tempo</em></span> statement is activated in any instrument (<span class="emphasis"><em>ktempo</em></span> 0.), the operating tempo will be adjusted to <span class="emphasis"><em>ktempo</em></span> beats per minute. There may be any number of <span class="emphasis"><em>tempo</em></span> statements in an orchestra, but coincident activation is best avoided. </p> </div> <div class="refsect1" title="Examples"> <a id="idp48760240"></a> <h2>Examples</h2> <p> Here is an example of the tempo opcode. Remember, it only works if you use the <a class="link" href="CommandFlags.html#FlagsMinusLowerT"><em class="citetitle">-t</em></a> flag with Csound. The example uses the file <a class="ulink" href="examples/tempo.csd" target="_top"><em class="citetitle">tempo.csd</em></a>. </p> <div class="example"> <a id="idp48761736"></a> <p class="title"> <strong>Example 875. Example of the tempo 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"><CsoundSynthesizer></span> <span class="csdtag"><CsOptions></span> <span class="comment">; Select audio/midi flags here according to platform</span> <span class="comment">; Audio out Audio in</span> -odac -iadc -t60 <span class="comment">;;;RT audio I/O</span> <span class="comment">; For Non-realtime ouput leave only the line below:</span> <span class="comment">; -o tempo.wav -W -t60 ;;; for file output any platform</span> <span class="csdtag"></CsOptions></span> <span class="csdtag"><CsInstruments></span> <span class="comment">; Initialize the global variables.</span> <span class="ohdr">sr</span> <span class="op">=</span> 44100 <span class="ohdr">kr</span> <span class="op">=</span> 4410 <span class="ohdr">ksmps</span> <span class="op">=</span> 10 <span class="ohdr">nchnls</span> <span class="op">=</span> 1 <span class="comment">; Instrument #1.</span> <span class="oblock">instr</span> 1 kval <span class="opc">tempoval</span> <span class="opc">printk</span> 0.1, kval <span class="comment">; If the fourth p-field is 1, increase the tempo.</span> <span class="octrl">if</span> (p4 <span class="op">==</span> 1) <span class="octrl">kgoto</span> <span class="olabel">speedup</span> <span class="octrl">kgoto</span> <span class="olabel">playit</span> <span class="olabel">speedup</span><span class="op">:</span> <span class="comment">; Increase the tempo to 150 beats per minute.</span> <span class="opc">tempo</span> 150, 60 <span class="olabel">playit</span><span class="op">:</span> a1 <span class="opc">oscil</span> 10000, 440, 1 <span class="opc">out</span> a1 <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="comment">; Table #1, a sine wave.</span> <span class="stamnt">f</span> 1 0 16384 10 1 <span class="comment">; p4 = plays at a faster tempo (when p4=1).</span> <span class="comment">; Play Instrument #1 at the normal tempo, repeat 3 times.</span> <span class="stamnt">r</span>3 <span class="stamnt">i</span> 1 00.00 00.25 0 <span class="stamnt">i</span> 1 00.25 00.25 0 <span class="stamnt">i</span> 1 00.50 00.25 0 <span class="stamnt">i</span> 1 00.75 00.25 0 <span class="stamnt">s</span> <span class="comment">; Play Instrument #1 at a faster tempo, repeat 3 times.</span> <span class="stamnt">r</span>3 <span class="stamnt">i</span> 1 00.00 00.25 1 <span class="stamnt">i</span> 1 00.25 00.25 0 <span class="stamnt">i</span> 1 00.50 00.25 0 <span class="stamnt">i</span> 1 00.75 00.25 0 <span class="stamnt">s</span> <span class="stamnt">e</span> <span class="csdtag"></CsScore></span> <span class="csdtag"></CsoundSynthesizer></span> </pre> </div> </div> <p><br class="example-break" /> </p> </div> <div class="refsect1" title="See Also"> <a id="idp48764040"></a> <h2>See Also</h2> <p> <a class="link" href="tempoval.html" title="tempoval"><em class="citetitle">tempoval</em></a> </p> </div> <div class="refsect1" title="Credits"> <a id="idp48765088"></a> <h2>Credits</h2> <p>Example written by Kevin Conder.</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="tempest.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="temposcal.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">tempest </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> temposcal</td> </tr> </table> </div> </body> </html>