I tried pattern share program.
But dose not work.
1
just copy pattern , but pattern A and B different.
//same ~pA
~pB = ~pA.collect{ arg value; value; } ;
2
if i could copy A pattern to B , next i want to flip A pattern in B.
Is there mistake?
//flip ~pA
~pB = ~pA.collect{ arg value; if( value.isRest ){ value=1; }{ value=Rest(value) } } ;
//setting
(
//kick1
(
SynthDef(\tes, {
arg freq=400;
var snd , env;
env = EnvGen.ar( Env([ 1, 0], [ 1/4 ]) , doneAction:2);
snd = SinOsc.ar( freq );
snd = Pan2.ar(snd, 0, 0.5);
Out.ar(0, snd);
}).add;
);
//Synth( \tes , [freq:400] );
//Synth( \tes , [freq:4400] );
////////////////////////
~pA = Pxrand( [ 1,1, Rest(1) , 1 ] ,inf );
//same ~pA
//~pB = ~pA.collect{ arg value; value; } ;
//flip ~pA
~pB = ~pA.collect{ arg value; if( value.isRest ){ value=1; }{ value=Rest(value) } } ;
(
Pbindef(\pdef_A,
\instrument, "tes",
\freq, 440 ,
\dur, ~pA,
\check , Pfunc( {arg e; [ "\n A" , e.dur].postln; } );
);
);
(
Pbindef(\pdef_B,
\instrument, "tes",
\freq, 4400 ,
\dur, ~pB,
\check , Pfunc( {arg e; [ "B" , e.dur].postln; } );
);
);
)
//play
(
Pdef(\pdef_A).play.quant_([0,0]);
Pdef(\pdef_B).play.quant_([0,0]);
)
//stop
(
Pdef(\pdef_A).stop;
Pdef(\pdef_B).stop;
)