Debian Codegraph @

opcodes/timedseq.xml

raw symbols SCIP
1
2 <refentry id="timedseq">
3 <indexterm id="IndexTimedSeq"><primary>timedseq</primary></indexterm>
4 <refentryinfo><title>Instrument Control:Sensing and Control</title></refentryinfo>
5 <refmeta>
6 <refentrytitle>timedseq</refentrytitle>
7 </refmeta>
8
9 <refnamediv>
10 <refname>timedseq</refname>
11 <refpurpose>
12 Time Variant Sequencer
13 </refpurpose>
14 </refnamediv>
15
16 <refsect1>
17 <title>Description</title>
18 <para>
19 An event-sequencer in which time can be controlled by a
20 time-pointer. Sequence data are stored into a table.
21 </para>
22 </refsect1>
23
24 <refsect1>
25 <title>Syntax</title>
26 <synopsis>ktrig <command>timedseq</command> ktimpnt, ifn, kp1 [,kp2, kp3, ...,kpN]</synopsis>
27 </refsect1>
28
29 <refsect1>
30 <title>Initialization</title>
31 <para>
32 <emphasis>ifn</emphasis> -- number of table containing sequence
33 data.
34 </para>
35 </refsect1>
36 <refsect1>
37 <title>Performance</title>
38 <para>
39 <emphasis>ktri</emphasis> -- output trigger signal
40 </para>
41 <para>
42 <emphasis>ktimpnt</emphasis> -- time pointer into sequence file, in seconds.
43 </para>
44 <para>
45 <emphasis>kp1,...,kpN</emphasis> -- output p-fields of notes. kp2
46 meaning is relative action time and kp3 is the duration of notes
47 in seconds.
48 </para>
49 <para>
50 <emphasis>timedseq</emphasis> is a sequencer that allows to schedule
51 notes starting from a user sequence, and depending from an external
52 timing given by a time-pointer value (ktimpnt argument). User should
53 fill table ifn with a list of notes, that can be provided in an
54 external text file by using GEN23, or by typing it directly in the
55 orchestra (or score) file with GEN02. The format of the text file
56 containing the sequence is made up simply by rows containing several
57 numbers separated by space (similarly to normal Csound score). The
58 first value of each row must be a positive or null value, except for a
59 special case that will be explained below. This first value is
60 normally used to define the instrument number corresponding to that
61 particular note (like normal score). The second value of each row must
62 contain the action time of corresponding note and the third value its
63 duration. This is an example:
64 </para>
65 <programlisting>
66 0 0 0.25 1 93
67 0 0.25 0.25 2 63
68 0 0.5 0.25 3 91
69 0 0.75 0.25 4 70
70 0 1 0.25 5 83
71 0 1.25 0.25 6 75
72 0 1.5 0.25 7 78
73 0 1.75 0.25 8 78
74 0 2 0.25 9 83
75 0 2.25 0.25 10 70
76 0 2.5 0.25 11 54
77 0 2.75 0.25 12 80
78 -1 3 -1 -1 -1 ;; last row of the sequence
79 </programlisting>
80 <para>
81 In this example, the first value of each row is always zero (it is a
82 dummy value, but this p-field can be used, for example, to express a
83 MIDI channel or an instrument number), except the last row, that
84 begins with -1. This value (-1) is a special value, that indicates the
85 end of sequence. It has itself an action time, because sequences can be
86 looped. So the previous sequence has a default duration of 3 seconds,
87 being value 3 the last action time of the sequence.
88 </para>
89 <para>
90 It is important that ALL lines contains the same number of values (in
91 the example all rows contains exactly 5 values). The number of values
92 contained by each row, MUST be the number of kpXX output arguments
93 (notice that, even if kp1, kp2 etc. are placed at the right of the
94 opcode, they are output arguments, not input arguments).
95 </para>
96 <para>
97 ktimpnt argument provide the real temporization of the
98 sequence. Actually the passage of time through sequence is specified
99 by ktimpnt itself, which represents the time in seconds. ktimpnt must
100 always be positive, but can move forwards or backwards in time, be
101 stationary or discontinuous, as a pointer into the sequence file, in
102 the same way of pvoc or lpread. When ktimpnt crosses the action time
103 of a note, a trigger signal is sent to ktrig output argument, and kp1,
104 kp2,...kpN arguments are updated with the values of that note. This
105 information can then be used with schedkwhen to actually
106 activate note events. Notice that kp1,...kpn data can be further
107 processed (for example delayed with delayk, transposed, etc.) before
108 feeding schedkwhen.
109 </para>
110 <para>
111 <emphasis>ktimpnt</emphasis> can be controlled by a linear signal, for example:
112 </para>
113 <programlisting>
114 ktimpnt <emphasis role="opc">line</emphasis> 0, p3, 3 <emphasis role="comment">; original sequence duration was 3 secs</emphasis>
115 ktrig <emphasis role="opc">timedseq</emphasis> ktimpnt, 1, kp1, kp2, kp3, kp4, kp5
116 <emphasis role="opc">schedkwhen</emphasis> ktrig, 105, 2, 0, kp3, kp4, kp5</programlisting>
117 <para>
118 in this case the complete sequence (with original duration of 3
119 seconds) will be played in <emphasis>p3</emphasis> seconds.
120 </para>
121 <para>
122 You can loop a sequence by controlling it with a phasor:
123 <programlisting>
124 kphs <emphasis role="opc">phasor</emphasis> 1<emphasis role="op">/</emphasis>3
125 ktimpnt <emphasis role="op">=</emphasis> kphs <emphasis role="op">*</emphasis> 3
126 ktrig <emphasis role="opc">timedseq</emphasis> ktimpnt ,1 ,kp1, kp2, kp3, kp4, kp5
127 <emphasis role="opc">schedkwhen</emphasis> ktrig, 105, 2, 0, kp3, kp4, kp5</programlisting>
128 </para>
129 <para>
130 Obviously you can play only a fragment of the sequence, read it
131 backward, and non-linearly access sequence data in the same way of
132 pvoc and lpread opcodes.
133 </para>
134 <para>
135 With timedseq opcode you can do almost all things of a normal score,
136 except you have the following limitations:
137 <orderedlist>
138 <listitem>
139 <para>You cannot have two notes exactly starting with the same action
140 time; actually at least a k-cycle should separate timing of two
141 notes (otherwise the schedkwhen mechanism eats one of them).</para>
142 </listitem>
143 <listitem>
144 <para>All notes of the sequence must have the same number of p-fields
145 (even if they activate different instruments).</para>
146 </listitem>
147 </orderedlist>
148 You can remedy this limitation by filling with dummy values notes that belongs to
149 instruments with less p-fields than other ones.
150 </para>
151 </refsect1>
152
153 <refsect1>
154 <title>Examples</title>
155 <para>
156 Here is a complete example of the timedseq opcode. It uses the file <ulink url="examples/timedseq.csd"><citetitle>timedseq.csd</citetitle></ulink>.
157 <example>
158 <title>Example of the timedseq opcode.</title>
159 <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>
160 <xi:include href="examples-xml/timedseq.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
161 </example>
162 </para>
163 </refsect1>
164
165 <refsect1>
166 <title>See also</title>
167 <para><link linkend="ControlSensing"><citetitle>Sensing and Control: Tempo and Sequencing</citetitle></link></para>
168 </refsect1>
169
170 <refsect1>
171 <title>Credits</title>
172 <para>
173 Author: &namegabriel;
174 </para>
175 </refsect1>
176 </refentry>