|
|
@ -4,7 +4,7 @@ genMode, hdChoose, wchooseDict, collectRoots,
|
|
|
|
initModeState, advanceMode,
|
|
|
|
initModeState, advanceMode,
|
|
|
|
initTemporalState, genTemporalData,
|
|
|
|
initTemporalState, genTemporalData,
|
|
|
|
initPartStates, distributeRoots,
|
|
|
|
initPartStates, distributeRoots,
|
|
|
|
genEnsemblePart, genAccompPart, genMusicData, genScoreData, genPatterns;
|
|
|
|
genEnsemblePart, genAccompPart, genBassPart, genMusicData, genScoreData, genPatterns;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//~~~~~~~~~~~~FREQUENCY RATIO MATH FUNCTIONS~~~~~~~~~~~~
|
|
|
|
//~~~~~~~~~~~~FREQUENCY RATIO MATH FUNCTIONS~~~~~~~~~~~~
|
|
|
@ -208,8 +208,9 @@ genTemporalData = {arg lastTupleState, modeState, cadenceOverride, noParts = 4;
|
|
|
|
|
|
|
|
|
|
|
|
flourish = (if(cadence, {16}, {8}) + 32.rand).collect({[0, 1].wchoose([flourishDensity, 1].normalizeSum)});
|
|
|
|
flourish = (if(cadence, {16}, {8}) + 32.rand).collect({[0, 1].wchoose([flourishDensity, 1].normalizeSum)});
|
|
|
|
buffer = 16.collect({0});
|
|
|
|
buffer = 16.collect({0});
|
|
|
|
beforeLen = if(cadence, {32.rand}, {((timeToNextEvent - flourish.size - buffer.size) / 2).asInteger.rand});
|
|
|
|
//beforeLen = if(cadence, {32.rand}, {((timeToNextEvent - flourish.size - buffer.size) / 2).asInteger.rand});
|
|
|
|
before = beforeLen.collect({arg i; [0, 1].wchoose([genDensity, 1].normalizeSum)});
|
|
|
|
beforeLen =((timeToNextEvent - flourish.size - buffer.size) / if(cadence, {1.25}, {1})).asInteger.rand;
|
|
|
|
|
|
|
|
before = beforeLen.collect({arg i; [0, 1].wchoose([genDensity, 0.25].normalizeSum)});
|
|
|
|
//if(collectRoots.value(modeState).size == 1, {before = [0]});
|
|
|
|
//if(collectRoots.value(modeState).size == 1, {before = [0]});
|
|
|
|
after = (timeToNextEvent - before.size - flourish.size - buffer.size).collect({[0, 1].wchoose([genDensity, 1].normalizeSum)});
|
|
|
|
after = (timeToNextEvent - before.size - flourish.size - buffer.size).collect({[0, 1].wchoose([genDensity, 1].normalizeSum)});
|
|
|
|
flourish = before ++ flourish ++ after;
|
|
|
|
flourish = before ++ flourish ++ after;
|
|
|
@ -349,18 +350,26 @@ genEnsemblePart = {arg partState, modeState, temporalData, roots, part, offset;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//~~~~~~~~~~~~GENERATE ELECTRONIC ACCOMPANIMENT~~~~~~~~~~~~
|
|
|
|
//~~~~~~~~~~~~GENERATE ELECTRONIC ACCOMPANIMENT~~~~~~~~~~~~
|
|
|
|
genAccompPart = {arg modeState, temporalData, offset, trans, part;
|
|
|
|
genAccompPart = {arg modeState, temporalData, offset, trans, part, register;
|
|
|
|
var firstChange, accompData;
|
|
|
|
var firstChange, accompData;
|
|
|
|
firstChange = false;
|
|
|
|
firstChange = false;
|
|
|
|
accompData = [];
|
|
|
|
accompData = [];
|
|
|
|
temporalData.do({arg val, tS;
|
|
|
|
temporalData.do({arg val, tS;
|
|
|
|
var change;
|
|
|
|
var change;
|
|
|
|
change = [val == 1, (val == 1) && firstChange.not].wchoose([1, if(part == 0, {5}, {2})].normalizeSum); //5 * abs((curPulse / totalLen).clip(0, 0.8) - 1)].normalizeSum);
|
|
|
|
change = [val == 1, (val == 1) && firstChange.not].wchoose([1, if(part == 0, {5}, {3})].normalizeSum); //5 * abs((curPulse / totalLen).clip(0, 0.8) - 1)].normalizeSum);
|
|
|
|
if(change, {
|
|
|
|
if(change, {
|
|
|
|
var sel, freq, amp;
|
|
|
|
var sel, freq, amp;
|
|
|
|
sel = wchooseDict.value(modeState, 0.1);
|
|
|
|
sel = wchooseDict.value(modeState, 0.1);
|
|
|
|
freq = 48.midicps * trans * frToFloat.value(sel);
|
|
|
|
freq = 48.midicps * trans * frToFloat.value(sel);
|
|
|
|
amp = [0, 1, 2, 3].wchoose([5, 2, 1, 1].normalizeSum);
|
|
|
|
amp = [0, 1, 2, 3].wchoose([2, 2, 1, 1].normalizeSum);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
if(register == 0, {
|
|
|
|
|
|
|
|
amp = 3;
|
|
|
|
|
|
|
|
freq = 24.midicps * trans * frToFloat.value(sel);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
accompData = accompData.add([freq, tS + offset, amp, part]);
|
|
|
|
accompData = accompData.add([freq, tS + offset, amp, part]);
|
|
|
|
firstChange = true;
|
|
|
|
firstChange = true;
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -368,17 +377,27 @@ genAccompPart = {arg modeState, temporalData, offset, trans, part;
|
|
|
|
accompData
|
|
|
|
accompData
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//~~~~~~~~~~~~GENERATE ELECTRONIC BASS~~~~~~~~~~~~
|
|
|
|
|
|
|
|
genBassPart = {arg root, offset1, offset2;
|
|
|
|
|
|
|
|
var bassData;
|
|
|
|
|
|
|
|
[
|
|
|
|
|
|
|
|
[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]]
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//~~~~~~~~~~~~GENERATE ALL MUSIC DATA~~~~~~~~~~~~
|
|
|
|
//~~~~~~~~~~~~GENERATE ALL MUSIC DATA~~~~~~~~~~~~
|
|
|
|
~genMusicData = {arg seed;
|
|
|
|
~genMusicData = {arg seed;
|
|
|
|
var totalDur, dUnit, totalLen, curLen,
|
|
|
|
var totalDur, dUnit, totalLen, curLen,
|
|
|
|
modeState, temporalState, partStates, lastCadenceState,
|
|
|
|
modeState, temporalState, partStates, lastCadenceState, lastCadencePoint,
|
|
|
|
ensData, accompData, sectionData,
|
|
|
|
ensData, accompData, bassData, sectionData,
|
|
|
|
roots, lastRoots, sectionCount, subsectionCount, sectionNavDict;
|
|
|
|
roots, lastRoots, sectionCount, subsectionCount, sectionNavDict;
|
|
|
|
|
|
|
|
|
|
|
|
thisThread.randSeed = seed;
|
|
|
|
thisThread.randSeed = seed;
|
|
|
|
|
|
|
|
|
|
|
|
totalDur = 3 * 60;
|
|
|
|
totalDur = 6 * 60;
|
|
|
|
dUnit = 8.reciprocal;
|
|
|
|
dUnit = 8.reciprocal;
|
|
|
|
totalLen = (totalDur / dUnit).round(16);
|
|
|
|
totalLen = (totalDur / dUnit).round(16);
|
|
|
|
curLen = 0;
|
|
|
|
curLen = 0;
|
|
|
@ -387,8 +406,10 @@ genAccompPart = {arg modeState, temporalData, offset, trans, part;
|
|
|
|
temporalState = initTemporalState.value;
|
|
|
|
temporalState = initTemporalState.value;
|
|
|
|
partStates = initPartStates.value;
|
|
|
|
partStates = initPartStates.value;
|
|
|
|
lastCadenceState = modeState.deepCopy;
|
|
|
|
lastCadenceState = modeState.deepCopy;
|
|
|
|
|
|
|
|
lastCadencePoint = 0;
|
|
|
|
|
|
|
|
|
|
|
|
ensData = 4.collect({[]});
|
|
|
|
ensData = 4.collect({[]});
|
|
|
|
|
|
|
|
bassData = 3.collect({[]});
|
|
|
|
accompData = 4.collect({6.collect({[]})});
|
|
|
|
accompData = 4.collect({6.collect({[]})});
|
|
|
|
sectionData = Dictionary.new; //Dictionary.with(*[0->4]);
|
|
|
|
sectionData = Dictionary.new; //Dictionary.with(*[0->4]);
|
|
|
|
sectionNavDict = Dictionary.new; //Dictionary.with(*[[[1], [1]]->1]);
|
|
|
|
sectionNavDict = Dictionary.new; //Dictionary.with(*[[[1], [1]]->1]);
|
|
|
@ -405,6 +426,7 @@ genAccompPart = {arg modeState, temporalData, offset, trans, part;
|
|
|
|
|
|
|
|
|
|
|
|
lastRoots = if(curLen == 0, {4.collect({[[1], [1]]})}, {roots.slice(nil, 0)});
|
|
|
|
lastRoots = if(curLen == 0, {4.collect({[[1], [1]]})}, {roots.slice(nil, 0)});
|
|
|
|
roots = distributeRoots.value(modeState, lastRoots);
|
|
|
|
roots = distributeRoots.value(modeState, lastRoots);
|
|
|
|
|
|
|
|
roots.size.postln;
|
|
|
|
|
|
|
|
|
|
|
|
sectionData.add((curLen / 4).asInteger->[roots, lastRoots.collect({arg fr, part;
|
|
|
|
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]);
|
|
|
|
[fr, 36.midicps * pow(2, [1, 0, 1, 2][part]) * frToFloat.value(fr)]}), sectionCount, subsectionCount]);
|
|
|
@ -416,9 +438,13 @@ genAccompPart = {arg modeState, temporalData, offset, trans, part;
|
|
|
|
ensData[part] = ensData[part] ++ musicData;
|
|
|
|
ensData[part] = ensData[part] ++ musicData;
|
|
|
|
partStates[part] = partState;
|
|
|
|
partStates[part] = partState;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if(collectRoots.value(modeState).size == 1, {
|
|
|
|
|
|
|
|
// if(part != 0, {bassData[part - 1] = bassData[part - 1] ++ genBassPart.value(roots[2][0], curLen)});
|
|
|
|
|
|
|
|
//});
|
|
|
|
|
|
|
|
|
|
|
|
thisThread.randSeed = Date.seed;
|
|
|
|
thisThread.randSeed = Date.seed;
|
|
|
|
6.do({arg register;
|
|
|
|
6.do({arg register;
|
|
|
|
musicData = genAccompPart.value(modeState, temporalData[part], curLen, pow(2, part + register), part);
|
|
|
|
musicData = genAccompPart.value(modeState, temporalData[part], curLen, pow(2, part + register), part, register);
|
|
|
|
accompData[part][register] = accompData[part][register] ++ musicData;
|
|
|
|
accompData[part][register] = accompData[part][register] ++ musicData;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -426,17 +452,27 @@ genAccompPart = {arg modeState, temporalData, offset, trans, part;
|
|
|
|
|
|
|
|
|
|
|
|
subsectionCount = subsectionCount + 1;
|
|
|
|
subsectionCount = subsectionCount + 1;
|
|
|
|
thisThread.randSeed = (seed + (sectionCount * 100) + subsectionCount);
|
|
|
|
thisThread.randSeed = (seed + (sectionCount * 100) + subsectionCount);
|
|
|
|
modeState = advanceMode.value(modeState, lastCadenceState);
|
|
|
|
|
|
|
|
if(collectRoots.value(modeState).size == 1, {
|
|
|
|
if(collectRoots.value(modeState).size == 1, {
|
|
|
|
sectionCount = sectionCount + 1;
|
|
|
|
sectionCount = sectionCount + 1;
|
|
|
|
subsectionCount = 1;
|
|
|
|
subsectionCount = 1;
|
|
|
|
lastCadenceState = modeState;
|
|
|
|
lastCadenceState = modeState;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(curLen > 0, {
|
|
|
|
|
|
|
|
bassData[0] = bassData[0] ++ genBassPart.value(roots[0][0].postln, lastCadencePoint.postln, curLen);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//bassData[0] = bassData[0] ++ genBassPart.value(roots[0][0].postln, curLen);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lastCadencePoint = curLen + temporalData[0].size;
|
|
|
|
|
|
|
|
lastCadencePoint.postln;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
modeState = advanceMode.value(modeState, lastCadenceState);
|
|
|
|
curLen = curLen + temporalData[0].size;
|
|
|
|
curLen = curLen + temporalData[0].size;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
[ensData, accompData, sectionData, sectionNavDict]
|
|
|
|
[ensData, accompData, sectionData, bassData.postln, sectionNavDict]
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
//~genMusicData.value(100)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|