Skip to content

setnode

Redirect the recurse destination of a loopevent.

Syntax

setnode Snodesrc, Snodedest [, iprob]

setnode inodesrc, inodedest [, iprob]
setnode(Snodesrc, Snodedest [, iprob])

setnode(inodesrc, inodedest [, iprob])

Usage

graph LR
  A([loopevent1]) ---> B([loopevent2]);
  A -- 50% --> A
  B ---> C([loopevent3]);
  C ----> A;

setnode can be used in conjunction with loopevents. Typical behaviour of a loopevent is to recursively schedule itself. We can say that the destination of the scheduled loopevent is itself. setnode redirects the recurse destination of one loopevent to another loopevent instance. This allows for a network of loopevent 'nodes' to be connected, each node triggering a call to another destination loopevent. The call to the destination node occurs when the last event has been generated from the irhythms[] array in loopevent. A probability factor introduces some limited Markov chain behaviour.

setnode is loosely based from concepts used in the Nodal generative music software.


Arguments

Snodesrc -- The source loopevent instance ID. This is typically the instrument name used in p1 of the i/kevent array in loopevent

inodesrc -- The source loopevent instance ID, This is typically the instrument number used in p1 of the i/kevent array in loopevent

Snodedest -- The destination loopevent instance ID. This is typically the instrument name used in p1 of the i/kevent array in loopevent

inodesrc -- The destination loopevent instance ID, This is typically the instrument number used in p1 of the i/kevent array in loopevent

iprob (optional, default=1) -- The probability that the destination node is called, or if loopevent calls itself again. Default is 1 - the destination node will always be called.

Example

setnode.orc

setnode
instr Sound101
  ;; Sound source 1

  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.

giimpulse ftgen 0,0,64,21,5,0.5

instr Sound102
  ;; Sound source 2

  ares vibes p4, p5, 0.2, 0.76, giimpulse, -1, 0.03, -1, 0.1
  ares pdclip ares, p6,0,1
  ares declickr ares
  send ares*0.15  
endin

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

loopevent fillarray_i(n("Sound101"),0,1.3,0.5,0), fillarray_i(2,4,6,5,4,5,8,9), fillarray_i(1/6,2/6,1/6,1/6,1/6),1
loopevent fillarray_i(n("Sound102"),0,1/2,0.5,0,0.8), fillarray_i(2,4,6,5) - 7, fillarray_i(1/3,1/3,1/3,1/6,1/6),0
;;;Two loopevents but note that we evaluate the 2nd one with the 'on/off' status at 0.                          ^^^
;;;The 2nd loopevent isn't 'activated' but it still sets a node.

setnode n("Sound101"), n("Sound102")
setnode n("Sound102"), n("Sound101")
;; evaluate both these together.
;; The first setnode redirects the first loopevent to the 2nd.
;; The 2nd setnode redirects back to the first.