|
|
@ -135,3 +135,94 @@ musicData = musicData.collect({arg voice, v;
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(
|
|
|
|
|
|
|
|
var primes, hsArrayToFreq, hsArrayDimDiff, file, seq, durs, chords, phraseLengths, musicData, patterns;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
thisThread.randSeed = 83924874938;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
primes = [2, 3, 5, 7, 11, 13];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hsArrayToFreq = {
|
|
|
|
|
|
|
|
arg array;
|
|
|
|
|
|
|
|
array.collect({arg dim, d; pow(primes[d], dim)}).product
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hsArrayDimDiff = {
|
|
|
|
|
|
|
|
arg array1, array2;
|
|
|
|
|
|
|
|
var fArray;
|
|
|
|
|
|
|
|
fArray = array2.drop(1) - array1.drop(1);
|
|
|
|
|
|
|
|
if(fArray.sum == 0, {1}, {(primes[fArray.abs.indexOf(1) + 1] * fArray.sum)})
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
file = File("/home/mwinter/Sketches/compact_sets/seq.txt".standardizePath,"r");
|
|
|
|
|
|
|
|
seq = file.readAllString.interpret;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//seq = seq.collect({arg item; item.sort});
|
|
|
|
|
|
|
|
/*seq = seq.collect({arg chord, index;
|
|
|
|
|
|
|
|
var ref_ins;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
var dimDiff;
|
|
|
|
|
|
|
|
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 data, index; [data[0], data[1].collect({arg pitch; (110 * hsArrayToFreq.value(pitch)).cpsmidi})].postln});
|
|
|
|
|
|
|
|
//seq.postln;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# durs, chords = seq.flop;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chords.postln;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
musicData = chords.flop.collect({arg voice, v;
|
|
|
|
|
|
|
|
var phrases, freqs, vDurs, delays, attacks, rels, sustains, amps, refs;
|
|
|
|
|
|
|
|
phrases = voice.postln.separate({arg a, b; a != b});
|
|
|
|
|
|
|
|
freqs = phrases.postln.collect({arg phrase; if(phrase[0] != ["Rest"], {45.midicps * pow(2, ([0, 1, 1][v]).clip(0, 2)) * hsArrayToFreq.value(phrase[0])}, {Rest(0)})});
|
|
|
|
|
|
|
|
vDurs = durs.clumps(phrases.collect({arg phrase; phrase.size})).collect({arg c; c.sum});
|
|
|
|
|
|
|
|
amps = freqs.collect({rrand(0.6, 0.7) / [1, 2, 2, 2][v]});
|
|
|
|
|
|
|
|
[freqs, vDurs, amps].flop;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
~musicData = musicData.postln;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
~patterns = Ppar(
|
|
|
|
|
|
|
|
musicData[0..2].collect({arg voice, v;
|
|
|
|
|
|
|
|
var freqs, durs, attacks, delays, sustains, rels, amps;
|
|
|
|
|
|
|
|
# freqs, durs, amps = voice.flop;
|
|
|
|
|
|
|
|
//# durs, attacks, delays, sustains, rels = [durs, attacks, delays, sustains, rels].collect({arg data; data / 16});
|
|
|
|
|
|
|
|
durs = durs * 16;
|
|
|
|
|
|
|
|
durs.postln;
|
|
|
|
|
|
|
|
rels = (durs / 2).clip(0, 3);
|
|
|
|
|
|
|
|
attacks = (durs / 2).clip(0, 3);
|
|
|
|
|
|
|
|
sustains = durs - rels;
|
|
|
|
|
|
|
|
Pbind(
|
|
|
|
|
|
|
|
\instrument, \string_model,
|
|
|
|
|
|
|
|
\freq, Pseq(freqs, 1),
|
|
|
|
|
|
|
|
\dur, Pseq(durs, 1),
|
|
|
|
|
|
|
|
\attack, Pseq(attacks, 1),
|
|
|
|
|
|
|
|
\sustain, Pseq(sustains, 1),
|
|
|
|
|
|
|
|
\release, Pseq(rels, 1),
|
|
|
|
|
|
|
|
\amp, Pseq(amps, 1),
|
|
|
|
|
|
|
|
\del, 0,
|
|
|
|
|
|
|
|
\busIndex, v
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
~patterns.play
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|