Skip to content

loopctr

Generate a repeating sequence of control signal shapes.

Syntax

loopctr Schan i/kdests[] [, istatus, iinitreset, iinitval, itype, istart]

Usage

loopctr behaves similarly to loopevent, however instead of generating score events, loopctr repeatedly generates a control signal shape. loopctr reads the current value of a control channel, then over a duration defined in i/krhythms[] moves that control value to a value in idests. The channel value then moves to the next and subsequent destination values in idests[] in breakpoint fashion. When the last value in idests[] is reached, the control signal resets back to the beginning and repeats the movement.

Re-evaluating a loopctr replaces any currently running loops with a matching channel name with immediate effect.


Outputs and Arguments

Schan -- Output channel. loopctr doesn't have a k-rate output argument: Instead, it updates values in this channel.

i/kdests[] -- A series of destination points for the control signal to reach.

i/krhythms[] -- Time intervals for the control value to reach each destination.

istatus (optional, default=1) -- An on/off switch. If istatus=0, the loop stops. If istatus=1, the loop starts.

iinitreset (*optional, default=0) -- Ignore the current value of the channel, and get the initial channel value from iinitval.

iinitval (optional, default=0) -- When iinitreset is non-zero, initialise the loop with this iinitval.

itype (optional, default=0) -- the curve type between destination points. This follows the same type curves as defined in the Csound opcode transeg.

ist (*optional, default=0) -- delay time in seconds to begin the loop.

See also setnode

Example

loopctr.orc

loopctr
instr Sound101
  ;; Sound source
  ares vco2 p4,p5
  kfr = chnget:k("vcf")
  ares moogladder2 ares,kfr,0.7
  ares declickr ares,0.1
send ares
endin

patchsig "Sound101", "outs"
;; connect sound to output.

chnset(6000, "vcf") ;; set an initial channel value.

loopevent fillarray_i(n("Sound101"),0,-1/4,0.5,0), fillarray_i(2,4,6,5,4,5,8,9) - 14, fillarray_i(3),1
loopevent fillarray_i(n("Sound101")+0.1,0,-1/4,0.5,0), fillarray_i(2,4,6,5,4,5,8,9) - 9, fillarray_i(3),1
;; Two loops together for a bit of harmony. Evaluate both these at once. 

loopctr "vcf",fillarray_i(3000,100),fillarray_i(0.5,1.5),1
;; now apply a repeating envelope.