asMapTable make a table for remapping ranges by breakpoints
asMapTable converts a table given as breakpoints
into a signal that can be used by Shaper UGen
for remapping controllers.
E.g., remap an unevenly distributed speaker setup,
given here in angles between 0 and 2 (as for PanAz):
inpos -> outpos
0.0 -> 0.0
0.3 -> 0.4
0.7 -> 0.8
1.0 -> 1.2
1.5 -> 1.6
2.0 -> 2.0 (same as 0.0)
a = [0, 0.3, 0.7, 1, 1.5, 2.0].asMapTable;
a.plot;
// 5.1 surround setup
a = ([ 0, 30, 110, 360 - 110, 360 - 30, 360 ]/180).asMapTable;
a.plot
s.boot;
b = Buffer.sendCollection(s, a.asWavetable, 1);
b.getn(0, 255, { |a| a.postln });
c = { |inpos=0.0|
Shaper.kr(b.bufnum, inpos.wrap(0, 2)).poll;
}.play;
c.set(\inpos, -1);
c.set(\inpos, -0.99);
c.set(\inpos, -0.6);
c.set(\inpos, -0.2);
c.set(\inpos, 0.2);
c.set(\inpos, 0.6);
c.set(\inpos, 0.99);
c.set(\inpos, 1.0);