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

Re: [sc-users] OSC Pattern Scheduling



James Harkins <jamshark70@xxxxxxxxx> writes:

> I'm pretty sure this will do what you want. 

Yes;), as far as I can tell, this works great. I'll start new threads
with the issues I still have.

Thank you for all your help. 

//Free GPL SuperCollider Hallway Hip-Hop
Tempo.bpm = 90;
r = Routine({
	var	startCycle;
	loop {
		startCycle = thisThread.clock.beats;
		//1-0.1
		Synth("kickDrum",[\gate,1,\vol,0.6]);  
		0.11.wait;  
		
		// 1
		Synth("kickDrum",[\gate,1]);
		0.5.wait;  
		
		// 1.5
		Synth("kickDrum",[\gate,1]);  
		0.5.wait;  

		// 2.0
		Synth("snare909ish");
		1.0.wait;  
 		// 3.0
		Synth("kickDrum",[\gate,1]);  
		0.5.wait;  
		//3.5
		Synth("kickDrum",[\gate,1]);  
		0.5.wait;
		// 4.0
		Synth("snare909ish");
		1.0.wait;  
		// 5.0
		Synth("kickDrum",[\gate,1]);  
		0.48.wait;  
		// 5.48
		Synth("kickDrum",[\gate,1]);  
		0.52.wait;
		//6.0
		Synth("snare909ish");
		0.89.wait;
		//6.89
		Synth("kickDrum",[\gate,1,\vol,0.5]);  
		0.11.wait;
		//7.00
		Synth("kickDrum",[\gate,1,\vol,1.0]);  
		0.538.wait;
		//7.538
		Synth("kickDrum",[\gate,1]);  
		0.462.wait;
		//8.0
		Synth("snare909ish");

		// 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 are at the original integer beat + 4.9 (or 8.9, etc.)
	}
}).play(TempoClock.default, [4.0, -0.11]);
r.stop;
r.play;  //this won't work; need to start it again

(
SynthDef(\snare909ish,{ |out=2,mul=1,velocity=1|
	var filtWhite;
	filtWhite = LPF.ar(WhiteNoise.ar(1), 7040, 1) * (0.1 + velocity);
	Out.ar(out,                
                (
                  (
		  /* Two simple enveloped oscillators represent the loudest resonances of the drum membranes */
					  (LFTri.ar(330,0,1) * EnvGen.ar(Env.perc(0.0005,0.055),doneAction:0) * 0.25)
					  +(LFTri.ar(185,0,1) * EnvGen.ar(Env.perc(0.0005,0.075),doneAction:0) * 0.25)
					  
		  /* Filtered white noise represents the snare */
					  +(filtWhite * EnvGen.ar(Env.perc(0.0005,0.4),doneAction:2) * 0.2)
					  +(HPF.ar(filtWhite, 523, 1) * EnvGen.ar(Env.perc(0.0005,0.283),doneAction:0) * 0.2)
					  
                  ) * mul
                ).dup(2)
	)
}).send(s)
)

SynthDef("kickDrum", { arg gate=0, vol=1; //GPL licensed 
	var daNoise,daOsc,env1,env2,env3;
	//noise filter cutoff envelope
	//controlls cutoff pitch...0 to 80 Hz
	env1=Env.perc(0.001,1,80,-20); 
	//mix-amp envelope
	//controlls overall amplitude...0 to 1
	env2=Env.perc(0.001,1,vol,-8); 
	//osc-pitch envelope
	//controlls pitch of the oscillator...0 to 80 Hz
	env3=Env.perc(0.001,1,80,-8); 
	//Attack noise portion of the sound
	//filter cutoff controlled by env1
	//+20 to move it into the audible
	//spectrum

	daNoise=LPF.ar(WhiteNoise.ar(1),EnvGen.kr(env1,gate)+20);

    //VCO portion of the sound
    //Osc pitch controlled by env3
    //+20 to move the pitch into the
    //audible spectrum
	daOsc=LPF.ar(SinOsc.ar(EnvGen.kr(env3,gate)+20),200); 

	//output
	Out.ar(0,Pan2.ar(
		Mix([daNoise,daOsc]),
		0, //position
		//level controlled by env2
		EnvGen.kr(env2,gate,doneAction: 2) 
	);
	);
}).load(s);

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