[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] OSC Pattern Scheduling
On Sep 21, 2005, at 6:23 PM, Esben Stien wrote:
So I can trigger on an exact time, instead of whole beat. I want to
trigger some synths some milliseconds before or after the beat.
When playing a routine or task, you can specify any time point using the quant argument.
myRoutine.play(clock, [1, -0.05]); // start the routine 5% before the beat
clock.play(myRoutine, [1, -0.05]); // same thing
<x-tad-smaller>r = </x-tad-smaller><x-tad-smaller>Routine</x-tad-smaller><x-tad-smaller>({
loop {
</x-tad-smaller><x-tad-smaller>thisThread</x-tad-smaller><x-tad-smaller>.clock.beats.postln;
1.0.wait;
}
}).play(</x-tad-smaller><x-tad-smaller>TempoClock</x-tad-smaller><x-tad-smaller>.default, [1, -0.05]);
596.95
597.95
598.95
599.95
600.95
r.stop;</x-tad-smaller>
5% may not be enough latency though at high tempi.
Then, when playing, send the message with a latency value. Lately I've been scheduling my routines to occur x fraction of a beat before the actual onset, then sending messages with latency / thisThread.clock.tempo. Works beautifully and is stable through tempo changes.
For more about latency, read the server timing help file.
I'm trying to trigger some synths before the actual beat. I do simple
calculations to get close with tsched. The best thing would be if I
had a function to trigger it f.ex 5% before the beat. This would take
into consideration the length in time between each beat. (if I change
tempo)
My suggestion is to start the routine running before the beat as above, then use wait values to advance the clock by precise amounts. The routine's logical time advances only by the exact values you supply using .wait or .yield.
So, calculating "now," "where I want to be," "how far I have to go" is the long way around.
It seems to not work when I insert a tsched:
TempoClock doesn't have a tsched method. It really isn't needed.
hjh
: H. James Harkins
: 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