kr loopseg kfreq, ktrig, ktim0, kval0[, ktim1, kval1,...ktimN, kvalN] kr lpshold kfreq, ktrig, ktim0, kval0[, ktim1, kval1,...ktimN, kvalN]
Generate a control signal, or envelope, consisting of linear segments delimited by two or more specified points. The entire envelope is looped at kfreq rate. Each parameter can be varied at k-rate. New in Csound 4.13
kfreq – repeat rate. Expressed in Hz or fraction of Hz. Negative values will read the envelope backward.
ktrig – if non-zero, retriggers the envelope from start, before the envelope cycle is completed. See trigger opcode.
ktim0, ktim1, etc. – time of points. Expressed, in arbitrary units, as a fraction of a complete cycle. ktim0 will usually be set to 0, except for special effects.
kval0, kval1, etc. – values of points
loopseg is similar to linseg, except the entire envelope is looped at kfreq rate. Note that times are not expressed in seconds, but as a fraction of a complete cycle. The relative duration of each segment is is fixed proportionally to the others, as defined by ktim0, ktim1, etc. The duration of an entire cycle is the sum of all duration values, rescaled according to kfreq. For an envelope made up of three segments, with each segment having 100 as a duration, the total duration will be 300. This duration, in arbitrary units, is then scaled by kfreq to obtain the actual envelope duration in seconds.
lpshold is similar to loopseg, but generates only horizontal segments. Each kval is held for the duration of the segment. This is useful for, among other things, melodic control, similar to analog sequencers.
instr 1 kfreq init .5 ; set duration of loop at 2 seconds k0 line 1, p3, 33 ; increase duration of first segment on each repetition k1 loopseg .5, 0, 0, 0, k0, 32000, 66, 5000, 100, 0 endin