|
|
|
@ -46,12 +46,12 @@ var formatPatternData;
|
|
|
|
|
Out.kr(bus, amp.lag)
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
sdEns = SynthDef(\ens_ ++ ~hash, {arg freq = 440, amp = 1, dur = 1, gate = 1, bus = 0, ampBus = 0;
|
|
|
|
|
Out.ar(bus, SinOsc.ar(freq, 2pi.rand, 0.1) * amp * Latch.kr(In.kr(ampBus), Impulse.kr(0)) * EnvGen.kr(Env.asr(0.1, 1, 0.1), gate, doneAction: 2))
|
|
|
|
|
sdEns = SynthDef(\ens_ ++ ~hash, {arg freq = 440, amp = 1, dur = 1, gate = 1, bus = 0, ampBus = 0, rel = 0.1;
|
|
|
|
|
Out.ar(bus, SinOsc.ar(freq, 2pi.rand, 0.1) * amp * Latch.kr(In.kr(ampBus), Impulse.kr(0)) * EnvGen.kr(Env.asr(0.1, 1, rel), gate, doneAction: 2))
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
sdAccomp = SynthDef(\accomp_ ++ ~hash, {arg freq = 440, amp = 1, attack = 1, dur = 1, gate = 1, bout = 0, ampBus = 0;
|
|
|
|
|
Out.ar(bout, SinOsc.ar(freq, 2pi.rand, 1) * 0.01 * amp * Latch.kr(In.kr(ampBus), Impulse.kr(0)) * EnvGen.kr(Env.asr(attack, 1, 0.01), gate, doneAction: 2))
|
|
|
|
|
sdAccomp = SynthDef(\accomp_ ++ ~hash, {arg freq = 440, amp = 1, attack = 1, dur = 1, gate = 1, bout = 0, ampBus = 0, rel = 0.01;
|
|
|
|
|
Out.ar(bout, SinOsc.ar(freq, 2pi.rand, 1) * 0.01 * amp * Latch.kr(In.kr(ampBus), Impulse.kr(0)) * EnvGen.kr(Env.asr(attack, 1, rel), gate, doneAction: 2))
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
sdClip = SynthDef(\clip_ ++ ~hash, {arg dur = 1, gate = 1, bin = 0, bus = 0;
|
|
|
|
@ -74,12 +74,14 @@ var formatPatternData;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// group data by measures for navigation
|
|
|
|
|
formatPatternData = {arg musData, measureLen;
|
|
|
|
|
formatPatternData = {arg musData, measureLen, rel, print = false;
|
|
|
|
|
var dataLen;
|
|
|
|
|
dataLen = musData[0][0].size;
|
|
|
|
|
dataLen = musData[0][0].size + 1;
|
|
|
|
|
musData.collect({arg partData;
|
|
|
|
|
var res;
|
|
|
|
|
res = partData.flop;
|
|
|
|
|
res = partData;
|
|
|
|
|
res = res.collect({arg mData, index; mData.add(if(index != (res.size - 1), {rel}, {5.rand + 5}))});
|
|
|
|
|
res = res.flop;
|
|
|
|
|
res = res.add(res[1]);
|
|
|
|
|
res[1] = (res[1].differentiate.drop(1) ++ [10]);
|
|
|
|
|
res = res.flop ++ measureLen.collect({arg measure; dataLen.collect({0}) ++ [measure * 16]});
|
|
|
|
@ -103,8 +105,8 @@ formatPatternData = {arg musData, measureLen;
|
|
|
|
|
accompData.flatten.collect({arg partData; partData.last[1]})
|
|
|
|
|
).maxItem.ceil(16) / 16).asInteger + 1;
|
|
|
|
|
|
|
|
|
|
ensDataFormatted = formatPatternData.value(ensData, measureLen);
|
|
|
|
|
accompDataFormatted = formatPatternData.value(accompData.flatten, measureLen);
|
|
|
|
|
ensDataFormatted = formatPatternData.value(ensData, measureLen, 0.1, true);
|
|
|
|
|
accompDataFormatted = formatPatternData.value(accompData.flatten, measureLen, 0.01);
|
|
|
|
|
dUnit = 8.reciprocal;
|
|
|
|
|
|
|
|
|
|
patterns = measureLen.collect({arg measure;
|
|
|
|
@ -114,20 +116,21 @@ formatPatternData = {arg musData, measureLen;
|
|
|
|
|
});
|
|
|
|
|
Ppar(
|
|
|
|
|
//check how amplitude is being handled
|
|
|
|
|
ensDataFormatted[measure].collect({arg musData, m;
|
|
|
|
|
ensDataFormatted[measure].collect({arg musData, p;
|
|
|
|
|
Pbind(
|
|
|
|
|
\instrument, \ens_ ++ ~hash,
|
|
|
|
|
\freq, Pseq(musData[0].replace(0, Rest(0))),
|
|
|
|
|
\dur, Pseq(musData[1] * dUnit),
|
|
|
|
|
\sustain, Pseq(musData[2] * dUnit),
|
|
|
|
|
\amp, [1, 0.7, 0.5, 0.3][m],
|
|
|
|
|
//\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, [1, 0.7, 0.5, 0.3][p],
|
|
|
|
|
//\amp, Pseq(musData[2].collect({arg item; [0, 0.25, 0.5, 0.75][item]}) * [1, 0.5, 0.25, 0.1][p] * 16);
|
|
|
|
|
\ampBus, preampBusses[0].index,
|
|
|
|
|
\bus, postampBusses[m].index
|
|
|
|
|
\bus, postampBusses[p].index,
|
|
|
|
|
\rel, Pseq(musData[6])
|
|
|
|
|
)
|
|
|
|
|
}) ++
|
|
|
|
|
//check how amplitude and attack are being handled
|
|
|
|
|
accompDataFormatted[measure].collect({arg musData, m;
|
|
|
|
|
accompDataFormatted[measure].collect({arg musData;
|
|
|
|
|
Pbind(
|
|
|
|
|
\instrument, \accomp_ ++ ~hash,
|
|
|
|
|
\freq, Pseq(musData[0].replace(0, Rest(0))),
|
|
|
|
@ -137,7 +140,8 @@ 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].collect({arg index; accompBusses[index].index}))
|
|
|
|
|
\bout, Pseq(musData[4].collect({arg index; accompBusses[index].index})),
|
|
|
|
|
\rel, Pseq(musData[5])
|
|
|
|
|
)
|
|
|
|
|
}) ++
|
|
|
|
|
[
|
|
|
|
|