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

Re: [sc-users] OSC Pattern Scheduling



can you post a code example of what you're trying to do?

Yes, it's the same as above. 

doh...
sorry, didn't connect the dots.

first, for these kind of beat scheduling Task is a better mechanism
because it's a PauseStream, made to pause and resume.

about the loops coming in on time, you have to make sure that every time you play the
task (or routine) you five it the arguments TempoClock.default and [4.0, -0.15].

r.play will start right away;
r.play(TempoClock.default, quant:[4.0, -0.15])
will wait for the next quant.

here's a code that works for me (p.s. interpreter var 's' is reserved for the Server. i replaced it with 'p')

Tempo.bpm = 90;
(
r = Task({
var startCycle;
loop{
startCycle = thisThread.clock.beats;
// Synth.new(\DrumSineBass);
//1-0.1
Synth("sin", [\freq, 340]);  
0.15.wait;  


// 1
// Synth("kickDrum3");
Synth("sin", [\freq, 400]);
0.5.wait;  


// 1.5
Synth("sin", [\freq, 400]);  
1.5.wait;  
  // 3.0
Synth("sin", [\freq, 400]);  
0.5.wait;  
//3.5
Synth("sin", [\freq, 400]);  
1.5.wait;
// 5.0
Synth("sin", [\freq, 400]);  
0.48.wait;  
// 5.48
Synth("sin", [\freq, 400]);  
0.52.wait;
//6.0
0.89.wait;
//6.89
Synth("sin", [\freq, 400]);  
0.11.wait;
//7.00
Synth("sin", [\freq, 400]);  
0.538.wait;
//7.538
Synth("sin", [\freq, 400]);  
0.462.wait;
//8.0
0.38.wait;
//8.38
Synth("sin", [\freq, 400]);  
// we know exactly when the cycle started, so we can add 4 and subtract the current logical time
(startCycle + 8.0 - thisThread.clock.beats).wait;
// now we're at the original integer beat + 4.9 (or 8.9, etc.)
}
});


p = Task({
var startCycle;
loop{
startCycle = thisThread.clock.beats;
//1-0.1
1.15.wait;  
// 2.0
Synth("sin", [\freq, 1000]);
2.0.wait;  
// 4.0
Synth("sin", [\freq, 1000]);
2.0.wait;  
//6.0
Synth("sin", [\freq, 1000]);
2.0.wait;
//8.0
Synth("sin", [\freq, 1000]);

// we know exactly when the cycle started, so we can add 4 and subtract the current logical time
(startCycle + 8.0 - thisThread.clock.beats).wait;
// now we're at the original integer beat + 4.9 (or 8.9, etc.)
}
})
)

//transport
~args = [TempoClock.default, true, [8.0, -0.15]]

r.play(*~args);
p.play(*~args);

r.stop; 
p.stop; 

r.play(*~args); 
p.play(*~args); 

cheerz,
tom