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

Re: [sc-users] More dumb stream questions



I'm making some progress with my little In C Xmas project, but questions keep popping up.
I want to iterate over an array of patterns, but I can't figure out 
how to construct a do loop that's doesn't make everyrhing happen at 
once:
the Ptpar class would suit you i think.  sadly no helpfile yet but it 
takes an array of offsets in seconds and what pbinds to play.  note 
that it stops when any pbind returns nil so just make sure your 
patterns are infinitely long e.g. Pseq([Pseq(pattern), Pseq(pause)], 
inf)
good luck /f0

(
var inC;

inC= Array.newClear(3);

inC[0] =  Pbind( // pattern1
	\instrument, "fmgen_a_" ++ 35.rand,
[\midinote,\dur], Pseq([Pseq([[60, 0.1],[64, 0.4]], 3), Pseq([[\, 2]], 1)], 30) //repeat this 30 times then stop
	);
	
inC[1] = Pbind( // pattern2
	\instrument, "fmgen_a_" ++ 35.rand,
[\midinote,\dur], Pseq([Pseq([[60, 0.05],[64, 0.245], [65, 0.25], [64, 0.5]])], inf) //repeat inf
	);
	
inC[2]= Pbind(
	\instrument, "fmgen_a_" ++ 35.rand,
[\midinote,\dur], Pseq([Pseq([[\, 0.25],[64, 0.25], [65, 0.25], [64, 0.25]])], inf) //repeat inf
	);  // any symbol is a rest, like \ or whatever

Ptpar([0, inC[0], 5, inC[1], 10, inC[2]]).play; //offset, pbind, offset, pbind etc
)



(
var inC;

inC= Array.newClear(54);

inC[1] =  Pbind( // pattern1
	\instrument, "fmgen_a_" ++ 35.rand,
[\midinote,\dur], Pseq([Pseq([[60, 0.1],[64, 0.4]], 3)], {1 + 10.rand})
	);
	
inC[2] = Pbind( // pattern2
	\instrument, "fmgen_a_" ++ 35.rand,
[\midinote,\dur], Pseq([Pseq([[60, 0.05],[64, 0.245], [65, 0.25], [64, 0.5]])], {1 + 10.rand})
	);
	
inC[3]= Pbind(
	\instrument, "fmgen_a_" ++ 35.rand,
[\midinote,\dur], Pseq([Pseq([[\, 0.25],[64, 0.25], [65, 0.25], [64, 0.25]])], {1 + 10.rand}) ); // any symbol is a rest, like \ or whatever
	

// Pseq([inC[1], inC[2], inC[3]]).play; // This works OK, p[1]1 is played, finishes, p[2] plays etc.
	inC.do{arg item; item.play} // but how do I do this? The 54 patterns 
happen at once,
)

  #|
     fredrikolofsson.com     klippav.org
  |#