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.
130 lines
3.9 KiB
Plaintext
130 lines
3.9 KiB
Plaintext
//transposing and swapping parts
|
|
(
|
|
|
|
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" ] ], 0.625 ],
|
|
[ [ [ 0, 0, 0, 0, 0, 0 ], [ "Rest"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[ [ [ 0, 0, 0, 0, 0, 0 ], [ 1, -1, 0, 0, 0, 0 ], [ 0, 1, 0, 0, -1, 0 ], [ 0, 1, 0, 0, 0, 0 ] ], 1.5 ],
|
|
[ [ [ 0, 0, 0, 0, 0, 0 ], [ 1, -1, 0, 0, 0, 0 ], [ 0, -1, 0, 0, 0, 1 ], [ 0, 1, 0, 0, 0, 0 ] ], 1.5 ],
|
|
[ [ [ 0, 0, 0, 0, 0, 0 ], [ 1, -1, 0, 0, 0, 0 ], [ 0, 1, 0, 0, 0, -1 ], [ 0, 1, 0, 0, 0, 0 ] ], 1.75 ],
|
|
[ [ [ 0, 0, 0, 0, 0, 0 ], [ 1, -1, 0, 0, 0, 0 ], [ "Rest" ], [ 0, 1, 0, 0, 0, 0 ] ], 1.125 ],
|
|
[ [ [ 0, 0, 0, 0, 0, 0 ], [ 1, -1, 0, 0, 0, 0 ], [ "Rest" ], [ "Rest" ] ], 0.5 ],
|
|
[ [ [ 0, 0, 0, 0, 0, 0 ], [ "Rest" ], [ "Rest" ], [ "Rest" ] ], 0 ],
|
|
[ [ [ "Rest" ], [ "Rest" ], [ "Rest" ], [ "Rest" ] ], 1.25 ]
|
|
]
|
|
]
|
|
];
|
|
|
|
c = transpose.value(c, [ 1, -1, 0, -1, 1, 0 ]);
|
|
|
|
f = File("tweak.txt", "w");
|
|
|
|
f.write(stringifyToDepth.value(c, 3));
|
|
f.close;
|
|
)
|
|
|
|
//reorganize existing file structure so each ledger has its own resource folder for easier pruning
|
|
(
|
|
var ledgerName, ledger, path;
|
|
|
|
ledger = [
|
|
"314s49e1",
|
|
"4c01589b",
|
|
"7e170ef8",
|
|
"7ac10d34",
|
|
"640eeed3",
|
|
"5e947063",
|
|
"5cf1e9ab",
|
|
"7aa8c429",
|
|
"7ead41c3",
|
|
"62b894e8",
|
|
"628d5c8b",
|
|
"55930f4d",
|
|
"4cf4476d",
|
|
"6abf27d4",
|
|
"46a0e6a8",
|
|
"6be1486c",
|
|
"7000ae3e",
|
|
"69a72421",
|
|
"6506161e",
|
|
"65c4abeb",
|
|
"661a850b",
|
|
"46f2010f"
|
|
];
|
|
|
|
ledgerName = "piece_ledger";
|
|
path = "/home/mwinter/Sketches/seeds_and_ledgers/source/resources";
|
|
|
|
File.mkdir(path +/+ ledgerName);
|
|
|
|
ledger.do({arg id; id.postln; File.copy(path +/+ id, path +/+ ledgerName +/+ id)});
|
|
|
|
)
|
|
|