[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] OSC Pattern Scheduling



On 9/27/05, Manfred Brockhaus <manfred.brockhaus@xxxxxxxxx> wrote:
> Perhaps you want something like this?
>
> TempoClock.sched(0.9,{*event 1*});
> TempoClock.sched(1.0,{*event 2*});
> TempoClock.sched(2.2,{*event 3*});

To make it exactly centered around beat 1.0, you really need to use
schedAbs. Also, TempoClock can have multiple instances so you can't
use TempoClock.sched (TempoClock.default.sched would be correct).

baseTime = thisThread.clock.beats.roundUp(1);
thisThread.clock.schedAbs(baseTime + 0.9, {*event 1*});
thisThread.clock.schedAbs(baseTime + 1.0, {*event 2*});
thisThread.clock.schedAbs(baseTime + 2.2, {*event 3*});

I don't see that these calculations are all that complicated.

Alternately (and I think this is a better solution, but it may be only
my preference),

r = Routine({
	var	startCycle;
	loop {
		startCycle = thisThread.clock.beats;
		// event 1

// at this point, we know that the clock is at some integer beat + 0.9
// because of the quant argument starting play

		0.1.wait;  // this is guaranteed to move ahead to exactly 1.0

		// event 2

		1.2.wait;  // this is guaranteed to move ahead to exactly 2.2

		// event 3

// we know exactly when the cycle started, so we can add 4 and
subtract the current logical time

		(startCycle + 4.0 - thisThread.clock.beats).wait;
// now we are at the original integer beat + 4.9 (or 8.9, etc.)
	}
}).play(TempoClock.default, [4.0, -0.1]);

Again, not complicated.

I'm pretty sure this will do what you want. It's true that there are
some non-trivial calculations involved, but TempoClock handles them
all transparently in primitives. I think that might be spooky for some
people, who think that if they write all the calculations themselves,
then they have absolute control over it (which in fact is an illusion
-- you actually have more control by working with the scheduler as
written).

hjh

--
James Harkins /// dewdrop world
jamshark70@xxxxxxxxxxxxxxxxx
http://www.dewdrop-world.net

"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal."  -- Whitman