You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
4.2 KiB
Plaintext
106 lines
4.2 KiB
Plaintext
[ "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 = [
|
|
[
|
|
[
|
|
[ [ [ -2, 3, -2, -1, 1, 0 ], [ "Rest" ], [ "Rest" ], [ "Rest" ] ], 1 ],
|
|
[ [ [ -2, 3, -2, -1, 1, 0 ], [ "Rest" ], [ "Rest" ], [ -2, 4, -2, -1, 1, 0 ] ], 0 ],
|
|
[ [ [ -2, 3, -2, -1, 1, 0 ], [ "Rest" ], [ -1, 3, -2, -1, 2, 0 ], [ -2, 4, -2, -1, 1, 0 ] ], 0 ],
|
|
[ [ [ -2, 3, -2, -1, 1, 0 ], [ -2, 3, -1, -1, 1, 0 ], [ -1, 3, -2, -1, 2, 0 ], [ -2, 4, -2, -1, 1, 0 ] ], 7 ]
|
|
],
|
|
[
|
|
[ [ [ -2, 3, -2, -1, 1, 0 ], [ -2, 3, -1, -1, 1, 0 ], [ -1, 3, -1, -1, 1, 0 ], [ -2, 4, -2, -1, 1, 0 ] ], 0 ],
|
|
[ [ [ -2, 3, -2, -1, 1, 0 ], [ -1, 3, -2, -1, 1, -1 ], [ -1, 3, -1, -1, 1, 0 ], [ -2, 4, -2, -1, 1, 0 ] ], 0 ],
|
|
[ [ [ -2, 3, -2, -1, 1, 0 ], [ -1, 3, -2, -1, 1, -1 ], [ -1, 3, -1, -1, 1, 0 ], [ -1, 3, -2, -1, 0, 0 ] ], 5.5 ]
|
|
],
|
|
[
|
|
[ [ [ -2, 3, -2, -1, 1, 0 ], [ -1, 3, -2, -1, 1, -1 ], [ 0, 2, -2, -1, 1, 0 ], [ -1, 3, -2, -1, 0, 0 ] ], 0 ],
|
|
[ [ [ -2, 3, -2, -1, 1, 0 ], [ -1, 3, -2, -1, 1, -1 ], [ 0, 2, -2, -1, 1, 0 ], [ -1, 2, -2, -1, 1, 0 ] ], 0 ],
|
|
[ [ [ -2, 3, -2, -1, 1, 0 ], [ -1, 3, -3, -1, 1, 0 ], [ 0, 2, -2, -1, 1, 0 ], [ -1, 2, -2, -1, 1, 0 ] ], 4 ]
|
|
],
|
|
[
|
|
[ [ [ -2, 3, -2, -1, 1, 0 ], [ -1, 3, -3, -1, 1, 0 ], [ 0, 3, -2, -2, 1, 0 ], [ -1, 2, -2, -1, 1, 0 ] ], 0 ],
|
|
[ [ [ -2, 3, -2, -1, 1, 0 ], [ -1, 3, -3, -1, 1, 0 ], [ 0, 3, -2, -2, 1, 0 ], [ -2, 3, -1, -1, 1, 0 ] ], 0 ],
|
|
[ [ [ -2, 3, -2, -1, 1, 0 ], [ -2, 3, -2, -1, 1, 1 ], [ 0, 3, -2, -2, 1, 0 ], [ -2, 3, -1, -1, 1, 0 ] ], 5.625 ]
|
|
],
|
|
[
|
|
[ [ [ -2, 3, -2, -1, 1, 0 ], [ -2, 3, -2, -1, 1, 1 ], [ -1, 3, -2, -1, 1, 0 ], [ -2, 3, -1, -1, 1, 0 ] ], 0 ],
|
|
[ [ [ -2, 3, -2, -1, 1, 0 ], [ -2, 3, -2, -1, 1, 1 ], [ -1, 3, -2, -1, 1, 0 ], [ -1, 3, -2, -1, 1, -1 ] ], 0 ],
|
|
[ [ [ -2, 3, -2, -1, 1, 0 ], [ -2, 3, -2, 0, 1, 0 ], [ -1, 3, -2, -1, 1, 0 ], [ -1, 3, -2, -1, 1, -1 ] ], 6.5 ],
|
|
[ [ [ -2, 3, -2, -1, 1, 0 ], [ -2, 3, -2, 0, 1, 0 ], [ "Rest" ], [ -1, 3, -2, -1, 1, -1 ] ], 0 ],
|
|
[ [ [ "Rest" ], [ -2, 3, -2, 0, 1, 0 ], [ "Rest" ], [ -1, 3, -2, -1, 1, -1 ] ], 0 ],
|
|
[ [ [ "Rest" ], [ "Rest" ], [ "Rest" ], [ -1, 3, -2, -1, 1, -1 ] ], 0 ],
|
|
[ [ [ "Rest" ], [ "Rest" ], [ "Rest" ], [ "Rest" ] ], 6.375 ]
|
|
]
|
|
]
|
|
];
|
|
|
|
//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 ] |