Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: sine(LFPar) minor random bliss in two
name
code content
// 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;
code description
just something i did as an excercise trying to understand clocks and scheduling
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change