Debian Codegraph @

scoregens/i.xml

raw symbols SCIP
1
2 <refentry id="i">
3 <indexterm id="IndexIStatement"><primary>i statement</primary></indexterm>
4 <indexterm id="IndexInstrumentStatement"><primary>instrument statement</primary></indexterm>
5 <indexterm id="IndexNoteStatement"><primary>note statement</primary></indexterm>
6 <refmeta>
7 <refentrytitle>i Statement (Instrument or Note Statement)</refentrytitle>
8 </refmeta>
9
10 <refnamediv>
11 <refname>i</refname>
12 <refpurpose>
13 Makes an instrument active at a specific time and for a certain duration.
14 </refpurpose>
15 </refnamediv>
16
17 <refsect1>
18 <title>Description</title>
19 <para>
20 This statement calls for an instrument to be made active at a specific time and for a certain duration. The parameter field values are passed to that instrument prior to its initialization, and remain valid throughout its Performance.
21 </para>
22 </refsect1>
23
24 <refsect1>
25 <title>Syntax</title>
26 <synopsis><command>i</command> p1 p2 p3 p4 ...</synopsis>
27 </refsect1>
28
29 <refsect1>
30 <title>Initialization</title>
31 <para>
32 <emphasis>p1</emphasis> -- Instrument number, usually a
33 non-negative integer. An optional fractional part can provide an
34 additional tag for specifying ties between particular notes of
35 consecutive clusters. A negative p1 (including tag) can be used
36 to turn off a particular <quote>held</quote> note. In the case
37 of a named instrument it can be negated by having a `-' as the first
38 character of the string.
39 </para>
40
41 <para>
42 <emphasis>p2</emphasis> -- Starting time in arbitrary units called beats.
43 </para>
44
45 <para>
46 <emphasis>p3</emphasis> -- Duration time in beats (usually positive). A negative value will initiate a held note (see also <link linkend="ihold"><citetitle>ihold</citetitle></link>). A negative value can also be used for 'always on' instruments like reverberation. These notes are not terminated by <link linkend="s"><citetitle>s statements</citetitle></link> A zero value will invoke an initialization pass without performance (see also <link linkend="instr"><citetitle>instr</citetitle></link>).
47 </para>
48
49 <para>
50 <emphasis>p4 ...</emphasis> -- Parameters whose significance is determined by the instrument.
51 </para>
52 </refsect1>
53
54 <refsect1>
55 <title>Performance</title>
56 <para>
57 Beats are evaluated as seconds, unless there is a <link linkend="t"><citetitle>t statement</citetitle></link> in this score section or a <link linkend="FlagsMinusLowerT"><citetitle>-t flag</citetitle></link> in the command-line.
58 </para>
59
60 <para>
61 Starting or action times are relative to the beginning of a section ( see <link linkend="s"><citetitle>s statement</citetitle></link>), which is assigned time 0.
62 </para>
63
64 <para>
65 Note statements within a section may be placed in any order. Before being sent to an orchestra, unordered score statements must first be processed by Sorter, which will reorder them by ascending p2 value. Notes with the same p2 value will be ordered by ascending p1; if the same p1, then by ascending p3.
66 </para>
67
68 <para>
69 Notes may be stacked, i.e., a single instrument can perform any number of notes simultaneously. (The necessary copies of the instrument's data space will be allocated dynamically by the orchestra loader.) Each note will normally turn off when its p3 duration has expired, or on receipt of a MIDI noteoff signal. An instrument can modify its own duration either by changing its p3 value during note initialization, or by prolonging itself through the action of a <link linkend="linenr"><citetitle>linenr</citetitle></link> or <link linkend="xtratim"><citetitle>xtratim</citetitle></link> unit.
70 </para>
71
72 <para>
73 An instrument may be turned on and left to perform indefinitely either by giving it a negative p3 or by including an <emphasis>ihold</emphasis> in its i-time code. If a held note is active, an <emphasis>i statement</emphasis> <emphasis>with matching p1</emphasis> will not cause a new allocation but will take over the data space of the held note. The new pfields (including p3) will now be in effect, and an i-time pass will be executed in which the units can either be newly initialized or allowed to continue as required for a tied note (see <link linkend="tigoto"><citetitle>tigoto</citetitle></link>). A held note may be succeeded either by another held note or by a note of finite duration. A held note will continue to perform across section endings (see <link linkend="s"><citetitle>s statement</citetitle></link>). It is halted only by <link linkend="turnoff"><citetitle>turnoff</citetitle></link> or by an <emphasis>i statement</emphasis> with negative matching p1 or by an <link linkend="e"><citetitle>e statement</citetitle></link>.
74 </para>
75
76 <para>
77 It is possible to have multiple instances (usually, but not necessarily, notes of different pitches) of the same instrument, held simultaneously, via negative p3 values. The instrument can then be fed new parameters from the score. This is useful for avoiding long hard-coded <emphasis>linseg</emphasis>s, and can be accomplished by adding a decimal part to the instrument number.
78 </para>
79
80 <para>
81 For example, to hold three copies of instrument 10 in a simple chord:
82 <informalexample>
83 <programlisting>
84 <emphasis role="stamnt">i</emphasis>10.1 0 -1 7.00
85 <emphasis role="stamnt">i</emphasis>10.2 0 -1 7.04
86 <emphasis role="stamnt">i</emphasis>10.3 0 -1 7.07</programlisting>
87 </informalexample>
88 </para>
89
90 <para>
91 Subsequent <emphasis>i</emphasis> statements can refer to the same sounding note instances, and if the instrument definition is done properly, the new p-fields can be used to alter the character of the notes in progress. For example, to bend the previous chord up an octave and release it:
92 <informalexample>
93 <programlisting>
94 <emphasis role="stamnt">i</emphasis>10.1 1 1 8.00
95 <emphasis role="stamnt">i</emphasis>10.2 1 1 8.04
96 <emphasis role="stamnt">i</emphasis>10.3 1 1 8.07</programlisting>
97 </informalexample>
98 </para>
99 <tip>
100 <para>When turning off notes, bear in mind that i 1.1 == i 1.10 and i 1.1 != i 1.01. The maximum number of decimal places that can be used depends on the precision Csound was compiled with<!-- (See <link linkend="MiscCsound64"><citetitle>Csound Double (64-bit) vs. Float (32-bit)</citetitle></link>)-->.</para>
101 </tip>
102
103 <para>
104 The instrument definition has to take this into account, however, especially if clicks are to be avoided (see the example below).
105 </para>
106
107 <para>
108 Note that the decimal instrument number notation cannot be used in conjunction with real-time MIDI. In this case, the instrument would be monophonic while a note was held.
109 </para>
110
111 <para>
112 Notes being tied to previous instances of the same instrument, should skip most initialization by means of <link linkend="tigoto"><citetitle>tigoto</citetitle></link>, except for the values entered in score. For example, all table reading opcodes in the instrument, should usually be skipped, as they store their phase internally. If this is suddenly changed, there will be audible clicks in the output.
113 </para>
114
115 <para>
116 Note that many opcodes (such as <emphasis>delay</emphasis> and <emphasis>reverb</emphasis>) are prepared for optional initialization. To use this feature, the <link linkend="tival"><citetitle>tival opcode</citetitle></link> is suitable. Therefore, they need not be hidden by a <emphasis>tigoto</emphasis> jump.
117 </para>
118
119 <para>
120 Beginning with Csound version 3.53, strings are recognized in p-fields for opcodes that accept them (<emphasis>convolve, adsyn, diskin,</emphasis> etc.). There may be only one string per score line.
121 </para>
122 <para>
123 You can also turnoff notes from the score by using a negative
124 number for the instrument (p1). This is equivalent to using
125 the <link linkend="turnoff2"><citetitle>turnoff2</citetitle></link>
126 opcode. When a note is turned off from the score, it is allowed
127 to release
128 (if <link linkend="xtratim"><citetitle>xtratim</citetitle></link>
129 or opcodes with release section
130 like <link linkend="linenr"><citetitle>linenr</citetitle></link>
131 are used) and only notes with the same fractional part are
132 turned off. Also, only the last instance of the instrument will
133 be turned off, so there have to be as many negative instrument
134 numbers as positive ones for all notes to be turned off.
135
136 <informalexample>
137 <programlisting>
138 <emphasis role="stamnt">i</emphasis> 1.1 1 300 8.00
139 <emphasis role="stamnt">i</emphasis> 1.2 1 300 8.04
140 <emphasis role="stamnt">i</emphasis> 1.3 1 -300 8.07
141 <emphasis role="stamnt">i</emphasis> 1.3 1 -300 8.09
142
143 <emphasis role="comment">; notice that p-fields after p2 will be ignored if </emphasis>
144 <emphasis role="comment">; instrument number is negative</emphasis>
145 <emphasis role="stamnt">i</emphasis> -1.1 3 1 4.00
146 <emphasis role="stamnt">i</emphasis> -1.2 4 51 4.04
147 <emphasis role="stamnt">i</emphasis> -1.3 5 1 4.07
148 <emphasis role="stamnt">i</emphasis> -1.3 6 10 4.09
149 </programlisting>
150 </informalexample>
151 </para>
152 <refsect2>
153 <title>Special Considerations</title>
154
155 <para>
156 The maximum instrument number used to be 200. This has been changed to be limited by memory only (currently there is an internal soft limit of 200; this is automatically extended as required).
157 </para>
158 </refsect2>
159 </refsect1>
160
161 <refsect1>
162 <title>Examples</title>
163 <para>
164 Here is an example of the i statement. It uses the file <ulink url="examples/i_statement.csd"><citetitle>i_statement.csd</citetitle></ulink>.
165 <example>
166 <title>Example of the i statement.</title>
167 <xi:include href="examples-xml/i_statement.csd.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
168 </example>
169 </para>
170 </refsect1>
171
172 <refsect1>
173 <title>See Also</title>
174 <para>
175 <link linkend="ScoreStatements"><citetitle>Score Statements</citetitle></link>
176 </para>
177 </refsect1>
178
179 <refsect1>
180 <title>Credits</title>
181 <para>
182 Additional text (Csound Version 4.07) explaining tied notes, edited by &namerasmus; from a note by David Kirsh, posted to the Csound mailing list. Example instrument by &namerasmus;.
183 </para>
184
185 <para>
186 Updated August 2002 thanks to a note from &namerasmus;. There is no longer a hard limit of 200 instruments.
187 </para>
188 </refsect1>
189 </refentry>
190