| 1 | |
| 2 | <refentry id="seqtime"> |
| 3 | <indexterm id="IndexSeqtime"><primary>seqtime</primary></indexterm> |
| 4 | <refentryinfo><title>Instrument Control:Sensing and Control</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>seqtime</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | |
| 10 | |
| 11 | <refnamediv> |
| 12 | <refname>seqtime</refname> |
| 13 | <refpurpose> |
| 14 | Generates a trigger signal according to the values stored in a table. |
| 15 | </refpurpose> |
| 16 | </refnamediv> |
| 17 | |
| 18 | <refsect1> |
| 19 | <title>Description</title> |
| 20 | <para> |
| 21 | Generates a trigger signal according to the values stored in a table. |
| 22 | </para> |
| 23 | </refsect1> |
| 24 | |
| 25 | <refsect1> |
| 26 | <title>Syntax</title> |
| 27 | <synopsis>ktrig_out <command>seqtime</command> ktime_unit, kstart, kloop, kinitndx, kfn_times</synopsis> |
| 28 | </refsect1> |
| 29 | |
| 30 | <refsect1> |
| 31 | <title>Performance</title> |
| 32 | <para> |
| 33 | <emphasis>ktrig_out</emphasis> -- output trigger signal |
| 34 | </para> |
| 35 | |
| 36 | <para> |
| 37 | <emphasis>ktime_unit</emphasis> -- unit of measure of time, related to seconds. |
| 38 | </para> |
| 39 | |
| 40 | <para> |
| 41 | <emphasis>kstart</emphasis> -- start index of looped section |
| 42 | </para> |
| 43 | |
| 44 | <para> |
| 45 | <emphasis>kloop</emphasis> -- end index of looped section |
| 46 | </para> |
| 47 | |
| 48 | <para> |
| 49 | <emphasis>kinitndx</emphasis> -- initial index |
| 50 | </para> |
| 51 | |
| 52 | <note> |
| 53 | <title>Note</title> |
| 54 | <para> |
| 55 | Although <emphasis>kinitndx</emphasis> 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 <link linkend="init"><citetitle>init</citetitle></link>. |
| 56 | </para> |
| 57 | </note> |
| 58 | |
| 59 | <para> |
| 60 | <emphasis>kfn_times</emphasis> -- number of table containing a sequence of times |
| 61 | </para> |
| 62 | |
| 63 | <para> |
| 64 | This opcode handles timed-sequences of groups of values stored into a table. |
| 65 | </para> |
| 66 | |
| 67 | <para> |
| 68 | <emphasis>seqtime</emphasis> generates a trigger signal (a sequence of impulses, see also <link linkend="trigger"><citetitle>trigger</citetitle></link> opcode), according to the values stored in the <emphasis>kfn_times</emphasis> 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 <link linkend="GEN02"><citetitle>GEN02</citetitle></link> or by means of an external text-file containing numbers, with <link linkend="GEN23"><citetitle>GEN23</citetitle></link>. |
| 69 | </para> |
| 70 | <note> |
| 71 | <para>Note that the <emphasis>kloop</emphasis> 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 <emphasis>kstart</emphasis> to 0 and <emphasis>kloop</emphasis> to 4.</para> |
| 72 | </note> |
| 73 | |
| 74 | <para> |
| 75 | It is possible to start the sequence from a value different than the first, by assigning to <emphasis>kinitndx</emphasis> 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 <emphasis>kstart</emphasis> and <emphasis>kloop</emphasis> arguments. User must be sure that values of these arguments (as well as <emphasis>kinitndx</emphasis>) correspond to valid table numbers, otherwise Csound will crash (because no range-checking is implementeted). |
| 76 | </para> |
| 77 | |
| 78 | <para> |
| 79 | It is possible to disable loop (one-shot mode) by assigning the same value both to <emphasis>kstart</emphasis> and <emphasis>kloop</emphasis> 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 <emphasis>kloop</emphasis> 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 <emphasis>seqtime</emphasis> opcode. |
| 80 | </para> |
| 81 | </refsect1> |
| 82 | |
| 83 | <refsect1> |
| 84 | <title>Examples</title> |
| 85 | <para> |
| 86 | Here is an example of the seqtime opcode. It uses the file <ulink url="examples/seqtime.csd"><citetitle>seqtime.csd</citetitle></ulink>. |
| 87 | |
| 88 | <example> |
| 89 | <title>Example of the seqtime opcode.</title> |
| 90 | <para>See the sections <link linkend="UsingRealTime"><citetitle>Real-time Audio</citetitle></link> and <link linkend="CommandFlags"><citetitle>Command Line Flags</citetitle></link> for more information on using command line flags.</para> |
| 91 | <xi:include href="examples-xml/seqtime.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 92 | </example> |
| 93 | </para> |
| 94 | </refsect1> |
| 95 | |
| 96 | <refsect1> |
| 97 | <title>See also</title> |
| 98 | <para><link linkend="ControlSensing"><citetitle>Sensing and Control: Tempo and Sequencing</citetitle></link></para> |
| 99 | </refsect1> |
| 100 | |
| 101 | <refsect1> |
| 102 | <title>Credits</title> |
| 103 | <para>Author: &namegabriel;</para> |
| 104 | <para>November 2002. Added a note about the <emphasis>kinitndx</emphasis> parameter, thanks to &namerasmus;.</para> |
| 105 | <para>New in version 4.06</para> |
| 106 | <para>Example by: Tim Mortimer and Andres Cabrera 2007</para> |
| 107 | </refsect1> |
| 108 | </refentry> |