// title: Remap Channel Outputs // author: smoge // 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-. // code: ( ~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); )