|
|
|
@ -2,15 +2,10 @@
|
|
|
|
|
var formatPatternData;
|
|
|
|
|
|
|
|
|
|
//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)});
|
|
|
|
|
~preampBusses = 7.collect({Bus.audio(s, 1)});
|
|
|
|
|
~preampBusses = 3.collect({Bus.audio(s, 1)});
|
|
|
|
|
~accompBusses = 4.collect({Bus.audio(s, 1)});
|
|
|
|
|
|
|
|
|
|
SynthDef(\masterPlayerControl_ ++ ~hash, {
|
|
|
|
|
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))
|
|
|
|
|
}).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;
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -91,7 +83,6 @@ formatPatternData = {arg musData, measureLen;
|
|
|
|
|
var measureLen, ensDataFormatted, accompDataFormatted, bassDataFormatted, ampDataFormatted,
|
|
|
|
|
dUnit, section, subsection, patterns;
|
|
|
|
|
|
|
|
|
|
"here5".postln;
|
|
|
|
|
measureLen = ((
|
|
|
|
|
ensData.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);
|
|
|
|
|
accompDataFormatted = formatPatternData.value(accompData.flatten, measureLen);
|
|
|
|
|
//bassDataFormatted = formatPatternData.value(bassData[..0], measureLen);
|
|
|
|
|
//ampDataFormatted = formatPatternData.value([ampData, ampData, ampData, ampData].postln, measureLen);
|
|
|
|
|
"here6".postln;
|
|
|
|
|
//ampDataFormatted = formatPatternData.value([ampData, ampData, ampData, ampData], measureLen);
|
|
|
|
|
dUnit = 8.reciprocal;
|
|
|
|
|
|
|
|
|
|
patterns = measureLen.collect({arg measure;
|
|
|
|
@ -124,7 +114,6 @@ formatPatternData = {arg musData, measureLen;
|
|
|
|
|
)
|
|
|
|
|
}) ++
|
|
|
|
|
accompDataFormatted[measure].collect({arg musData, m;
|
|
|
|
|
//"--------".postln;
|
|
|
|
|
Pbind(
|
|
|
|
|
\instrument, \accomp_ ++ ~hash,
|
|
|
|
|
\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[2] * 1 * dUnit),
|
|
|
|
|
\ampBus, ~preampBusses[0].index,
|
|
|
|
|
\bout, Pseq(musData[4] + 6)
|
|
|
|
|
)
|
|
|
|
|
}) ++
|
|
|
|
|
/*
|
|
|
|
|
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
|
|
|
|
|
\bout, Pseq(musData[4].collect({arg index; ~accompBusses[index].index}))
|
|
|
|
|
)
|
|
|
|
|
}) ++
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
[
|
|
|
|
|
Pbind(
|
|
|
|
|
\instrument, \transport_ ++ ~hash,
|
|
|
|
@ -183,148 +146,4 @@ formatPatternData = {arg musData, measureLen;
|
|
|
|
|
[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
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
)
|