|
|
|
[ "314s49e1", "tmp" ].collect({arg item; item.asSymbol}).indexOf(\tmp)
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
var stringifyToDepth, transpose, swap;
|
|
|
|
|
|
|
|
stringifyToDepth = {arg data, maxDepth = 1;
|
|
|
|
var prettyString = "", rCount = 0, writeArray, indent;
|
|
|
|
|
|
|
|
if(maxDepth == 0, {
|
|
|
|
data.asCompileString
|
|
|
|
}, {
|
|
|
|
indent = {arg size; size.collect({" "}).join("")};
|
|
|
|
writeArray = {arg array;
|
|
|
|
prettyString = prettyString ++ indent.value(rCount) ++ "[\n";
|
|
|
|
rCount = rCount + 1;
|
|
|
|
if(rCount < maxDepth, {
|
|
|
|
array.do({arg subArray; writeArray.value(subArray)});
|
|
|
|
}, {
|
|
|
|
prettyString = prettyString ++ array.collect({arg subArray;
|
|
|
|
indent.value(rCount + 1) ++ subArray.asCompileString
|
|
|
|
}).join(",\n");
|
|
|
|
});
|
|
|
|
rCount = rCount - 1;
|
|
|
|
prettyString = prettyString ++ "\n" ++ indent.value(rCount) ++ "],\n";
|
|
|
|
};
|
|
|
|
|
|
|
|
writeArray.value(data);
|
|
|
|
prettyString.replace(",\n\n", "\n").drop(-2);
|
|
|
|
})
|
|
|
|
};
|
|
|
|
|
|
|
|
transpose = {arg data, trans, tList;
|
|
|
|
var res;
|
|
|
|
res = data.collect({arg x;
|
|
|
|
x.collect({arg y;
|
|
|
|
y.collect({arg z;
|
|
|
|
[z[0].collect({arg item, itemIndex; if((item == ["Rest"]) || tList.includes(itemIndex).not, {item}, {item + trans })}), z[1]]})})});
|
|
|
|
};
|
|
|
|
|
|
|
|
swap = {arg data, swaplist;
|
|
|
|
var res;
|
|
|
|
res = data.collect({arg x;
|
|
|
|
x.collect({arg y;
|
|
|
|
y.collect({arg z;
|
|
|
|
var cur;
|
|
|
|
cur = z[0];
|
|
|
|
[
|
|
|
|
swaplist.do({arg curSwap; curSwap.postln; cur = cur.postln.swap(curSwap[0], curSwap[1])}); cur,
|
|
|
|
z[1]
|
|
|
|
]
|
|
|
|
})
|
|
|
|
})
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
c = [
|
|
|
|
[
|
|
|
|
[
|
|
|
|
[ [ -3, 5, -2, 1, -2, 2 ], [ -3, 4, -1, 1, -2, 2 ], [ -4, 5, -1, 1, -2, 2 ], [ -5, 5, -1, 2, -2, 2 ] ],
|
|
|
|
[ [ -3, 5, -2, 1, -2, 2 ], [ -3, 4, -1, 1, -2, 2 ], [ -4, 5, -1, 1, -2, 2 ], [ -4, 5, -2, 1, -2, 2 ] ],
|
|
|
|
[ [ -3, 5, -2, 1, -2, 2 ], [ -3, 4, -1, 1, -2, 2 ], [ -4, 5, -1, 1, -2, 2 ], [ -5, 6, -1, 1, -2, 2 ] ],
|
|
|
|
[ [ -3, 5, -2, 1, -2, 2 ], [ -4, 6, -1, 1, -2, 2 ], [ -4, 5, -1, 1, -2, 2 ], [ -5, 6, -1, 1, -2, 2 ] ],
|
|
|
|
[ [ -6, 6, -1, 1, -2, 2 ], [ -4, 6, -1, 1, -2, 2 ], [ -4, 5, -1, 1, -2, 2 ], [ -5, 6, -1, 1, -2, 2 ] ]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
];
|
|
|
|
|
|
|
|
//c = c.collect({arg x; x.collect({arg y; y.collect({arg z; [z[0].collect({arg item; if(item == ["Rest"], {item}, {item + [ 1, -1, 0, 0, -1, 0 ] })}), z[1]]})})});
|
|
|
|
c = transpose.value(c, [ 1, 0, 0, 0, 0, 0 ], [1, 2, 3]);
|
|
|
|
//c = swap.value(c, [[1, 3]]);
|
|
|
|
|
|
|
|
f = File("tweak.txt", "w");
|
|
|
|
|
|
|
|
f.write(stringifyToDepth.value(c, 3));
|
|
|
|
f.close;
|
|
|
|
//c.do({arg x; "[".postln; x.do({arg y; "[".postln; y.do({arg z; [z[0], z[1]].post; ",".postln}); "],".postln}); "]".postln})
|
|
|
|
//c.do({arg x; "[".postln; x.do({arg y; "[".postln; y.do({arg z; [z[0].collect({arg item; if(item == ["Rest"], {item}, {item + [ 0, -1, 0, 0, -1, 1 ]})}), z[1]].post; ",".postln}); "],".postln}); "]".postln})
|
|
|
|
)
|
|
|
|
|
|
|
|
[ 0, -1, 0, 0, -1, 1 ]
|
|
|
|
|
|
|
|
[ -2, 0, 0, 1, 1, 0 ]
|