getting bass part working

main
mwinter 4 years ago
parent c25347be55
commit 490d389212

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -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)
)

@ -127,10 +127,10 @@ formatPatternData = {arg musData, measureLen;
\instrument, \bass_ ++ ~hash,
\freq, Pseq(musData[0].replace(0, Rest(0)) * [2, 4, 8][m]),
\dur, Pseq(musData[1] * dUnit),
\sustain, Pseq(musData[2] * dUnit),
\sustain, Pseq(musData[3] + musData[4] * dUnit),
\attack, Pseq(musData[3] * dUnit),
\decay, Pseq(musData[4]),
\release, Pseq(musData[5]),
\decay, Pseq(musData[4] * dUnit),
\release, Pseq(musData[5] * dUnit),
\amp, 1,
//\amp, Pseq(musData[2].collect({arg item; [0, 0.25, 0.5, 0.75][item]}) * [1, 0.5, 0.25, 0.1][m] * 16);
// * musData[3].collect({arg val; if(val < 0.25, {0}, {0.5})}))

Loading…
Cancel
Save