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

Re: [sc-users] OSC Pattern Scheduling



tom tlalim <ttlalim@xxxxxxxxx> writes:

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

Yes, it's the same as above. 

If I first start routine r and then later start routine s, the first
beat in r is not necessarily the first beat in routine r, because it
just starts at the next available beat. I want those in between beats
to be rendered illegal starting points.

I need it to start always a multiplum of 8, so that the routines are
lined up with respect to each other. The first beat in routine r
should be happening at the same time as the first beat in routine s.

What happens now, is that I have to be precise when I start the next
routine; if not, then the first beat of routine r might happen at beat
2 or 3 in routine s. If that happens, then it ill be a different beat
every time I start a routine.

You see, I have my snares in one routine and the drum in another. 

Here's the entire code: 

Tempo.bpm = 90;
r = Routine({
	var	startCycle;
	loop{
		startCycle = thisThread.clock.beats;
		//		Synth.new(\DrumSineBass);
		//1-0.1
		Synth("kickDrum",[\gate,1,\vol,0.4]);  
		0.15.wait;  
		
		// 1
		//		Synth("kickDrum3",[\gate,1]);
		Synth("bd4",[\gate,1]);
		0.5.wait;  
		
		// 1.5
		Synth("bd4",[\gate,1]);  
		1.5.wait;  
 		// 3.0
		Synth("bd4",[\gate,1]);  
		0.5.wait;  
		//3.5
		Synth("bd4",[\gate,1]);  
		1.5.wait;
		// 5.0
		Synth("bd4",[\gate,1]);  
		0.48.wait;  
		// 5.48
		Synth("bd4",[\gate,1]);  
		0.52.wait;
		//6.0
		0.89.wait;
		//6.89
		Synth("bd4",[\gate,1,\vol,0.6]);  
		0.11.wait;
		//7.00
		Synth("bd4",[\gate,1,\vol,0.9]);  
		0.538.wait;
		//7.538
		Synth("bd4",[\gate,1,\vol,0.9]);  
		0.462.wait;
		//8.0
		0.38.wait;
		//8.38
		Synth("bd4",[\gate,1,\vol,0.9]);  
		// 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.)
	}
})


s = Routine({
	var	startCycle;
	loop{
		startCycle = thisThread.clock.beats;
		//1-0.1
		1.15.wait;  
		// 2.0
		Synth("snare909ish");
		2.0.wait;  
		// 4.0
		Synth("snare909ish");
		2.0.wait;  
		//6.0
		Synth("snare909ish");
		2.0.wait;
		//8.0
		Synth("snare909ish2");

		// 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

r.play(TempoClock.default, [4.0, -0.15]);
s.play(TempoClock.default, [4.0, -0.15]);

r.stop; 
r.reset;
s.stop; 
s.reset;

-- 
Esben Stien is b0ef@e     s      a             
         http://www. s     t    n m
          irc://irc.  b  -  i  .   e/%23contact
          [sip|iax]:   e     e 
           jid:b0ef@    n     n