all amp curves working
This commit is contained in:
parent
4aa329c755
commit
1ab4385e69
|
|
@ -115,16 +115,16 @@ buildTransport = {arg win, view, clock, metronome;
|
||||||
|
|
||||||
~patterns[2].collect({arg pattern, p;
|
~patterns[2].collect({arg pattern, p;
|
||||||
Pmono(\amp_curve_ ++ ~hash,
|
Pmono(\amp_curve_ ++ ~hash,
|
||||||
\amp, Pseg(Pseq(pattern.slice(nil, 0), 1, (~sectionNavDict[[currentSection, currentSubsection]] - 1) * 4), 4 * ~dUnit),
|
\amp, Pseg(Pseq(pattern.slice(nil, 0), 1, (~sectionNavDict[[currentSection, currentSubsection]] - 1) * 16), 1 * ~dUnit, \cub),
|
||||||
\dur, 4 * ~dUnit,
|
\dur, 1 * ~dUnit,
|
||||||
\bus, ~preampBusses[p].index
|
\bus, ~preampBusses[p].index
|
||||||
)
|
)
|
||||||
}) ++
|
}) ++
|
||||||
|
|
||||||
~patterns[1].collect({arg pattern, p;
|
~patterns[1].collect({arg pattern, p;
|
||||||
Pmono(\bass_mono_ ++ ~hash,
|
Pmono(\bass_mono_ ++ ~hash,
|
||||||
\freq, Pseq(pattern.slice(nil, 0), 1, (~sectionNavDict[[currentSection, currentSubsection]] - 1) * 4),
|
\freq, Pseq(pattern.slice(nil, 0), 1, (~sectionNavDict[[currentSection, currentSubsection]] - 1) * 16),
|
||||||
\dur, 4 * ~dUnit,
|
\dur, 1 * ~dUnit,
|
||||||
\ampBus, ~preampBusses[p + 1].index,
|
\ampBus, ~preampBusses[p + 1].index,
|
||||||
\bus, ~postampBusses[4].index
|
\bus, ~postampBusses[4].index
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ appEnvironment.push;
|
||||||
s.waitForBoot({
|
s.waitForBoot({
|
||||||
|
|
||||||
~hash = Date.getDate.hash.asString;
|
~hash = Date.getDate.hash.asString;
|
||||||
|
~cRes = 1;
|
||||||
|
|
||||||
// load all files
|
// load all files
|
||||||
"tkam_musical_data_generator.scd".loadRelative;
|
"tkam_musical_data_generator.scd".loadRelative;
|
||||||
|
|
@ -22,10 +23,8 @@ s.waitForBoot({
|
||||||
~musicData = ~genMusicData.value(seed);
|
~musicData = ~genMusicData.value(seed);
|
||||||
~scoreData = ~genScoreData.value(~musicData[0]);
|
~scoreData = ~genScoreData.value(~musicData[0]);
|
||||||
~sectionData = ~musicData[4];
|
~sectionData = ~musicData[4];
|
||||||
"sdasfsdfsdaf".postln;
|
|
||||||
~patterns = ~genPatterns.value(~musicData[0], ~musicData[1], ~musicData[2], ~musicData[3], ~sectionData);
|
~patterns = ~genPatterns.value(~musicData[0], ~musicData[1], ~musicData[2], ~musicData[3], ~sectionData);
|
||||||
"sdasfsdfsdaf".postln;
|
~sectionNavDict = ~musicData[5];
|
||||||
~sectionNavDict = ~musicData[5].postln;
|
|
||||||
~isPlaying = false;
|
~isPlaying = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -36,7 +35,7 @@ s.waitForBoot({
|
||||||
"loading app".postln;
|
"loading app".postln;
|
||||||
~genAll.value(19800725);
|
~genAll.value(19800725);
|
||||||
~play = Synth.new(\masterPlayerControl_ ++ ~hash);
|
~play = Synth.new(\masterPlayerControl_ ++ ~hash);
|
||||||
4.collect({arg p; Synth.new(\clip_ ++ ~hash, [\bin, p + 6, \bus, ~postampBusses[5].index])});
|
4.collect({arg p; Synth.new(\clip_ ++ ~hash, [\bin, ~accompBusses[p].index, \bus, ~postampBusses[5].index])});
|
||||||
~generateGUI.value;
|
~generateGUI.value;
|
||||||
"ready".postln;
|
"ready".postln;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -363,13 +363,6 @@ genAccompPart = {arg modeState, temporalData, offset, trans, part, register;
|
||||||
freq = 48.midicps * trans * frToFloat.value(sel);
|
freq = 48.midicps * trans * frToFloat.value(sel);
|
||||||
amp = [0, 1, 2, 3].wchoose([2, 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;
|
||||||
});
|
});
|
||||||
|
|
@ -377,57 +370,18 @@ genAccompPart = {arg modeState, temporalData, offset, trans, part, register;
|
||||||
accompData
|
accompData
|
||||||
};
|
};
|
||||||
|
|
||||||
//~~~~~~~~~~~~GENERATE ELECTRONIC BASS~~~~~~~~~~~~
|
|
||||||
genBassPart = {arg root, temporalData1, temporalData2, offset1, offset2, hi;
|
|
||||||
"here".postln;
|
|
||||||
[
|
|
||||||
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[0].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 ELECTRONIC BASS~~~~~~~~~~~~
|
//~~~~~~~~~~~~GENERATE ELECTRONIC BASS~~~~~~~~~~~~
|
||||||
genBassPart = {arg root, ampCurve, hi;
|
genBassPart = {arg root, ampCurve, hi;
|
||||||
var freq;
|
var freq;
|
||||||
freq = if(hi,
|
freq = if(hi,
|
||||||
{36.midicps * frToFloat.value(frCollapse.value(frAdd.value(root, [[3], [2]])))},
|
{36.midicps * frToFloat.value(frCollapse.value(frAdd.value(root, [[3], [2]])))},
|
||||||
{36.midicps * frToFloat.value(root)});
|
{36.midicps * frToFloat.value(root)});
|
||||||
|
|
||||||
//freq.postln;
|
|
||||||
ampCurve.collect({arg sec, iter; [freq, sec[1]]})
|
ampCurve.collect({arg sec, iter; [freq, sec[1]]})
|
||||||
};
|
};
|
||||||
|
|
||||||
//~~~~~~~~~~~~GENERATE AMP CURVES~~~~~~~~~~~~
|
//~~~~~~~~~~~~GENERATE AMP CURVES~~~~~~~~~~~~
|
||||||
genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
|
genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
|
||||||
var firsts1, firsts2, delay, attack, decay, release, min, env;
|
var firsts1, firsts2, delay, attack, decay, release, min, max, env;
|
||||||
firsts1 = temporalData1.collect({arg ptd; ptd.indexOf(1)});
|
firsts1 = temporalData1.collect({arg ptd; ptd.indexOf(1)});
|
||||||
firsts2 = temporalData2.collect({arg ptd; ptd.indexOf(1)});
|
firsts2 = temporalData2.collect({arg ptd; ptd.indexOf(1)});
|
||||||
delay = switch(type)
|
delay = switch(type)
|
||||||
|
|
@ -444,57 +398,48 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
|
||||||
{2} {temporalData1[0].size - firsts1.maxItem};
|
{2} {temporalData1[0].size - firsts1.maxItem};
|
||||||
release = switch(type)
|
release = switch(type)
|
||||||
{0} {0}
|
{0} {0}
|
||||||
{1} {temporalData2[0].size.postln - firsts2.maxItem}
|
{1} {temporalData2[0].size - firsts2.maxItem}
|
||||||
{2} {(offset2 - temporalData2[0].size) - offset1} ;
|
{2} {(offset2 - temporalData2[0].size) - offset1} ;
|
||||||
min = switch(type)
|
min = switch(type)
|
||||||
{0} {0.25}
|
{0} {0.25}
|
||||||
{1} {0}
|
{1} {0}
|
||||||
{2} {0} ;
|
{2} {0} ;
|
||||||
|
max = switch(type)
|
||||||
|
{0} {0.5}
|
||||||
|
{1} {0.75}
|
||||||
|
{2} {1} ;
|
||||||
|
|
||||||
env = Env.dadsr(delay, attack, decay, 0.25, release, curve: \cub).range(min);
|
env = Env.dadsr(delay, attack, decay, 0.25, release, curve: \cub).range(min, max);
|
||||||
|
|
||||||
((delay.postln + attack.postln + decay.postln + release.postln).postln / 4).asInteger.collect({arg iter; [env.at(iter * 4), offset1 + (iter * 4)]})
|
((delay + attack + decay + release) / 1).asInteger.collect({arg iter; [env.at(iter * 1), offset1 + (iter * 1)]})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//~~~~~~~~~~~~GENERATE ALL MUSIC DATA~~~~~~~~~~~~
|
//~~~~~~~~~~~~GENERATE ALL MUSIC DATA~~~~~~~~~~~~
|
||||||
~genMusicData = {arg seed;
|
~genMusicData = {arg seed;
|
||||||
var totalDur, section1Dur, dUnit, totalLen, section1Len, curLen, cadence,
|
var totalDur, section1Dur, dUnit, curLen, cadence,
|
||||||
modeState, temporalState, partStates, lastCadenceTemporalData, lastCadenceState, lastSectionPoint,
|
totalLen, section1Len,
|
||||||
ensData, accompData, bassData, ampData, sectionData,
|
modeState, temporalState, partStates,
|
||||||
roots, lastRoots, sectionCount, subsectionCount, sectionNavDict;
|
lastCadenceTemporalData, lastCadenceState, lastSectionPoint,
|
||||||
|
ensData, accompData, bassData, ampData,
|
||||||
|
sectionData, sectionNavDict,
|
||||||
|
sectionCount, subsectionCount,
|
||||||
|
lastRoots, roots;
|
||||||
|
|
||||||
thisThread.randSeed = seed;
|
thisThread.randSeed = seed;
|
||||||
|
|
||||||
|
# totalDur, section1Dur, dUnit, curLen, cadence = [6 * 60, 2 * 60, 8.reciprocal, 0, false];
|
||||||
|
# totalLen, section1Len = [(totalDur / dUnit).round(16), (section1Dur / dUnit).round(16)];
|
||||||
|
# modeState, temporalState, partStates = [initModeState.value, initTemporalState.value, initPartStates.value];
|
||||||
|
# lastCadenceTemporalData, lastCadenceState, lastSectionPoint = [nil, modeState.deepCopy, 0];
|
||||||
|
# ensData, accompData, bassData, ampData = [4.collect({[]}), 4.collect({6.collect({[]})}), 2.collect({[]}), 3.collect({[]})];
|
||||||
|
# sectionData, sectionNavDict = [Dictionary.new, Dictionary.new];
|
||||||
|
# sectionCount, subsectionCount = [1, 1];
|
||||||
|
|
||||||
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;
|
|
||||||
lastSectionPoint = 0;
|
|
||||||
|
|
||||||
ensData = 4.collect({[]});
|
|
||||||
bassData = 2.collect({[]});
|
|
||||||
accompData = 4.collect({6.collect({[]})});
|
|
||||||
ampData = 3.collect({[]});
|
|
||||||
sectionData = Dictionary.new; //Dictionary.with(*[0->4]);
|
|
||||||
sectionNavDict = Dictionary.new; //Dictionary.with(*[[[1], [1]]->1]);
|
|
||||||
|
|
||||||
sectionCount = 1;
|
|
||||||
subsectionCount = 1;
|
|
||||||
while({(curLen < totalLen) || ((curLen >= totalLen) && cadence.not)}, {
|
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 <= section1Len);
|
||||||
|
|
||||||
collectRoots.value(modeState).collect({arg fr; [fr[0].asFloat.product, fr[1].asFloat.product]}).postln;
|
collectRoots.value(modeState).collect({arg fr; [fr[0].asFloat.product, fr[1].asFloat.product]}).postln;
|
||||||
//modeState.keys.postln;
|
//modeState.keys.postln;
|
||||||
|
|
@ -502,7 +447,6 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
|
||||||
|
|
||||||
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]);
|
||||||
|
|
@ -535,8 +479,6 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
|
||||||
if(curLen > section1Len, {
|
if(curLen > section1Len, {
|
||||||
if(collectRoots.value(modeState).size == 1, {
|
if(collectRoots.value(modeState).size == 1, {
|
||||||
var ampDataTmp;
|
var ampDataTmp;
|
||||||
"asdfasfdsf".postln;
|
|
||||||
//sectionCount.postln;
|
|
||||||
|
|
||||||
ampData[0] = ampData[0] ++ genAmpCurve.value(lastCadenceTemporalData, temporalData, lastSectionPoint, curLen, 0);
|
ampData[0] = ampData[0] ++ genAmpCurve.value(lastCadenceTemporalData, temporalData, lastSectionPoint, curLen, 0);
|
||||||
ampDataTmp = genAmpCurve.value(lastCadenceTemporalData, temporalData, lastSectionPoint, curLen, 1);
|
ampDataTmp = genAmpCurve.value(lastCadenceTemporalData, temporalData, lastSectionPoint, curLen, 1);
|
||||||
|
|
@ -544,23 +486,21 @@ genAmpCurve = {arg temporalData1, temporalData2, offset1, offset2, type;
|
||||||
bassData[0] = bassData[0] ++ genBassPart.value(collectRoots.value(modeState).asList[0], ampDataTmp, true);
|
bassData[0] = bassData[0] ++ genBassPart.value(collectRoots.value(modeState).asList[0], ampDataTmp, true);
|
||||||
|
|
||||||
if(sectionCount == 1, {
|
if(sectionCount == 1, {
|
||||||
ampData[2] = ampData[2] ++ ((curLen - temporalData[0].size) / 4).asInteger.collect({arg iter; [0, iter * 4]});
|
ampData[2] = ampData[2] ++ ((curLen - temporalData[0].size) / 1).asInteger.collect({arg iter; [0, iter * 1]});
|
||||||
bassData[1] = bassData[1] ++ ((curLen - temporalData[0].size) / 4).asInteger.collect({arg iter; [0, iter * 4]})
|
bassData[1] = bassData[1] ++ ((curLen - temporalData[0].size) / 1).asInteger.collect({arg iter; [0, iter * 1]})
|
||||||
}, {
|
}, {
|
||||||
ampDataTmp = genAmpCurve.value(lastCadenceTemporalData, temporalData, lastSectionPoint, curLen, 2);
|
ampDataTmp = genAmpCurve.value(lastCadenceTemporalData, temporalData, lastSectionPoint, curLen, 2);
|
||||||
ampData[2] = ampData[2] ++ ampDataTmp;
|
ampData[2] = ampData[2] ++ ampDataTmp;
|
||||||
bassData[1] = bassData[1] ++ genBassPart.value(collectRoots.value(lastCadenceState).asList[0], ampDataTmp, false);
|
bassData[1] = bassData[1] ++ genBassPart.value(collectRoots.value(lastCadenceState).asList[0], ampDataTmp, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
# sectionCount, subsectionCount = [sectionCount + 1, 1];
|
||||||
sectionCount = sectionCount + 1;
|
# lastCadenceTemporalData, lastCadenceState, lastSectionPoint = [temporalData, modeState, curLen];
|
||||||
subsectionCount = 1;
|
|
||||||
lastCadenceState = modeState;
|
|
||||||
lastCadenceTemporalData = temporalData;
|
|
||||||
lastSectionPoint = curLen;
|
|
||||||
cadence = true;
|
cadence = true;
|
||||||
|
}, {
|
||||||
|
cadence = false
|
||||||
|
|
||||||
}, {cadence = false});
|
});
|
||||||
modeState = advanceMode.value(modeState, lastCadenceState);
|
modeState = advanceMode.value(modeState, lastCadenceState);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,10 @@
|
||||||
var formatPatternData;
|
var formatPatternData;
|
||||||
|
|
||||||
//busses
|
//busses
|
||||||
~partStarBus = Bus.audio(s, 1);
|
|
||||||
~partIBus = Bus.audio(s, 1);
|
|
||||||
~partIIBus = Bus.audio(s, 1);
|
|
||||||
~partIIIBus = Bus.audio(s, 1);
|
|
||||||
~accompBus = Bus.audio(s, 1);
|
|
||||||
~clickBus = Bus.audio(s, 1);
|
|
||||||
|
|
||||||
~postampBusses = 7.collect({Bus.audio(s, 1)});
|
~postampBusses = 7.collect({Bus.audio(s, 1)});
|
||||||
~preampBusses = 7.collect({Bus.audio(s, 1)});
|
~preampBusses = 3.collect({Bus.audio(s, 1)});
|
||||||
|
~accompBusses = 4.collect({Bus.audio(s, 1)});
|
||||||
|
|
||||||
SynthDef(\masterPlayerControl_ ++ ~hash, {
|
SynthDef(\masterPlayerControl_ ++ ~hash, {
|
||||||
var sigs, sigsPanned, masterSig, imp;
|
var sigs, sigsPanned, masterSig, imp;
|
||||||
|
|
@ -59,12 +54,9 @@ SynthDef(\clip_ ++ ~hash, {arg dur = 1, gate = 1, bin = 0, bus = 0;
|
||||||
Out.ar(bus, (In.ar(bin)).clip(0, 1) * 50 * pow(Line.kr(0, 1, 10), 2))
|
Out.ar(bus, (In.ar(bin)).clip(0, 1) * 50 * pow(Line.kr(0, 1, 10), 2))
|
||||||
}).add;
|
}).add;
|
||||||
|
|
||||||
SynthDef(\bass_ ++ ~hash, {arg freq = 440, amp = 1, dur = 1, attack = 1, decay = 1, release = 1, gate = 1, direction = 1, bus = 0;
|
|
||||||
Out.ar(bus, (SinOsc.ar(freq) * 0.3 * amp * EnvGen.kr(Env.adsr(attack, decay, 0.5, release, curve: \sqr), gate, doneAction: 2)))
|
|
||||||
}).add;
|
|
||||||
|
|
||||||
SynthDef(\bass_mono_ ++ ~hash, {arg freq = 440, ampBus = 0, bus = 0;
|
SynthDef(\bass_mono_ ++ ~hash, {arg freq = 440, ampBus = 0, bus = 0;
|
||||||
Out.ar(bus, (SinOsc.ar(freq.poll) * 0.4 * In.kr(ampBus)))
|
Poll.kr(Changed.kr(In.kr(ampBus)), In.kr(ampBus));
|
||||||
|
Out.ar(bus, (SinOsc.ar(freq) * 0.4 * In.kr(ampBus)))
|
||||||
}).add;
|
}).add;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -91,7 +83,6 @@ formatPatternData = {arg musData, measureLen;
|
||||||
var measureLen, ensDataFormatted, accompDataFormatted, bassDataFormatted, ampDataFormatted,
|
var measureLen, ensDataFormatted, accompDataFormatted, bassDataFormatted, ampDataFormatted,
|
||||||
dUnit, section, subsection, patterns;
|
dUnit, section, subsection, patterns;
|
||||||
|
|
||||||
"here5".postln;
|
|
||||||
measureLen = ((
|
measureLen = ((
|
||||||
ensData.collect({arg partData; partData.last[1]}) ++
|
ensData.collect({arg partData; partData.last[1]}) ++
|
||||||
accompData.flatten.collect({arg partData; partData.last[1]})
|
accompData.flatten.collect({arg partData; partData.last[1]})
|
||||||
|
|
@ -100,8 +91,7 @@ formatPatternData = {arg musData, measureLen;
|
||||||
ensDataFormatted = formatPatternData.value(ensData, measureLen);
|
ensDataFormatted = formatPatternData.value(ensData, measureLen);
|
||||||
accompDataFormatted = formatPatternData.value(accompData.flatten, measureLen);
|
accompDataFormatted = formatPatternData.value(accompData.flatten, measureLen);
|
||||||
//bassDataFormatted = formatPatternData.value(bassData[..0], measureLen);
|
//bassDataFormatted = formatPatternData.value(bassData[..0], measureLen);
|
||||||
//ampDataFormatted = formatPatternData.value([ampData, ampData, ampData, ampData].postln, measureLen);
|
//ampDataFormatted = formatPatternData.value([ampData, ampData, ampData, ampData], measureLen);
|
||||||
"here6".postln;
|
|
||||||
dUnit = 8.reciprocal;
|
dUnit = 8.reciprocal;
|
||||||
|
|
||||||
patterns = measureLen.collect({arg measure;
|
patterns = measureLen.collect({arg measure;
|
||||||
|
|
@ -124,7 +114,6 @@ formatPatternData = {arg musData, measureLen;
|
||||||
)
|
)
|
||||||
}) ++
|
}) ++
|
||||||
accompDataFormatted[measure].collect({arg musData, m;
|
accompDataFormatted[measure].collect({arg musData, m;
|
||||||
//"--------".postln;
|
|
||||||
Pbind(
|
Pbind(
|
||||||
\instrument, \accomp_ ++ ~hash,
|
\instrument, \accomp_ ++ ~hash,
|
||||||
\freq, Pseq(musData[0].replace(0, Rest(0))),
|
\freq, Pseq(musData[0].replace(0, Rest(0))),
|
||||||
|
|
@ -134,35 +123,9 @@ formatPatternData = {arg musData, measureLen;
|
||||||
//\attack, Pseq(musData[1] * abs(musData[3].clip(0, 0.25) * 2 - 1) * dUnit),
|
//\attack, Pseq(musData[1] * abs(musData[3].clip(0, 0.25) * 2 - 1) * dUnit),
|
||||||
\attack, Pseq(musData[2] * 1 * dUnit),
|
\attack, Pseq(musData[2] * 1 * dUnit),
|
||||||
\ampBus, ~preampBusses[0].index,
|
\ampBus, ~preampBusses[0].index,
|
||||||
\bout, Pseq(musData[4] + 6)
|
\bout, Pseq(musData[4].collect({arg index; ~accompBusses[index].index}))
|
||||||
)
|
)
|
||||||
}) ++
|
}) ++
|
||||||
/*
|
|
||||||
bassDataFormatted[measure][..0].postln.collect({arg musData, m;
|
|
||||||
Pbind(
|
|
||||||
\instrument, \bass_ ++ ~hash,
|
|
||||||
\freq, Pseq(musData[0].replace(0, Rest(0)) * [2, 4, 8][m]),
|
|
||||||
\dur, Pseq(musData[1] * dUnit),
|
|
||||||
\sustain, Pseq(musData[3] + musData[4] * dUnit),
|
|
||||||
\attack, Pseq(musData[3] * dUnit),
|
|
||||||
\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})}))
|
|
||||||
\bus, ~postampBusses[4].index
|
|
||||||
)
|
|
||||||
}) ++
|
|
||||||
ampDataFormatted[measure].collect({arg musData, m;
|
|
||||||
Pbind(
|
|
||||||
\instrument, \amp_curve_ ++ ~hash,
|
|
||||||
\amp, Pseq(musData[0]),
|
|
||||||
\dur, Pseq(musData[1].replace(0, Rest(0)) * dUnit),
|
|
||||||
\bus, ~preampBusses[m].index
|
|
||||||
)
|
|
||||||
}) ++
|
|
||||||
*/
|
|
||||||
|
|
||||||
[
|
[
|
||||||
Pbind(
|
Pbind(
|
||||||
\instrument, \transport_ ++ ~hash,
|
\instrument, \transport_ ++ ~hash,
|
||||||
|
|
@ -183,148 +146,4 @@ formatPatternData = {arg musData, measureLen;
|
||||||
[patterns, bassData, ampData]
|
[patterns, bassData, ampData]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//~~~~gen music
|
|
||||||
/*
|
|
||||||
~genPatterns = {arg partStarSeqIn, accompLowSeqIn, partISeqIn, sectionSeqIn, beatFrac = 1/8;
|
|
||||||
var calcSustains, genSectionSec, sectionLimits, measureCount;
|
|
||||||
|
|
||||||
//~~~~helper sus function
|
|
||||||
calcSustains = {arg stringSeq, durSeq;
|
|
||||||
var res = [];
|
|
||||||
stringSeq.size.do({arg index;
|
|
||||||
var curString, dur, count;
|
|
||||||
if(stringSeq[index].isRest.not, {
|
|
||||||
curString = stringSeq[index];
|
|
||||||
dur = durSeq[index];
|
|
||||||
count = 1;
|
|
||||||
while({(stringSeq[(index + count).clip(0, stringSeq.size - 1)] != curString) &&
|
|
||||||
(dur < 16) && (count < 100)}, {
|
|
||||||
dur = dur + durSeq[(index + count).clip(0, durSeq.size - 1)];
|
|
||||||
count = count + 1;
|
|
||||||
});
|
|
||||||
res = res.add(dur.clip(0, 16));
|
|
||||||
}, {
|
|
||||||
res.add(Rest());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
res
|
|
||||||
};
|
|
||||||
|
|
||||||
genSectionSec = {arg seq, startTime, endTime, type;
|
|
||||||
var durSum, resSeqs, inSecs, mult;
|
|
||||||
durSum = 0;
|
|
||||||
resSeqs = [];
|
|
||||||
seq.do({arg item;
|
|
||||||
if((durSum >= startTime) && (durSum < endTime), {
|
|
||||||
var dur = durSum - startTime;
|
|
||||||
if((resSeqs.size == 0) && (dur > 0), {
|
|
||||||
switch(type,
|
|
||||||
0, {resSeqs = resSeqs.add([Rest(-1), Rest(-1), dur])},
|
|
||||||
1, {resSeqs = resSeqs.add([Rest(-1), Rest(-1), dur])},
|
|
||||||
2, {resSeqs = resSeqs.add([Rest(-1), dur, dur])})
|
|
||||||
});
|
|
||||||
resSeqs = resSeqs.add(item);
|
|
||||||
});
|
|
||||||
durSum = durSum + if(type == 2, {item[1]}, {item[2]});
|
|
||||||
});
|
|
||||||
resSeqs
|
|
||||||
};
|
|
||||||
|
|
||||||
measureCount = 0;
|
|
||||||
sectionLimits = [];
|
|
||||||
sectionSeqIn.slice(nil, 0).add(100000).doAdjacentPairs({arg a, b; sectionLimits = sectionLimits.add([a, b])});
|
|
||||||
~sectionStartMeasure = [];
|
|
||||||
sectionLimits.collect({arg timePair, secIndex;
|
|
||||||
var startTime, endTime, beatLength, beatSeq, measureSeq,
|
|
||||||
partStarSecSeq, accompLowSecSeq, partISecSeq,
|
|
||||||
stringSeq, fretSeq, harmLimit, freqSeq, durSeq, susSeq, trigSeq, openStrings, pattern;
|
|
||||||
|
|
||||||
startTime = timePair[0];
|
|
||||||
endTime = timePair[1];
|
|
||||||
|
|
||||||
if((secIndex % 4) == 0, {measureCount = 0});
|
|
||||||
beatLength = (endTime - startTime) / 8;
|
|
||||||
beatSeq = ((beatLength / 2) - 1).asInteger.collect({[1, 2]});
|
|
||||||
beatSeq = if((beatLength % 2) == 0, {beatSeq.add([1, 2])}, {beatSeq.add([1, 2, 3])});
|
|
||||||
measureSeq = measureCount + beatSeq.collect({arg measure, mIndex; measure.collect({mIndex + 1})}).flat;
|
|
||||||
~sectionStartMeasure = ~sectionStartMeasure.add(measureCount + 1);
|
|
||||||
measureCount = measureSeq.last;
|
|
||||||
beatSeq = beatSeq.flat;
|
|
||||||
measureSeq = measureSeq.add(0);
|
|
||||||
beatSeq = beatSeq.add(0);
|
|
||||||
|
|
||||||
partStarSecSeq = genSectionSec.value(partStarSeqIn, startTime, endTime, 0);
|
|
||||||
accompLowSecSeq = genSectionSec.value(accompLowSeqIn, startTime, endTime, 1);
|
|
||||||
partISecSeq = genSectionSec.value(partISeqIn, startTime, endTime, 2);
|
|
||||||
|
|
||||||
if(partISecSeq == [], {partISecSeq = [[Rest(-1), 1, 0], [Rest(-1), 1, 0]]});
|
|
||||||
|
|
||||||
openStrings = [1/1, 3/2, 2/1, 5/2, 35/12, 7/2];
|
|
||||||
harmLimit = [9, 8, 7, 6, 5, 4];
|
|
||||||
stringSeq = partStarSecSeq.slice(nil, 0);
|
|
||||||
fretSeq = partStarSecSeq.slice(nil, 1);
|
|
||||||
durSeq = partStarSecSeq.slice(nil, 2);
|
|
||||||
susSeq = calcSustains.value(stringSeq, durSeq);
|
|
||||||
freqSeq = stringSeq.collect({arg string, index;
|
|
||||||
if(string.isRest, {Rest()}, {
|
|
||||||
var midi, freq;
|
|
||||||
//this is transposed up because karplus-strong does not really sound correctly in the partStar range
|
|
||||||
midi = (62.midicps * openStrings[string]).cpsmidi + fretSeq[index];
|
|
||||||
freq = midi.midicps * if((secIndex % 4) != 3, {1}, {[1, harmLimit[string].rand + 1].choose})})
|
|
||||||
});
|
|
||||||
|
|
||||||
pattern = EventPatternProxy.new;
|
|
||||||
pattern.source = Ppar([
|
|
||||||
Pbind(
|
|
||||||
\instrument, \karplus ++ ~hash,
|
|
||||||
\amp, 0.3,
|
|
||||||
\dur, Pseq(durSeq * beatFrac),
|
|
||||||
\sustain, Pseq(susSeq * beatFrac),
|
|
||||||
\freq, Pseq(freqSeq),
|
|
||||||
\bus, ~partStarBus.index),
|
|
||||||
if(accompLowSecSeq.size > 1, {
|
|
||||||
Pmono(
|
|
||||||
\accompBass ++ ~hash,
|
|
||||||
\amp, 0.5,
|
|
||||||
\freq1, Pseq(accompLowSecSeq.slice(nil, 0)),
|
|
||||||
\freq2, Pseq(accompLowSecSeq.slice(nil, 1)),
|
|
||||||
\dur, Pseq(accompLowSecSeq.slice(nil, 2)) * beatFrac,
|
|
||||||
\busLower, if(secIndex % 2 == 0, {~partIIBusA.index}, {~partIIBusB.index}),
|
|
||||||
\busUpper, if(secIndex % 2 == 0, {~partIIIBusA.index}, {~partIIIBusB.index}))
|
|
||||||
}, {
|
|
||||||
Pmono(
|
|
||||||
\accompBass ++ ~hash,
|
|
||||||
\amp, 0.5,
|
|
||||||
\freq1, Pseq([accompLowSecSeq[0][0]]),
|
|
||||||
\freq2, Pseq([accompLowSecSeq[0][1]]),
|
|
||||||
\dur, Pseq([accompLowSecSeq[0][2]]) * beatFrac,
|
|
||||||
\busLower, if(secIndex % 2 == 0, {~partIIBusA.index}, {~partIIBusB.index}),
|
|
||||||
\busUpper, if(secIndex % 2 == 0, {~partIIIBusA.index}, {~partIIIBusB.index}))
|
|
||||||
}),
|
|
||||||
Pbind(
|
|
||||||
\instrument, \accompTreble ++ ~hash,
|
|
||||||
//\freq, Pseq(partISecSeq.slice(nil, 0)),
|
|
||||||
\freq, Pseq(partISecSeq.slice(nil, 0).curdle(0.3).collect({arg item; item.cpsmidi - 0.16 + 0.32.rand}).midicps.flat),
|
|
||||||
\dur, Pseq(partISecSeq.slice(nil, 1) * beatFrac),
|
|
||||||
\sustain, Pseq(partISecSeq.slice(nil, 2) * beatFrac),
|
|
||||||
\amp, 0.5,
|
|
||||||
\bus, ~partIBus.index),
|
|
||||||
Pbind(
|
|
||||||
\instrument, \transport ++ ~hash,
|
|
||||||
\measure, Pseq(measureSeq),
|
|
||||||
\beat, Pseq(beatSeq),
|
|
||||||
\dur, beatFrac * 8
|
|
||||||
),
|
|
||||||
Pbind(
|
|
||||||
\instrument, \click ++ ~hash,
|
|
||||||
\beat, Pseq(beatSeq.drop(-1)),
|
|
||||||
\dur, beatFrac * 8
|
|
||||||
)
|
|
||||||
]);
|
|
||||||
pattern
|
|
||||||
});
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
@ -274,7 +274,7 @@ consolidateNotes = {arg lyStr, part;
|
||||||
pcRoot = ((tmpSectionData[0][partLookup][3].cpsmidi).round(1) % 12).asInteger;
|
pcRoot = ((tmpSectionData[0][partLookup][3].cpsmidi).round(1) % 12).asInteger;
|
||||||
quality = if(tmpSectionData[0][partLookup][1][2] == [[ 1, 5 ], [ 1, 2, 2 ]], {\major}, {\minor});
|
quality = if(tmpSectionData[0][partLookup][1][2] == [[ 1, 5 ], [ 1, 2, 2 ]], {\major}, {\minor});
|
||||||
spellingPref = spellingDict[quality][pcRoot];
|
spellingPref = spellingDict[quality][pcRoot];
|
||||||
if(p == 0, {[(i / 4).asInteger, partLookup, pcRoot, quality].postln});
|
if(p == 0, {[(i / 4).asInteger, partLookup, pcRoot, quality]});
|
||||||
});
|
});
|
||||||
|
|
||||||
lyStr = lyStr + lyNote.value(freq, noteLength, freqRatioMult, ref, spellingPref, isSame.not && isRest.not);
|
lyStr = lyStr + lyNote.value(freq, noteLength, freqRatioMult, ref, spellingPref, isSame.not && isRest.not);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue