I would like to select random keys with keeping pair .
Is there any solution to do it ??
Below is test code.
Thank you.
(
////synth
(
//triSin//
SynthDef(\sin1, { | amp=0.3, freq=400 , sustain=2.2 |
var sig, env;
env = EnvGen.kr( Env.linen(0.01,sustain-0.02,0.01) , doneAction:2);
sig = SinOsc.ar( freq ) ;
sig =Pan2.ar(sig,0);
sig = sig * env * amp;
Out.ar( 0 , sig );
}).add;
);
//Synth(\sin1, [amp:0.5 , freq:400 ,sustain:0.3 ] );
/////pattern
(
Pbindef(\pdef_sin,
\instrument, “sin1”,
\freq, Prand( [400 , 1000], inf ),
\sustain , Prand( [0.1 , 0.3 ] ,inf ),
\dur, Prand( [0.2 , 0.6 ] ,inf )
);
);
Pdef(\pdef_sin).play;
//Pdef(\pdef_sin).stop;
)
dkmayer
October 11, 2020, 12:54am
2
Hi,
probably easiest to use array keys
There are many options for builing dependencies in Pattern, see James’ Pattern Guide.
Just a few mentions: You can establish dependencies from other keys via Pkey and Pif, similarily also with Pfunc, her you can define any functional relation with
\dur, Pfunc { |e| ... e[\degree] ... }
You can also link with array keys:
Pbind([\dur, \degree], Prand([[0.1, 5], [0.2, 4], [0.5, 2]], inf)).trace.play
You can also define a master pattern and control both params with data sharing.
Wow , this is what i want.
Thank you speedy help."
In this case , “array key” is best!!
“Pkey” is also useful in other case.
Thank you Useful information!!
Below is revised test code with array key. I works well.
(
Pbindef(\pdef_sin,
\instrument, “sin1”,
[\freq,\sustain,\dur] , Prand([ [400 , 0.1,0.2],[1000,0.3,0.6] ] , inf ).trace,
);
);