Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: Remap Channel Outputs
name
code content
( ~remapConfig = IdentityDictionary[ 0 -> 1, 1 -> 2, 2 -> 3, 3 -> 4, 4 -> 5, 5 -> 6, 6 -> 7, 7 -> 8, 8 -> 9, 9 -> 12, 10 -> 13, 11 -> 14, 12 -> 15, 13 -> 16, 14 -> 17 ]; ~generateRemapSynthDef = { |numInputChannels, numOutputChannels| SynthDef(\remapOutputs, { var sig = In.ar(0, numInputChannels); var remapped = Array.fill(numOutputChannels, { Silent.ar(1) }); ~remapConfig.keysValuesDo { |src, dest| if (src < numInputChannels and: { dest < numOutputChannels }) { remapped[dest] = sig[src]; } }; ReplaceOut.ar(0, remapped); }).add; }; ~generateRemapSynthDef.(16, 18); ) ( ~createRemapSynth = { ~remapSynth = Synth(\remapOutputs, target: s.defaultGroup, addAction: \addAfter); }; ServerTree.add( ~createRemapSynth); )
code description
This code sets up a remapping system where input channels are mapped to output channels based on a predefined configuration. The remapping is done using a SynthDef that reads input signals, applies the remapping, and outputs the remapped signals. The ServerTree.add ensures that the remap synth is created and added to the server's node tree upon server startup and cmd-. and ctrl-. Based on discussions and ideas from: https://scsynth.org/t/discontinuous-multichannel-out/9518/28
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change