Maybe something like a dictionary or an association could be helping here which remaps the channel at the bottom of the graph - something like the SafetyQuark?
~myMap = (0->0, 1->1, 2->3, 3->4);
// should this be static class instead of a object?
RemapOutChannels.applyMap(~myMap);
Some additional options could be
// apply identity except on the provided values
RemapOutChannels.identity((2->3, 3->2));
or also add a way to silent all undefined values
// apply identity except on the provided keys
RemapOutChannels.applyMap((0->0, 2->2), silentUndefined: true);
which could also be made explicitly via an association which maps to nil
RemapOutChannels.applyMap((0->nil, 1->0));
The question is if mappings such as 0->0, 1->0, 2->0, 3->0
should be “meaned”? Maybe there is a way to define the folding operation here, such as sum
or mean
? As scsynth is operating in 32 bit floats, this could also be considered not a problem since the scaling can happen via volume.
TotalMix offers a mixing matrix - maybe RemapOutChannels
(or whatever it is called) could work internally via such a routing matrix as well which could also be set manually for more granular control.
~mixMatrix = Array2D.fromArray(4, 4, 16.collect(0.0));
// apply identity
4.do({|i| ~mixMatrix[i, i] = 1.0});
// also add 0.5 of chanel 0 to chanel 1
~mixMatrix[0, 1] = 0.5;
// apply re-routing
RemapOutChannels.applyMatrix(~mixArray);
I think such a feature would be a great addition when working with multi-channel, either as a Quark or within the standard library. Maybe simply re-implement TotalMix without TotalMix?