| 1 | |
| 2 | <refentry id="trigseq"> |
| 3 | <indexterm id="IndexTrigseq"><primary>trigseq</primary></indexterm> |
| 4 | <refentryinfo><title>Instrument Control:Sensing and Control</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>trigseq</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>trigseq</refname> |
| 11 | <refpurpose> |
| 12 | Accepts a trigger signal as input and outputs a group of values. |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | Accepts a trigger signal as input and outputs a group of values. |
| 20 | </para> |
| 21 | </refsect1> |
| 22 | |
| 23 | <refsect1> |
| 24 | <title>Syntax</title> |
| 25 | <synopsis><command>trigseq</command> ktrig_in, kstart, kloop, kinitndx, kfn_values, kout1 [, kout2] [...]</synopsis> |
| 26 | </refsect1> |
| 27 | |
| 28 | <refsect1> |
| 29 | <title>Performance</title> |
| 30 | <para> |
| 31 | <emphasis>ktrig_in</emphasis> -- input trigger signal |
| 32 | </para> |
| 33 | |
| 34 | <para> |
| 35 | <emphasis>kstart</emphasis> -- start index of looped section |
| 36 | </para> |
| 37 | |
| 38 | <para> |
| 39 | <emphasis>kloop</emphasis> -- end index of looped section |
| 40 | </para> |
| 41 | |
| 42 | <para> |
| 43 | <emphasis>kinitndx</emphasis> -- initial index |
| 44 | </para> |
| 45 | |
| 46 | <note> |
| 47 | <title>Note</title> |
| 48 | <para> |
| 49 | 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>. |
| 50 | </para> |
| 51 | </note> |
| 52 | |
| 53 | <para> |
| 54 | <emphasis>kfn_values</emphasis> -- number of a table containing a sequence of groups of values |
| 55 | </para> |
| 56 | |
| 57 | <para> |
| 58 | <emphasis>kout1</emphasis> -- output values |
| 59 | </para> |
| 60 | |
| 61 | <para> |
| 62 | <emphasis>kout2, ...</emphasis> (optional) -- more output values |
| 63 | </para> |
| 64 | |
| 65 | <para> |
| 66 | This opcode handles timed-sequences of groups of values stored into a table. |
| 67 | </para> |
| 68 | |
| 69 | <para> |
| 70 | <emphasis>trigseq</emphasis> accepts a trigger signal (<emphasis>ktrig_in</emphasis>) as input and outputs group of values (contained in the <emphasis>kfn_values</emphasis> table) each time <emphasis>ktrig_in</emphasis> assumes a non-zero value. Each time a group of values is triggered, table pointer is advanced of a number of positions corresponding to the number of group-elements, in order to point to the next group of values. The number of elements of groups is determined by the number of <emphasis>koutX</emphasis> arguments. |
| 71 | </para> |
| 72 | |
| 73 | <para> |
| 74 | 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 implemented. |
| 75 | </para> |
| 76 | |
| 77 | <para> |
| 78 | 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. |
| 79 | </para> |
| 80 | |
| 81 | <para> |
| 82 | <emphasis>trigseq</emphasis> is designed to be used together with <link linkend="seqtime"><citetitle>seqtime</citetitle></link> or <link linkend="trigger"><citetitle>trigger</citetitle></link> opcodes. |
| 83 | </para> |
| 84 | </refsect1> |
| 85 | |
| 86 | <refsect1> |
| 87 | <title>Examples</title> |
| 88 | <para> |
| 89 | Here is an example of the trigseq opcode. It uses the file <ulink url="examples/trigseq.csd"><citetitle>trigseq.csd</citetitle></ulink>. |
| 90 | <example> |
| 91 | <title>Example of the trigseq opcode.</title> |
| 92 | <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> |
| 93 | <xi:include href="examples-xml/trigseq.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 94 | </example> |
| 95 | </para> |
| 96 | </refsect1> |
| 97 | |
| 98 | <refsect1> |
| 99 | <title>See also</title> |
| 100 | <para><link linkend="ControlSensing"><citetitle>Sensing and Control: Tempo and Sequencing</citetitle></link></para> |
| 101 | </refsect1> |
| 102 | |
| 103 | <refsect1> |
| 104 | <title>Credits</title> |
| 105 | <para>Author: &namegabriel;</para> |
| 106 | <para>November 2002. Added a note about the <emphasis>kinitndx</emphasis> parameter, thanks to &namerasmus;.</para> |
| 107 | <para>January 2003. Thanks to a note from &nameoeyvind;, I corrected the credits.</para> |
| 108 | <para>New in version 4.06</para> |
| 109 | </refsect1> |
| 110 | </refentry> |