|
|
|
@ -378,33 +378,66 @@ genAccompPart = {arg modeState, temporalData, offset, trans, part, register;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//~~~~~~~~~~~~GENERATE ELECTRONIC BASS~~~~~~~~~~~~
|
|
|
|
|
genBassPart = {arg root, offset1, offset2;
|
|
|
|
|
var bassData;
|
|
|
|
|
genBassPart = {arg root, temporalData1, temporalData2, offset1, offset2, hi;
|
|
|
|
|
"here".postln;
|
|
|
|
|
[
|
|
|
|
|
[24.midicps * frToFloat.value(frCollapse.value(frAdd.value(root, [[3], [2]]))), offset1, (offset2 + 32) - (offset1), 10, 5, 1],
|
|
|
|
|
//[24.midicps * frToFloat.value(root) * 3/2, offset2 + 16, 1],
|
|
|
|
|
[24.midicps * frToFloat.value(root), offset2 + 32, 5, 10, 30, 1]]
|
|
|
|
|
if(hi, {
|
|
|
|
|
var attacks, attacksMin, attacksMax;
|
|
|
|
|
attacks = temporalData2.collect({arg ptd; ptd.indexOf(1)}).postln;
|
|
|
|
|
attacksMin = attacks.minItem;
|
|
|
|
|
attacksMax = attacks.maxItem;
|
|
|
|
|
[
|
|
|
|
|
24.midicps * frToFloat.value(frCollapse.value(frAdd.value(root, [[3], [2]]))),
|
|
|
|
|
offset1 + temporalData1[0].size,
|
|
|
|
|
(attacksMin + offset2) - (offset1 + temporalData1[0].size), // + ((temporalData2.size - temporalData2.indexOf(1)) * 1/6),
|
|
|
|
|
attacksMax - attacksMin,
|
|
|
|
|
temporalData2.size - attacksMax,
|
|
|
|
|
1
|
|
|
|
|
].postln
|
|
|
|
|
}, {
|
|
|
|
|
//[24.midicps * frToFloat.value(root) * 3/2, offset2 + 16, 1],
|
|
|
|
|
var attacks, attacksMin, attacksMax;
|
|
|
|
|
attacks = temporalData1.collect({arg ptd; ptd.indexOf(1)}).postln;
|
|
|
|
|
attacksMin = attacks.minItem;
|
|
|
|
|
attacksMax = attacks.maxItem;
|
|
|
|
|
[
|
|
|
|
|
24.midicps * frToFloat.value(root),
|
|
|
|
|
attacksMin + offset1,
|
|
|
|
|
//(temporalData1.size - temporalData1.indexOf(1)) * 1/6,
|
|
|
|
|
//(temporalData1.size - temporalData1.indexOf(1)) * 5/6,
|
|
|
|
|
attacksMax - attacksMin,
|
|
|
|
|
temporalData1[0].size - attacksMax,
|
|
|
|
|
(offset2) - (offset1 + temporalData1[0].size),
|
|
|
|
|
1
|
|
|
|
|
].postln
|
|
|
|
|
});
|
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//~~~~~~~~~~~~GENERATE ALL MUSIC DATA~~~~~~~~~~~~
|
|
|
|
|
~genMusicData = {arg seed;
|
|
|
|
|
var totalDur, dUnit, totalLen, curLen,
|
|
|
|
|
modeState, temporalState, partStates, lastCadenceState, lastCadencePoint,
|
|
|
|
|
var totalDur, section1Dur, dUnit, totalLen, section1Len, curLen, cadence,
|
|
|
|
|
modeState, temporalState, partStates, lastCadenceTemporalData, lastCadenceState, lastCadencePoint,
|
|
|
|
|
ensData, accompData, bassData, sectionData,
|
|
|
|
|
roots, lastRoots, sectionCount, subsectionCount, sectionNavDict;
|
|
|
|
|
|
|
|
|
|
thisThread.randSeed = seed;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
totalDur = 6 * 60;
|
|
|
|
|
section1Dur = 2 * 60;
|
|
|
|
|
dUnit = 8.reciprocal;
|
|
|
|
|
totalLen = (totalDur / dUnit).round(16);
|
|
|
|
|
section1Len = (section1Dur / dUnit).round(16);
|
|
|
|
|
curLen = 0;
|
|
|
|
|
cadence = false;
|
|
|
|
|
|
|
|
|
|
modeState = initModeState.value;
|
|
|
|
|
temporalState = initTemporalState.value;
|
|
|
|
|
partStates = initPartStates.value;
|
|
|
|
|
lastCadenceTemporalData = nil;
|
|
|
|
|
lastCadenceState = modeState.deepCopy;
|
|
|
|
|
lastCadencePoint = 0;
|
|
|
|
|
|
|
|
|
@ -416,7 +449,7 @@ genBassPart = {arg root, offset1, offset2;
|
|
|
|
|
|
|
|
|
|
sectionCount = 1;
|
|
|
|
|
subsectionCount = 1;
|
|
|
|
|
while({curLen < totalLen}, {
|
|
|
|
|
while({(curLen < totalLen) || ((curLen >= totalLen) && cadence.not)}, {
|
|
|
|
|
var temporalData;
|
|
|
|
|
# temporalData, temporalState = genTemporalData.value(temporalState, modeState, curLen == 0);
|
|
|
|
|
|
|
|
|
@ -426,7 +459,7 @@ genBassPart = {arg root, offset1, offset2;
|
|
|
|
|
|
|
|
|
|
lastRoots = if(curLen == 0, {4.collect({[[1], [1]]})}, {roots.slice(nil, 0)});
|
|
|
|
|
roots = distributeRoots.value(modeState, lastRoots);
|
|
|
|
|
roots.size.postln;
|
|
|
|
|
//roots.size.postln;
|
|
|
|
|
|
|
|
|
|
sectionData.add((curLen / 4).asInteger->[roots, lastRoots.collect({arg fr, part;
|
|
|
|
|
[fr, 36.midicps * pow(2, [1, 0, 1, 2][part]) * frToFloat.value(fr)]}), sectionCount, subsectionCount]);
|
|
|
|
@ -453,25 +486,50 @@ genBassPart = {arg root, offset1, offset2;
|
|
|
|
|
subsectionCount = subsectionCount + 1;
|
|
|
|
|
thisThread.randSeed = (seed + (sectionCount * 100) + subsectionCount);
|
|
|
|
|
|
|
|
|
|
if(collectRoots.value(modeState).size == 1, {
|
|
|
|
|
sectionCount = sectionCount + 1;
|
|
|
|
|
subsectionCount = 1;
|
|
|
|
|
lastCadenceState = modeState;
|
|
|
|
|
if(curLen > section1Len, {
|
|
|
|
|
if(collectRoots.value(modeState).size == 1, {
|
|
|
|
|
|
|
|
|
|
if(curLen > 0, {
|
|
|
|
|
bassData[0] = bassData[0] ++ genBassPart.value(roots[0][0].postln, lastCadencePoint.postln, curLen);
|
|
|
|
|
});
|
|
|
|
|
"asdfasfdsf".postln;
|
|
|
|
|
|
|
|
|
|
if(sectionCount > 1, {
|
|
|
|
|
bassData[0] = bassData[0] ++
|
|
|
|
|
genBassPart.value(collectRoots.value(lastCadenceState).asList[0],
|
|
|
|
|
lastCadenceTemporalData, temporalData, lastCadencePoint, curLen, false);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//bassData[0] = bassData[0] ++ genBassPart.value(roots[0][0].postln, curLen);
|
|
|
|
|
if(sectionCount > 0, {
|
|
|
|
|
bassData[0] = bassData[0] ++
|
|
|
|
|
genBassPart.value(collectRoots.value(modeState).asList[0],
|
|
|
|
|
lastCadenceTemporalData, temporalData, lastCadencePoint, curLen, true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//bassData[0] = bassData[0] ++ genBassPart.value(roots[0][0].postln, curLen);
|
|
|
|
|
|
|
|
|
|
//lastCadenceState = modeState;
|
|
|
|
|
|
|
|
|
|
lastCadencePoint = curLen + temporalData[0].size;
|
|
|
|
|
lastCadencePoint.postln;
|
|
|
|
|
sectionCount = sectionCount + 1;
|
|
|
|
|
subsectionCount = 1;
|
|
|
|
|
//lastCadenceTemporalData = temporalData[0];
|
|
|
|
|
//lastCadencePoint = curLen;
|
|
|
|
|
//cadence = true;
|
|
|
|
|
//lastCadencePoint.postln;
|
|
|
|
|
|
|
|
|
|
lastCadenceState = modeState;
|
|
|
|
|
lastCadenceTemporalData = temporalData;
|
|
|
|
|
lastCadencePoint = curLen;
|
|
|
|
|
cadence = true;
|
|
|
|
|
|
|
|
|
|
}, {cadence = false});
|
|
|
|
|
modeState = advanceMode.value(modeState, lastCadenceState);
|
|
|
|
|
});
|
|
|
|
|
if(curLen == 0, {
|
|
|
|
|
lastCadenceTemporalData = temporalData[0];
|
|
|
|
|
lastCadencePoint = curLen;
|
|
|
|
|
});
|
|
|
|
|
modeState = advanceMode.value(modeState, lastCadenceState);
|
|
|
|
|
curLen = curLen + temporalData[0].size;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
[ensData, accompData, sectionData, bassData.postln, sectionNavDict]
|
|
|
|
|
[ensData, accompData, sectionData, bassData, sectionNavDict]
|
|
|
|
|
};
|
|
|
|
|
//~genMusicData.value(100)
|
|
|
|
|
)
|
|
|
|
|