Having fun with sequencing and routines

This commit is contained in:
Dan Buch 2015-12-28 14:29:27 -05:00
parent 771eba53fc
commit 6439f9343d

View File

@ -778,3 +778,69 @@
(
TempoClock.default.sched(5, { "hello".postln; nil; });
)
(
r = Routine({
"abcde".yield;
"fghij".yield;
"klmno".yield;
"pqrst".yield;
"uvwxy".yield;
"z{|}~".yield;
});
r.next;
6.do({ r.next.postln; });
)
(
r = Routine({
var delta;
loop {
delta = rrand(1, 3) * 0.5;
"Will wait ".post; delta.postln;
delta.yield;
}
});
r.next;
TempoClock.default.sched(0, r);
)
(
r.stop;
)
(
SystemClock.sched(1, { 20.do({ "".postln; }) });
)
// {-------------------------------------------------------------------------
(
SynthDef(\singrain, { |freq = 440, amp = 0.2, sustain = 1|
var sig = SinOsc.ar(freq, 0, amp) * EnvGen.kr(
Env.perc(0.01, sustain), doneAction: 2
);
Out.ar(0, sig ! 2);
}).add;
r = Routine({
var delta;
loop {
delta = rrand(1, 3) * 0.5;
Synth(\singrain, [freq: exprand(200, 800), amp: rrand(0.1, 0.5), sustain: delta * 0.8]);
delta.yield;
}
});
)
(
"starting routine".postln;
r.play;
)
(
"stopping routine".postln;
r.stop;
)
// }-------------------------------------------------------------------------