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~~~~~~~~~~~~ //~~~~~~~~~~~~GENERATE ELECTRONIC BASS~~~~~~~~~~~~
genBassPart = {arg root, offset1, offset2; genBassPart = {arg root, temporalData1, temporalData2, offset1, offset2, hi;
var bassData; "here".postln;
[ [
[24.midicps * frToFloat.value(frCollapse.value(frAdd.value(root, [[3], [2]]))), offset1, (offset2 + 32) - (offset1), 10, 5, 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], //[24.midicps * frToFloat.value(root) * 3/2, offset2 + 16, 1],
[24.midicps * frToFloat.value(root), offset2 + 32, 5, 10, 30, 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~~~~~~~~~~~~ //~~~~~~~~~~~~GENERATE ALL MUSIC DATA~~~~~~~~~~~~
~genMusicData = {arg seed; ~genMusicData = {arg seed;
var totalDur, dUnit, totalLen, curLen, var totalDur, section1Dur, dUnit, totalLen, section1Len, curLen, cadence,
modeState, temporalState, partStates, lastCadenceState, lastCadencePoint, modeState, temporalState, partStates, lastCadenceTemporalData, lastCadenceState, lastCadencePoint,
ensData, accompData, bassData, sectionData, ensData, accompData, bassData, sectionData,
roots, lastRoots, sectionCount, subsectionCount, sectionNavDict; roots, lastRoots, sectionCount, subsectionCount, sectionNavDict;
thisThread.randSeed = seed; thisThread.randSeed = seed;
totalDur = 6 * 60; totalDur = 6 * 60;
section1Dur = 2 * 60;
dUnit = 8.reciprocal; dUnit = 8.reciprocal;
totalLen = (totalDur / dUnit).round(16); totalLen = (totalDur / dUnit).round(16);
section1Len = (section1Dur / dUnit).round(16);
curLen = 0; curLen = 0;
cadence = false;
modeState = initModeState.value; modeState = initModeState.value;
temporalState = initTemporalState.value; temporalState = initTemporalState.value;
partStates = initPartStates.value; partStates = initPartStates.value;
lastCadenceTemporalData = nil;
lastCadenceState = modeState.deepCopy; lastCadenceState = modeState.deepCopy;
lastCadencePoint = 0; lastCadencePoint = 0;
@ -416,7 +449,7 @@ genBassPart = {arg root, offset1, offset2;
sectionCount = 1; sectionCount = 1;
subsectionCount = 1; subsectionCount = 1;
while({curLen < totalLen}, { while({(curLen < totalLen) || ((curLen >= totalLen) && cadence.not)}, {
var temporalData; var temporalData;
# temporalData, temporalState = genTemporalData.value(temporalState, modeState, curLen == 0); # 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)}); 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; //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]);
@ -453,25 +486,50 @@ genBassPart = {arg root, offset1, offset2;
subsectionCount = subsectionCount + 1; subsectionCount = subsectionCount + 1;
thisThread.randSeed = (seed + (sectionCount * 100) + subsectionCount); thisThread.randSeed = (seed + (sectionCount * 100) + subsectionCount);
if(curLen > section1Len, {
if(collectRoots.value(modeState).size == 1, { if(collectRoots.value(modeState).size == 1, {
sectionCount = sectionCount + 1;
subsectionCount = 1;
lastCadenceState = modeState;
if(curLen > 0, { "asdfasfdsf".postln;
bassData[0] = bassData[0] ++ genBassPart.value(roots[0][0].postln, lastCadencePoint.postln, curLen);
if(sectionCount > 1, {
bassData[0] = bassData[0] ++
genBassPart.value(collectRoots.value(lastCadenceState).asList[0],
lastCadenceTemporalData, temporalData, lastCadencePoint, curLen, false);
});
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); //bassData[0] = bassData[0] ++ genBassPart.value(roots[0][0].postln, curLen);
lastCadencePoint = curLen + temporalData[0].size; //lastCadenceState = modeState;
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); modeState = advanceMode.value(modeState, lastCadenceState);
});
if(curLen == 0, {
lastCadenceTemporalData = temporalData[0];
lastCadencePoint = curLen;
});
curLen = curLen + temporalData[0].size; curLen = curLen + temporalData[0].size;
}); });
[ensData, accompData, sectionData, bassData.postln, sectionNavDict] [ensData, accompData, sectionData, bassData, sectionNavDict]
}; };
//~genMusicData.value(100) //~genMusicData.value(100)
) )

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

Loading…
Cancel
Save