Skip to content

patchchain

Route audio between multiple instruments at once.

Syntax

patchchain Spatharray [ ,ilevel/Slevel]
patchchain(Spatharray [ ,ilevel/Slevel])

Usage

graph LR
  A[Source] --> B[Effect1] --> C[Effect2];
  C --> D[outs];
patchchain routes audio between a series to instruments as specified in a string array. Audio is carried from 'left to right' (index zero to the last index) in the array. All the instruments following the first instrument should be effects able to receive input (or the global "outs" output). Live re-patching by updating Spatharray is possible. The routing from one instrument to the next is handled by patchsig.


Arguments

Spatharray -- A string array with named instruments and effects.

ilevel (optional, default=1) -- An amplitude multiplier applied to the Destination output.

Slevel (optional) -- When using a string Slevel will read a channel name to retrieve the multiplier.

Example

patchchain.orc

patchchain
instr Sound101
  ;; Sound source

 ares pluck p4,p5,p5,0,1

send ares
endin

loopevent fillarray_i(n("Sound101"),0,0.75,0.5,0), genarray(0,14,1.333) - 7, euclidean_i(9,5,1),1,-1,0.83
loopevent fillarray_i(n("Sound101")+0.1,0,4,0.8,0), fillarray_i(0) - 14, fillarray_i(8),1
;; generate events

EffectConstruct "Rvb", {{
ain = ains[0]

aout1, aout2 reverbsc ain, ain, 0.85, 11000

aouts[] fillarray aout1, aout2
}},1,2,1
;; stereo reverb

EffectConstruct "phaser", {{
ainL = ains[0]
ainR = ains[1]

aout1 phaser1 ainL, oscili:k(1500,0.05) + 1500.1,3,0.75
aout2 phaser1 ainR, oscili:k(1500,-0.05) + 1500.1,3,0.75

aouts[] fillarray aout1, aout2
}},2,2,1
;; stereo phaser

patchchain,fillarray("Sound101","Rvb","phaser","outs")
;; connect them all together in series.