«sine(LFPar) minor random bliss in two» by Luka P.
on 11 Dec'16 13:36 injust something i did as an excercise trying to understand clocks and scheduling
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
// two implementations of the same thing // first as a simple function scheduled on a TempoClock // second a Routine scheduled ( t = { // this is just a function // arg time; var tone0, tone1, tone2, interval, freq0, next; tone0 = rrand(0,11); interval = rrand(2,4); next = rrand(1,4) / 6; tone1 = Scale.minor(\pythagorean).at(tone0) + [0,12,24].choose + 0.07; tone2 = Scale.minor(\pythagorean).at(tone0 + interval) + [0,12,24].choose; freq0 = ((4*12) + [tone1,tone2] ).midicps; postln("tone0" + tone0 + "| tone1:" + tone1 + "|tone2:" + tone2 + "|interval:" + interval + "|nextime:" + time); { LFPar.ar( freq: freq0, mul: EnvGen.kr(Env.perc(0, 3, 0.1),doneAction:2) ) }.play; next.value; // schedule next event } ) // start playing c = TempoClock.new.play(t); ////////////////////////////////////////////////////////////////////////////////////////////////// // same thing converted into a Routine! :) ( SynthDef("param", { arg freq = #[300,310], sustain; // # - freq has literal array of defaults! var sig; sig = LFPar.ar(freq: freq, mul: EnvGen.kr(Env.perc(0, sustain, 0.5), doneAction:2)); sig = Splay.ar(sig); Out.ar(0, sig); }).add; r = Routine({ var tone0, tone1, tone2, interval, freq0, delta; loop { tone0 = rrand(0,11); interval = rrand(2,4); tone1 = Scale.minor(\pythagorean).at(tone0) + [0,12,24].choose + 0.07; tone2 = Scale.minor(\pythagorean).at(tone0 + interval) + [0,12,24].choose; freq0 = ((4*12) + [tone1,tone2] ).midicps; postln(freq0); delta = rrand(1,4) / 6; Synth("param", [freq: freq0, sustain: delta * 8] ); delta.yield; } }) ) // start playing r.play;
reception
comments