|
|
@ -6,6 +6,7 @@ SynthDef(\string_model, {arg freq, gate = 1, del, sustain, amp, dur, attack, rel
|
|
|
|
sig1 = (Klank.ar(`[ Array.series(noHarms, freq, freq),
|
|
|
|
sig1 = (Klank.ar(`[ Array.series(noHarms, freq, freq),
|
|
|
|
Array.geom(noHarms, 1, 0.2) + Array.fill(noHarms, {rrand(0.01, 0.03)}),
|
|
|
|
Array.geom(noHarms, 1, 0.2) + Array.fill(noHarms, {rrand(0.01, 0.03)}),
|
|
|
|
Array.fill(noHarms, {rrand(1, 2)}) ], exc) * 0.8).softclip;
|
|
|
|
Array.fill(noHarms, {rrand(1, 2)}) ], exc) * 0.8).softclip;
|
|
|
|
|
|
|
|
//note that the delay cuts into the sustain portion of the tone!!!
|
|
|
|
Out.ar([0, 1], 0.75 * sig1 * amp * EnvGen.kr(Env.dadsr(del, attack, 0.3, 0.9, release, 0.9, -3), gate, doneAction: 2));
|
|
|
|
Out.ar([0, 1], 0.75 * sig1 * amp * EnvGen.kr(Env.dadsr(del, attack, 0.3, 0.9, release, 0.9, -3), gate, doneAction: 2));
|
|
|
|
}).add;
|
|
|
|
}).add;
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -13,7 +14,7 @@ SynthDef(\string_model, {arg freq, gate = 1, del, sustain, amp, dur, attack, rel
|
|
|
|
(
|
|
|
|
(
|
|
|
|
var primes, hsArrayToFreq, hsArrayDimDiff, file, seq, phraseLengths, musicData, patterns;
|
|
|
|
var primes, hsArrayToFreq, hsArrayDimDiff, file, seq, phraseLengths, musicData, patterns;
|
|
|
|
|
|
|
|
|
|
|
|
thisThread.randSeed = 1923;
|
|
|
|
thisThread.randSeed = 83924874938;
|
|
|
|
|
|
|
|
|
|
|
|
primes = [2, 3, 5, 7, 11];
|
|
|
|
primes = [2, 3, 5, 7, 11];
|
|
|
|
|
|
|
|
|
|
|
@ -35,14 +36,25 @@ seq = file.readAllString.interpret;
|
|
|
|
//seq = seq.collect({arg item; item.sort});
|
|
|
|
//seq = seq.collect({arg item; item.sort});
|
|
|
|
seq = seq.collect({arg chord, index;
|
|
|
|
seq = seq.collect({arg chord, index;
|
|
|
|
var ref_ins;
|
|
|
|
var ref_ins;
|
|
|
|
ref_ins = if(index == 0, {0}, {[seq[index - 1], chord].flop.collect({arg pair; pair[0] == pair[1]}).indexOf(true)});
|
|
|
|
ref_ins = if(index == 0, {
|
|
|
|
|
|
|
|
[0] // this should actually check which is the 'centered' pitch
|
|
|
|
|
|
|
|
}, {
|
|
|
|
|
|
|
|
[seq[index - 1], chord].postln.flop.collect({arg pair, p; if(pair[0] == pair[1], {p}, {-1})}).postln.removeEvery([-1])
|
|
|
|
|
|
|
|
});
|
|
|
|
chord.collect({arg pitch;
|
|
|
|
chord.collect({arg pitch;
|
|
|
|
var dimDiff;
|
|
|
|
var dimDiff;
|
|
|
|
[pitch, [ref_ins, hsArrayDimDiff.value(chord[ref_ins], pitch)]]
|
|
|
|
ref_ins.postln;
|
|
|
|
|
|
|
|
if(ref_ins.size == 1, {
|
|
|
|
|
|
|
|
[pitch, [ref_ins[0], hsArrayDimDiff.value(chord[ref_ins[0]], pitch)]]
|
|
|
|
|
|
|
|
}, {
|
|
|
|
|
|
|
|
var min_ref_ins;
|
|
|
|
|
|
|
|
min_ref_ins = ref_ins.minItem({arg ins; (chord[ins].drop(1) - pitch.drop(1)).abs.sum});
|
|
|
|
|
|
|
|
[pitch, [min_ref_ins.postln, hsArrayDimDiff.value(chord[min_ref_ins], pitch)]]
|
|
|
|
|
|
|
|
});
|
|
|
|
})
|
|
|
|
})
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
seq.do({arg chord; chord; chord.collect({arg pitch; hsArrayToFreq.value(pitch[0])})});
|
|
|
|
seq.do({arg chord; chord; chord.collect({arg pitch; hsArrayToFreq.value(pitch[0])}).postln});
|
|
|
|
//seq.postln;
|
|
|
|
//seq.postln;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -51,28 +63,33 @@ while({phraseLengths.sum < seq.size}, {phraseLengths = phraseLengths ++ [rrand(1
|
|
|
|
//phraseLengths.postln;
|
|
|
|
//phraseLengths.postln;
|
|
|
|
|
|
|
|
|
|
|
|
musicData = seq.clumps(phraseLengths).collect({arg subSeq, seqIndex;
|
|
|
|
musicData = seq.clumps(phraseLengths).collect({arg subSeq, seqIndex;
|
|
|
|
var baseRound, baseDurs, baseDelay, baseSubtract;
|
|
|
|
var baseRound, baseDurs, minDelay, maxDelay, baseSubtract;
|
|
|
|
baseRound = 0.5;
|
|
|
|
baseRound = 0.5;
|
|
|
|
//baseDurs = subSeq.size.collect({arg subSeqIndex; if(subSeqIndex != (subSeq.size - 1), {rrand(7.0, 10.0)}, {rrand(10.0, 15.0)})}).round(baseRound);
|
|
|
|
|
|
|
|
baseDurs = subSeq.size.collect({arg subSeqIndex; if(subSeqIndex != (subSeq.size - 1), {rrand(5.0, 7.0)}, {rrand(10.0, 15.0)})}).round(baseRound);
|
|
|
|
baseDurs = subSeq.size.collect({arg subSeqIndex; if(subSeqIndex != (subSeq.size - 1), {rrand(5.0, 7.0)}, {rrand(10.0, 15.0)})}).round(baseRound);
|
|
|
|
baseDelay = rrand(1.0, 2.0);
|
|
|
|
//baseDurs = subSeq.size.collect({arg subSeqIndex; if(subSeqIndex != (subSeq.size - 1), {rrand(5.0, 7.0)}, {rrand(15.0, 20.0)})}).round(baseRound);
|
|
|
|
baseSubtract = rrand(2.0, 4.0);
|
|
|
|
//maxDelay = rrand(1.0, 3.0);
|
|
|
|
|
|
|
|
//maxDelay = 5;
|
|
|
|
|
|
|
|
minDelay = 0;
|
|
|
|
|
|
|
|
maxDelay = 0;
|
|
|
|
|
|
|
|
baseDurs[0] = baseDurs[0] + maxDelay;
|
|
|
|
|
|
|
|
baseSubtract = rrand(0.0, 3.0);
|
|
|
|
subSeq.flop.collect({arg voice, v;
|
|
|
|
subSeq.flop.collect({arg voice, v;
|
|
|
|
var phrases, freqs, durs, delays, attacks, rels, sustains, amps, refs;
|
|
|
|
var phrases, freqs, durs, delays, attacks, rels, sustains, amps, refs;
|
|
|
|
phrases = voice.separate({arg a, b; a[0] != b[0]});
|
|
|
|
phrases = voice.separate({arg a, b; a[0] != b[0]});
|
|
|
|
freqs = phrases.collect({arg phrase; if(phrase[0][0] != ["Rest"], {48.midicps * pow(2, (v * 2).clip(0, 1)) * hsArrayToFreq.value(phrase[0][0])}, {Rest(0)})});
|
|
|
|
freqs = phrases.collect({arg phrase; if(phrase[0][0] != ["Rest"], {45.midicps * pow(2, (v * 2).clip(0, 1)) * hsArrayToFreq.value(phrase[0][0])}, {Rest(0)})});
|
|
|
|
refs = phrases.collect({arg phrase; if(phrase[0][0] != ["Rest"], {phrase[0][1]}, {Rest(0)})});
|
|
|
|
refs = phrases.collect({arg phrase; if(phrase[0][0] != ["Rest"], {phrase[0][1]}, {Rest(0)})});
|
|
|
|
durs = baseDurs.clumps(phrases.collect({arg phrase; phrase.size})).collect({arg c; c.sum});
|
|
|
|
durs = baseDurs.clumps(phrases.collect({arg phrase; phrase.size})).collect({arg c; c.sum});
|
|
|
|
delays = durs.collect({arg dur; rrand(0.0, 0.0)}).round(baseRound);
|
|
|
|
delays = durs.collect({arg dur, d; if((d == 0) && (refs[d][0] != v), {[rrand(minDelay, maxDelay), 0].wchoose([1, 1].normalizeSum)}, {0})}).round(baseRound);
|
|
|
|
//delays = durs.collect({arg dur, d; if((d == 0) && (refs[d][0] != v), {[baseDelay, rrand(2.0, 3.0)].wchoose([2, 1].normalizeSum)}, {0})}).round(baseRound);
|
|
|
|
//delays = durs.collect({0}}).round(baseRound);
|
|
|
|
//delays = durs.collect({arg dur, d; if((d == 0) && (refs[d][0] != v), {baseDelay}, {0})}).round(baseRound);
|
|
|
|
|
|
|
|
//durs = durs + delays;
|
|
|
|
|
|
|
|
attacks = durs.collect({arg dur, d; if(d == 0, {rrand(3.0, 5.0)}, {rrand(1.0, 3.0)})}).round(baseRound);
|
|
|
|
attacks = durs.collect({arg dur, d; if(d == 0, {rrand(3.0, 5.0)}, {rrand(1.0, 3.0)})}).round(baseRound);
|
|
|
|
rels = durs.collect({arg dur, d; if(d != (durs.size - 1), {rrand(1.0, 2.0)}, {rrand(3.0, 5.0)})}).round(baseRound);
|
|
|
|
rels = durs.collect({arg dur, d; if(d != (durs.size - 1), {rrand(0.5, 1.0)}, {rrand(3.0, 5.0)})}).round(baseRound);
|
|
|
|
//sustains = durs.collect({arg dur, d; if(d != (durs.size - 1), {dur - rels[d] - delays[d]}, {dur - rels[d] - delays[d]})}).round(baseRound);
|
|
|
|
sustains = durs.collect({arg dur, d;
|
|
|
|
//sustains = durs.collect({arg dur, d; if(d != (durs.size - 1), {dur}, {dur - rrand(3.0, 5.0)})}).round(baseRound);
|
|
|
|
if(d != (durs.size - 1), {
|
|
|
|
sustains = durs.collect({arg dur, d; if(d != (durs.size - 1), {dur - rels[d] - delays[d] - 0.5}, {dur - rels[d] - delays[d] - baseSubtract - rrand(0.0, 2.0)})}).round(baseRound);
|
|
|
|
dur - rels[d]
|
|
|
|
amps = freqs.collect({rrand(0.6, 0.7) / [1, 2, 2][v]});
|
|
|
|
}, {
|
|
|
|
|
|
|
|
dur - rels[d] - baseSubtract - rrand(0.0, 1.0)})
|
|
|
|
|
|
|
|
}).round(baseRound);
|
|
|
|
|
|
|
|
amps = freqs.collect({rrand(0.6, 0.7) / [1, 2, 2, 2][v]});
|
|
|
|
[freqs, durs, attacks, delays, sustains, rels, amps, refs].flop;
|
|
|
|
[freqs, durs, attacks, delays, sustains, rels, amps, refs].flop;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}).flop.collect({arg voice; voice.flatten});
|
|
|
|
}).flop.collect({arg voice; voice.flatten});
|
|
|
@ -80,7 +97,7 @@ musicData = seq.clumps(phraseLengths).collect({arg subSeq, seqIndex;
|
|
|
|
musicData = musicData.collect({arg voice, v;
|
|
|
|
musicData = musicData.collect({arg voice, v;
|
|
|
|
var clumps;
|
|
|
|
var clumps;
|
|
|
|
//(v + "~~~~~~~~~~").postln;
|
|
|
|
//(v + "~~~~~~~~~~").postln;
|
|
|
|
clumps = voice.separate({arg a, b; [true, a[0] != b[0]].wchoose([1, 1].normalizeSum)});
|
|
|
|
clumps = voice.separate({arg a, b; [true, a[0] != b[0]].wchoose([1, 2].normalizeSum)});
|
|
|
|
clumps = clumps.collect({arg clump;
|
|
|
|
clumps = clumps.collect({arg clump;
|
|
|
|
if(clump.size == 1, {clump[0]}, {
|
|
|
|
if(clump.size == 1, {clump[0]}, {
|
|
|
|
var mergedClump;
|
|
|
|
var mergedClump;
|
|
|
@ -99,6 +116,7 @@ musicData = musicData.collect({arg voice, v;
|
|
|
|
musicData.collect({arg voice, v;
|
|
|
|
musicData.collect({arg voice, v;
|
|
|
|
var freqs, durs, attacks, delays, sustains, rels, amps;
|
|
|
|
var freqs, durs, attacks, delays, sustains, rels, amps;
|
|
|
|
# freqs, durs, attacks, delays, sustains, rels, amps = voice.flop;
|
|
|
|
# freqs, durs, attacks, delays, sustains, rels, amps = voice.flop;
|
|
|
|
|
|
|
|
//# durs, attacks, delays, sustains, rels = [durs, attacks, delays, sustains, rels].collect({arg data; data / 16});
|
|
|
|
Pbind(
|
|
|
|
Pbind(
|
|
|
|
\instrument, \string_model,
|
|
|
|
\instrument, \string_model,
|
|
|
|
\freq, Pseq(freqs, 1),
|
|
|
|
\freq, Pseq(freqs, 1),
|
|
|
@ -116,4 +134,4 @@ musicData = musicData.collect({arg voice, v;
|
|
|
|
~patterns.play
|
|
|
|
~patterns.play
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
~patterns.play
|
|
|
|
|
|
|
|