Skip to content

counterChan

Create a counter object, using a channel to save state.

Syntax

ival counterChan Schan [iincrement] [, icinit] [, imchannel]
ival = counterChan(Schan [iincrement] [, icinit] [, imchannel])

Usage

counterChan yields and increments a value stored in a channel upon evaluation.


Outputs and arguments

ival -- The output value.

Schan -- Channel name to store the current value.

iincrement (optional, default=1) -- Amount to increment the channel.

imodulo (optional, default=0 - no modulo) -- An upper bound for the output. Values are wrapped between this and ilower.

ilower (optional, default=0) -- A lower bound for the output. Values are wrapped around this value.

Example

See the example for loopevent.orc

cosr
instr Sound101
  ;; Sound source

  ares vco2 p4,p5
  kfr transeg 8000, 0.2, -5, p5*4, p3-0.4, 2, p5
  ares moogladder2 ares,kfr/(cosr(12, 5, 5.5)),0.6
send ares
endin

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

loopevent fillarray_i(n("Sound101"),0,-1/9,0.5,0), fillarray_i(2,4,6,5,4,5,8,9) - 14, fillarray_i(1/12),1
;; A flamboyant run.