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.
96 lines
3.4 KiB
Plaintext
96 lines
3.4 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;
|
|
var res;
|
|
res = data.collect({arg x;
|
|
x.collect({arg y;
|
|
y.collect({arg z;
|
|
[z[0].collect({arg item; if(item == ["Rest"], {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 = [
|
|
[
|
|
[
|
|
[ [ [ 0, 0, 0, 0, 0, 0 ], [ "Rest" ], [ "Rest" ], [ "Rest" ] ], 3.875 ],
|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 [ "Rest" ], [ 1, 0, -1, 0, 0, 0 ], [ "Rest" ], [ 1, 0, 0, 0, 0, -1 ] ], 0 ],
|
|
[ [ [ "Rest" ], [ 1, 0, -1, 0, 0, 0 ], [ "Rest" ], [ "Rest" ] ], 0 ],
|
|
[ [ [ "Rest" ], [ "Rest" ], [ "Rest" ], [ "Rest" ] ], 9.625 ]
|
|
]
|
|
]
|
|
];
|
|
|
|
//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, [ 0, 2, -1, 0, 0, 0 ]);
|
|
//c = swap.value(c, [[2, 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 ] |