| 1 | |
| 2 | <refentry id="splitrig"> |
| 3 | <indexterm id="Indexsplitrig"><primary>splitrig</primary></indexterm> |
| 4 | <refentryinfo><title>Instrument Control:Sensing and Control</title></refentryinfo> |
| 5 | <refmeta> |
| 6 | <refentrytitle>splitrig</refentrytitle> |
| 7 | </refmeta> |
| 8 | |
| 9 | <refnamediv> |
| 10 | <refname>splitrig</refname> |
| 11 | <refpurpose> |
| 12 | Split a trigger signal |
| 13 | </refpurpose> |
| 14 | </refnamediv> |
| 15 | |
| 16 | <refsect1> |
| 17 | <title>Description</title> |
| 18 | <para> |
| 19 | <emphasis>splitrig</emphasis> splits a trigger signal (i.e. a timed sequence of control-rate impulses) into several channels following a structure designed by the user. |
| 20 | </para> |
| 21 | </refsect1> |
| 22 | |
| 23 | <refsect1> |
| 24 | <title>Syntax</title> |
| 25 | <synopsis><command>splitrig</command> ktrig, kndx, imaxtics, ifn, kout1 [,kout2,...,koutN]</synopsis> |
| 26 | </refsect1> |
| 27 | |
| 28 | <refsect1> |
| 29 | <title>Initialization</title> |
| 30 | <para> |
| 31 | <emphasis>imaxtics</emphasis> - number of tics belonging to largest pattern |
| 32 | </para> |
| 33 | <para> |
| 34 | <emphasis>ifn</emphasis> - number of table containing channel-data structuring |
| 35 | </para> |
| 36 | </refsect1> |
| 37 | <refsect1> |
| 38 | <title>Performance</title> |
| 39 | <para> |
| 40 | <emphasis>asig</emphasis> - incoming (input) signal |
| 41 | </para> |
| 42 | <para> |
| 43 | <emphasis>ktrig</emphasis> - trigger signal |
| 44 | </para> |
| 45 | <para> |
| 46 | The <emphasis>splitrig</emphasis> opcode splits a trigger signal into several output channels according to one or more patterns provided by the user. Normally the regular timed trigger signal generated by metro opcode is used to be transformed into rhythmic pattern that can trig several independent melodies or percussion riffs. But you can also start from non-isocronous trigger signals. This allows to use some "interpretative" and less "mechanic" groove variations. |
| 47 | |
| 48 | Patterns are looped and each numtics_of_pattern_N the cycle is repeated. |
| 49 | </para> |
| 50 | <para> |
| 51 | The scheme of patterns is defined by the user and is stored into <emphasis>ifn</emphasis> table according to the following format: |
| 52 | </para> |
| 53 | <para> |
| 54 | <programlisting> |
| 55 | <xi:include href="opcodes/splitrig.txt" parse="text" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 56 | </programlisting> |
| 57 | </para> |
| 58 | <para> |
| 59 | This scheme can contain more than one pattern, each one with a |
| 60 | different number of rows. Each pattern is preceded by a a special row |
| 61 | containing a single <emphasis>numtics_of_pattern_N</emphasis> field; |
| 62 | this field expresses the number of tics that makes up the |
| 63 | corresponding pattern. Each pattern's row makes up a tic. Each |
| 64 | pattern's column corresponds to a channel, and each field of a row is |
| 65 | a number that makes up the value outputted by the corresponding |
| 66 | <emphasis>koutXX</emphasis> channel (if number is a zero, |
| 67 | corresponding output channel will not trigger anything in that |
| 68 | particular arguments). Obviously, all rows must contain the same |
| 69 | number of fields that must be equal to the number of |
| 70 | <emphasis>koutXX</emphasis> channel. All patterns must contain the |
| 71 | same number of rows, this number must be equal to the largest pattern |
| 72 | and is defined by <emphasis>imaxtics</emphasis> variable. Even if a |
| 73 | pattern has less tics than the largest pattern, it must be made up of |
| 74 | the same number of rows, in this case, some of these rows, at the end |
| 75 | of the pattern itself, will not be used (and can be set to any value, |
| 76 | because it does not matter). |
| 77 | </para> |
| 78 | <para> |
| 79 | The <emphasis>kndx</emphasis> variable chooses the number of the pattern to be played, zero indicating the first pattern. Each time the integer part of <emphasis>kndx</emphasis> changes, tic counter is reset to zero. |
| 80 | </para> |
| 81 | <para> |
| 82 | Patterns are looped and each <emphasis>numtics_of_pattern_N</emphasis> the cycle is repeated. |
| 83 | </para> |
| 84 | <para>examples |
| 85 | 4 - calculate average value of asig in the time interval |
| 86 | </para> |
| 87 | <para> |
| 88 | This opcode can be useful in several situations, for example to implement a vu-meter |
| 89 | </para> |
| 90 | |
| 91 | </refsect1> |
| 92 | |
| 93 | <refsect1> |
| 94 | <title>Examples</title> |
| 95 | <para> |
| 96 | Here is an example of splitrig opcode. It uses the file <ulink url="examples/splitrig.csd"><citetitle>splitrig.csd</citetitle></ulink>. |
| 97 | <example> |
| 98 | <title>Example of the splitrig opcode.</title> |
| 99 | <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> |
| 100 | <xi:include href="examples-xml/splitrig.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> |
| 101 | </example> |
| 102 | </para> |
| 103 | </refsect1> |
| 104 | |
| 105 | <refsect1> |
| 106 | <title>See also</title> |
| 107 | <para><link linkend="ControlSensing"><citetitle>Sensing and Control: Tempo and Sequencing</citetitle></link></para> |
| 108 | </refsect1> |
| 109 | |
| 110 | <refsect1> |
| 111 | <title>Credits</title> |
| 112 | <para>Written by &namegabriel;.</para> |
| 113 | <para>New in Csound 5 (Previously available only on CsoundAV)</para> |
| 114 | </refsect1> |
| 115 | </refentry> |