trigseq — Accepts a trigger signal as input and outputs a group of values.


Accepts a trigger signal as input and outputs a group of values.


trigseq ktrig_in, kstart, kloop, kinitndx, kfn_values, kout1 [, kout2] [...]


ktrig_in -- input trigger signal

kstart -- start index of looped section

kloop -- end index of looped section

kinitndx -- initial index

[Note] Note

Although kinitndx 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 init.

kfn_values -- numer of a table containing a sequence of groups of values

kout1 -- output values

kout2, ... (optional) -- more output values

This opcode handles timed-sequences of groups of values stored into a table.

trigseq accepts a trigger signal (ktrig_in) as input and outputs group of values (contained in the 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 kinitndx) correspond to valid table numbers, otherwise Csound will crash because no range-checking is implemented.

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.

trigseq is designed to be used together with seqtime or trigger opcodes.

See Also

seqtime, trigger


Author: Gabriel Maldonado

November 2002. Added a note about the kinitndx parameter, thanks to Rasmus Ekman.

January 2003. Thanks to a note from Oeyvind Brandtsegg, I corrected the credits.

New in version 4.06