| jpff@codemist.co.uk wrote:
> I have the list of undocumented opcodes as
>
> seqtime2
(NOTE: all the following opcodes with the exception of cogoto
are by Gabriel Maldonado; the manuals are copied from
http://www.csounds.com/maldonado/Manual/index.htm)
Sequence-related opcodes
ktrig seqtime ktime_unit, kstart, kloop, initndx, kfn_times
ktrig seqtime2 ktrig_in, ktime_unit, kstart, kloop, kinitndx, kfn_times
trigseq ktrig_in, kstart, kloop, initndx, kfn_values, kout1 [, kout2, kout3, ...., koutN]
DESCRIPTION
Handle timed-sequences of groups of values stored into tables.
INITIALIZATION
initndx - initial index
PERFORMANCE
kinitndx - reinit starting index
ktrig - output trigger signal. Normally a stream of zeros, except when a new time value stored in the table is reached.
In this case the ktrig argument is filled with the time value, scaled according to current ktime_unit value.
ktime_unit - unit of measure of time, related to seconds.
kstart - start index of looped section
kloop - end index of looped section
kfn_times - number of table containing a sequence of times
kfn_values - numer of a table containing a sequence of groups of values
ktrig_in - input tirgger signal
kout1 [, kout2, kout3, ...., koutN] - output values
These opcodes handle timed-sequences of groups of values stored into tables.
seqtime generates a trigger signal (a sequence of impulses, see also trigger opcode), according to the values stored in
kfn_times table. This table should contain a series of delta-times (i.e. times beetween to adiacent 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 GEN02 or by means of an external text-file containing numbers, with GEN23. It is possible to start the
sequence from a value different than the first, by assigning to initndx 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 kstart and kloop arguments. User must be sure that values of these arguments (as well as initndx) correspond
to valid table numbers, otherwise Csound will crash (because no range-checking is implementeted). It is possible to
disable loop (one-shot mode) by assigning the same value both to kstart and kloop 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
kloop 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 intend to
send a trigger impulse it immediately after the orchestra instrument containing seqtime opcode. seqtime outputs a
stream of zeroes except when a new time value stored in the table is reached. In this case the ktrig argument is filled
with the time value, scaled according to current ktime_unit value.
seqtime2 is similar to seqtime, the difference is that when ktrig_in contains a non-zero value, current index is reset
to kinitndx value. kinitndx can be varied at performance time.
trigseq accepts a trigger signal (ktrig_in) as input and outputs group of values (contained into kfn_values table) each
time ktrig_in 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 koutX arguments. It is possible to start the sequence from a value
different than the first, by assigning to initndx 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 kstart and kloop
arguments. User must be sure that values of these arguments (as well as initndx) correspond to valid table numbers,
otherwise Csound will crash (because no range-checking is implementeted). It is possible to disable loop (one-shot mode)
by assigning the same value both to kstart and kloop 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 kloop value.
Notice that trigseq output arguments are placed at the left of the opcode name, differently from usual (this style is
already used in other opcodes using undefined lists of output arguments such as fin).
trigseq is designed to be used together with seqtime or trigger opcodes.
Example:
instr 1
icps cpsmidi
iamp ampmidi 5000
ktrig seqtime 1, 1, 10, 0, 1
trigseq ktrig, 0, 10, 0, 2, kdur, kampratio, kfreqratio
schedkwhen ktrig, -1, -1, 2, 0, kdur, kampratio*iamp, kfreqratio*icps
endin
--------------------------------------------------------------------------------------------------------------
> timedseq
Time Variant Sequencer
ktrig timedseq ktimpnt, ifn, kp1 [,kp2, kp3, ...,kpN]
DESCRIPTION
An event-sequencer in which time can be controlled by a time-pointer. Sequence data are stored into a table.
INITIALIZATION
ifn - number of table containing sequence data
PERFORMANCE
ktrig - output trigger signal
ktimpnt - time pointer into sequence file, in seconds.
kp1,...,kpN - output p-fields of notes. kp2 meaning is relative action time and kp3 is the duration of notes in seconds.
timedseq is a sequencer that allows to schedule notes starting from a user sequence, and depending from an external
timing given by a time-pointer value (ktimpnt argument). User should fill table ifn with a list of notes, that can be
provided in an external text file by using GEN23, or by typing it directly in the orchestra (or score) file with GEN02.
The format of the text file containing the sequence is made up simply by rows containing several numbers separated by
space (similarly to normal Csound score). The first value of each row must be a positve or null value, except for a
special case that will be explained below. This first value is normally used to define the instrument number
corresponding to that particular note (like normal score). The second value of each row must contain the action time of
corresponding note and the third value its duration. This is an example:
0 0 0.25 1 93
0 0.25 0.25 2 63
0 0.5 0.25 3 91
0 0.75 0.25 4 70
0 1 0.25 5 83
0 1.25 0.25 6 75
0 1.5 0.25 7 78
0 1.75 0.25 8 78
0 2 0.25 9 83
0 2.25 0.25 10 70
0 2.5 0.25 11 54
0 2.75 0.25 12 80
-1 3 -1 -1 -1 <--- last row of the sequence
In this example, the first value of each row is always zero (it is a dummy value, but this p-field can be used, for
example, to express a MIDI channel or an instrument number), except the last row, that begins with -1. This value (-1)
is a special value, that indicates the end of sequence. It has itself an action time, because sequnces can be looped. So
the previous sequence has a default duration of 3 seconds, being value 3 the last action time of the sequence.
It is important that ALL lines contains the same number of values (in the example all rows contains exactly 5 values).
The number of values contained by each row, MUST be the number of kpXX output arguments (notice that, even if kp1, kp2
etc. are placed at the right of the opcode, they are output arguments, not input arguments).
ktimpnt argument provide the real temporization of the sequence. Actually the passage of time through sequence is
specified by ktimpnt itself, which represents the time in seconds. ktimpnt must always be positive, but can move
forwards or backwards in time, be stationary or discontinuous, as a pointer into the sequence file, in the same way of
pvoc or lpread. When ktimpnt crosses the action time of a note, a trigger signal is sent to ktrig output argument, and
kp1, kp2,...kpN arguments are updated with the values of that note. This information can then be used with schedk or
schedkwhen to actually activate note events. Notice that kp1,...kpn data can be further processed (for example delayed
with delayk, transposed, etc.) before feeding schedk or schedkwhen.
ktimepoint can be controlled by linear signal, for example:
ktimpnt line 0,p3,3 ; orignal sequence duration was 3 secs
ktrig timedseq ktimpnt,1,kp1,kp2,kp3,kp4,kp5
schedk ktrig, 105, 2, 0, kp3,kp4,kp5
in this case the complete sequence (with orginal duration of 3 seconds) will be played in p3 seconds.
You can loop a sequence by contolling it with a phasor:
kphs phasor 1/3
ktimpnt = kphs * 3
ktrig timedseq ktimpnt,1,kp1,kp2,kp3,kp4,kp5
schedk ktrig, 105, 2, 0, kp3,kp4,kp5
Obviously you can play only a fragment of the sequence, read it backward, and non-linearly access sequence data in the
same way of pvoc and lpread opcodes.
With timedseq opcode you can do almost all things of a normal score, except you have the following limitations:
You can't have two notes exactly starting with the same action time; actually at least a k-cycle should separate timing
of two notes (otherwise the schedk mechanism eats one of them).
all notes of the sequence must have the same number of p-fields (even if they activate different instruments). You can
remedy this limitation by filling with dummy values notes that belongs to instruments with less p-fields than other ones.
--------------------------------------------------------------------------------------------------------------
> tab
> tab_i
> tabw
> tabw_i
tab, tabw
ir tab_i indx, ifn[, ixmode]
kr tab kndx, ifn[, ixmode]
ar tab xndx, ifn[, ixmode]
tabw_i isig, indx, ifn [,ixmode]
tabw ksig, kndx, ifn [,ixmode]
tabw asig, andx, ifn [,ixmode]
DESCRIPTION
Fast table opcodes. Faster than table and tablew because don't allow wrap-around and limit and don't check index
validity. Have been implemented in order to provide fast access to arrays. Support non-power of two tables (can be
generated by any GEN function by giving a negative length value).
INITIALIZATION
ifn - table number
ixmode (optional; default = 0) - ==0 - xndx and ixoff ranges match the length of the table.
!=0 - xndx and ixoff have a 0 to 1 range.
isig - input value to write
indx - table index
PERFORMANCE
asig, ksig - input signal to write
andx, kndx - table index
tab and tabw opcodes are similar to table and tablew, but are faster and support tables having non-power-of-two length.
Special care of index value must be taken into account. Index values out of the table allocated space will crash Csound.
--------------------------------------------------------------------------------------------------------------
> tabplay
> tabrec
Recording and playing-back control signals
tabrec ktrig_start, ktrig_stop, knumtics, kfn, kin1 [,kin2,...,kinN]
tabplay ktrig, knumtics, kfn, kout1 [,kout2,..., koutN]
DESCRIPTION
Record and playback control-rate signals on trigger-temporization basis.
INITIALIZATION
no i-rate arguments
PERFORMANCE
ktrig_start - start recording when non-zero
ktrig_stop - stop recording when knumtics trigger impulses are received by this input argument
knumtics - stop recording or reset playing pointer to zero when the number of tics defined by this argument is reached
kfn - table where k-rate signals are recorded
kin1,...,kinN - input signals to record
ktrig - starts playing when non-zero
kout1,...,koutN - playback output signals
tabrec and tabplay opcodes allow to record/playback control signals on trigger-temporization basis.
tabrec opcode records a group of k-rate signals by storing them into kfn table. Each time ktrig_start is triggered,
tabrec resets the table pointer to zero and begins to record. Recording phase stops after knumtics trigger impluses have
been received by ktrig_stop argument.
tabplay plays back a group of k-rate signals, previously recorded by tabrec into a table. Each time ktrig argument is
triggered, an internal counter is increased of one unit. After knumtics trigger impluses are received by ktrig argument,
the internal counter is zeroed and playback is restarted from the beginning, in looping style.
These opcodes can be used like a sort of "middle-term" memory that "remembers" generated signals. Such memory can be
used to supply generative music with a coherent iterative compositional structure.
--------------------------------------------------------------------------------------------------------------
> tb0 ... tb15
> tb0_init ... tb15_init
Table Read Access inside expressions
tb0_init ifn
tb1_init ifn
....
tb15_init ifn
iout = tb0(iIndex)
kout = tb0(kIndex)
iout = tb1(iIndex)
kout = tb1(kIndex)
....
iout = tb15(iIndex)
kout = tb15(kIndex)
DESCRIPTION
Allow to read tables in function fashion, to be used inside expressions
At present time Csound only supports functions with a single input argument. However, to access table elements, user
must provide two numbers, i.e. the number of table and the index of element. So, in order to allow to access a table
element with a function, a previous preparation step should be done.
There are 16 different opcodes whose name is associated with a number from 0 to 15. User can associate a specific table
with each opcode (so the maximum number of tables that can be accessed in function fashion is 16). Prior to access a
table, user must associate the table with one of the 16 opcodes by means of an opcode chosen among tb0_init...tb15_init.
For example,
tb0_init 1
associates table 1 with tb0( ) function, so that, each element of table 1 can be accessed (in function fashion) with:
kvar = tb0(k_some_index_of_table1) * k_some_other_var
ivar = tb0(i_some_index_of_table1) + i_some_other_var
etc...
By using these opcodes, user can drastically reduce the number of lines of an orchestra, improving its readability.
--------------------------------------------------------------------------------------------------------------
> cogoto
I think I have explained this a few times already, but cogoto is an
internal opcode used by if/then/etc., and as such may not actually
need to be documented. Anyway, cogoto is conditional goto taking a
boolean (result of relational operators) and a label argument, and
jumps at i-time if the condition is not true, and it always jumps to
the label at performance time.
Note that unlike all the above, this opcode was not written by
Gabriel Maldonado.
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today
Register for a JBoss Training Course. Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net |