<?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>seqtime</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="seqtime2.html" title="seqtime2" /> <link rel="next" href="setctrl.html" title="setctrl" /> </head> <body> <div class="navheader"> <table width="100%" summary="Navigation header"> <tr> <th colspan="3" align="center">seqtime</th> </tr> <tr> <td width="20%" align="left"><a accesskey="p" href="seqtime2.html">Prev</a> </td> <th width="60%" align="center">Orchestra Opcodes and Operators</th> <td width="20%" align="right"> <a accesskey="n" href="setctrl.html">Next</a></td> </tr> </table> <hr /> </div> <div class="refentry" title="seqtime"> <a id="seqtime"></a> <div class="titlepage"></div> <a id="IndexSeqtime" class="indexterm"></a> <div class="refnamediv"> <h2> <span class="refentrytitle">seqtime</span> </h2> <p>seqtime — Generates a trigger signal according to the values stored in a table. </p> </div> <div class="refsect1" title="Description"> <a id="idp42122904"></a> <h2>Description</h2> <p> Generates a trigger signal according to the values stored in a table. </p> </div> <div class="refsect1" title="Syntax"> <a id="idp42123584"></a> <h2>Syntax</h2> <pre class="synopsis">ktrig_out <span class="command"><strong>seqtime</strong></span> ktime_unit, kstart, kloop, kinitndx, kfn_times</pre> </div> <div class="refsect1" title="Performance"> <a id="idp42178952"></a> <h2>Performance</h2> <p> <span class="emphasis"><em>ktrig_out</em></span> -- output trigger signal </p> <p> <span class="emphasis"><em>ktime_unit</em></span> -- unit of measure of time, related to seconds. </p> <p> <span class="emphasis"><em>kstart</em></span> -- start index of looped section </p> <p> <span class="emphasis"><em>kloop</em></span> -- end index of looped section </p> <p> <span class="emphasis"><em>kinitndx</em></span> -- initial index </p> <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"> <table border="0" summary="Note: Note"> <tr> <td rowspan="2" align="center" valign="top" width="25"> <img alt="[Note]" src="images/note.png" /> </td> <th align="left">Note</th> </tr> <tr> <td align="left" valign="top"> <p> Although <span class="emphasis"><em>kinitndx</em></span> is listed as k-rate, it is in fact accessed only at init-time. So if you are using a k-rate argument, it must be assigned with <a class="link" href="init.html" title="init"><em class="citetitle">init</em></a>. </p> </td> </tr> </table> </div> <p> <span class="emphasis"><em>kfn_times</em></span> -- number of table containing a sequence of times </p> <p> This opcode handles timed-sequences of groups of values stored into a table. </p> <p> <span class="emphasis"><em>seqtime</em></span> generates a trigger signal (a sequence of impulses, see also <a class="link" href="trigger.html" title="trigger"><em class="citetitle">trigger</em></a> opcode), according to the values stored in the <span class="emphasis"><em>kfn_times</em></span> table. This table should contain a series of delta-times (i.e. times beetween to adjacent events). The time units stored into table are expressed in seconds, but can be rescaled by means of ktime_unit argument. The table can be filled with <a class="link" href="GEN02.html" title="GEN02"><em class="citetitle">GEN02</em></a> or by means of an external text-file containing numbers, with <a class="link" href="GEN23.html" title="GEN23"><em class="citetitle">GEN23</em></a>. </p> <div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"> <table border="0" summary="Note"> <tr> <td rowspan="2" align="center" valign="top" width="25"> <img alt="[Note]" src="images/note.png" /> </td> <th align="left">Note</th> </tr> <tr> <td align="left" valign="top"> <p>Note that the <span class="emphasis"><em>kloop</em></span> index marks the loop boundary and is NOT included in the looped elements. If you want to loop the first four elements, you would set <span class="emphasis"><em>kstart</em></span> to 0 and <span class="emphasis"><em>kloop</em></span> to 4.</p> </td> </tr> </table> </div> <p> It is possible to start the sequence from a value different than the first, by assigning to <span class="emphasis"><em>kinitndx</em></span> an index different than zero (which corresponds to the first value of the table). Normally the sequence is looped, and the start and end of loop can be adjusted by modifying <span class="emphasis"><em>kstart</em></span> and <span class="emphasis"><em>kloop</em></span> arguments. User must be sure that values of these arguments (as well as <span class="emphasis"><em>kinitndx</em></span>) correspond to valid table numbers, otherwise Csound will crash (because no range-checking is implementeted). </p> <p> It is possible to disable loop (one-shot mode) by assigning the same value both to <span class="emphasis"><em>kstart</em></span> and <span class="emphasis"><em>kloop</em></span> arguments. In this case, the last read element will be the one corresponding to the value of such arguments. Table can be read backward by assigning a negative <span class="emphasis"><em>kloop</em></span> value. It is possible to trigger two events almost at the same time (actually separated by a k-cycle) by giving a zero value to the corresponding delta-time. First element contained in the table should be zero, if the user intends to send a trigger impulse, it should come immediately after the orchestra instrument containing <span class="emphasis"><em>seqtime</em></span> opcode. </p> </div> <div class="refsect1" title="Examples"> <a id="idp42190952"></a> <h2>Examples</h2> <p> Here is an example of the seqtime opcode. It uses the file <a class="ulink" href="examples/seqtime.csd" target="_top"><em class="citetitle">seqtime.csd</em></a>. </p> <div class="example"> <a id="idp42191928"></a> <p class="title"> <strong>Example 758. Example of the seqtime 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 <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 seqtime.wav -W ;;; for file output any platform</span> <span class="csdtag"></CsOptions></span> <span class="csdtag"><CsInstruments></span> <span class="ohdr">sr</span> <span class="op">=</span> 44100 <span class="ohdr">ksmps</span> <span class="op">=</span> 64 <span class="ohdr">nchnls</span> <span class="op">=</span> 1 <span class="comment">; By Tim Mortimer and Andres Cabrera 2007</span> <span class="ohdr">0dbfs</span> <span class="op">=</span> 1 gisine <span class="ohdr">ftgen</span> 0, 0, 8192, 10, 1 <span class="comment">;;; table defining an integer pitch set</span> gipset <span class="ohdr">ftgen</span> 0, 0, 4, <span class="op">-</span>2, 8.00, 8.04, 8.07, 8.10 <span class="comment">;;;DELTA times for seqtime</span> gidelta <span class="ohdr">ftgen</span> 0, 0, 4, <span class="op">-</span>2, .5, 1, .25, 1.25 <span class="oblock">instr</span> 1 kndx <span class="opc">init</span> 0 ktrigger <span class="opc">init</span> 0 ktime_unit <span class="opc">init</span> 1 kstart <span class="opc">init</span> p4 kloop <span class="opc">init</span> p5 kinitndx <span class="opc">init</span> 0 kfn_times <span class="opc">init</span> gidelta ktrigger <span class="opc">seqtime</span> ktime_unit, kstart, kloop, kinitndx, kfn_times <span class="opc">printk2</span> ktrigger <span class="octrl">if</span> (ktrigger <span class="op">></span> 0) then kpitch <span class="opc">table</span> kndx, gipset <span class="opc">event</span> "i", 2, 0, 1, kpitch kndx <span class="op">=</span> kndx <span class="op">+</span> 1 kndx <span class="op">=</span> kndx <span class="op">%</span> kloop <span class="octrl">endif</span> <span class="oblock">endin</span> <span class="oblock">instr</span> 2 icps <span class="op">=</span> <span class="opc">cpspch</span> (p4) a1 <span class="opc">buzz</span> 1, icps, 7, gisine aamp <span class="opc">expseg</span> 0.00003,.02,1,p3<span class="op">-</span>.02,0.00003 a1 <span class="op">=</span> a1 <span class="op">*</span> aamp <span class="op">*</span> 0.5 <span class="opc">out</span> a1 <span class="oblock">endin</span> <span class="csdtag"></CsInstruments></span> <span class="csdtag"><CsScore></span> <span class="comment">; start dur kstart kloop</span> <span class="stamnt">i</span> 1 0 7 0 4 <span class="stamnt">i</span> 1 8 10 0 3 <span class="stamnt">i</span> 1 19 10 4 4 <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="idp42194208"></a> <h2>See Also</h2> <p> <a class="link" href="GEN02.html" title="GEN02"><em class="citetitle">GEN02</em></a>, <a class="link" href="GEN23.html" title="GEN23"><em class="citetitle">GEN23</em></a>, <a class="link" href="trigseq.html" title="trigseq"><em class="citetitle">trigseq</em></a> <a class="link" href="seqtime2.html" title="seqtime2"><em class="citetitle">seqtime2</em></a> </p> </div> <div class="refsect1" title="Credits"> <a id="idp42196648"></a> <h2>Credits</h2> <p>Author: Gabriel Maldonado</p> <p>November 2002. Added a note about the <span class="emphasis"><em>kinitndx</em></span> parameter, thanks to Rasmus Ekman.</p> <p>New in version 4.06</p> <p>Example by: Tim Mortimer and Andres Cabrera 2007</p> </div> </div> <div class="navfooter"> <hr /> <table width="100%" summary="Navigation footer"> <tr> <td width="40%" align="left"><a accesskey="p" href="seqtime2.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="setctrl.html">Next</a></td> </tr> <tr> <td width="40%" align="left" valign="top">seqtime2 </td> <td width="20%" align="center"> <a accesskey="h" href="index.html">Home</a> </td> <td width="40%" align="right" valign="top"> setctrl</td> </tr> </table> </div> </body> </html>