Hello!
I would like to have a single Synth, which is manipulated by different Patterns. What would be the smartest way to do so?
Lets say I let 2 patterns (Pmono) run in parrallel, which change the pitch in a different manner and i want to select between them, then i could do this example:
(
SynthDef(\testme, {
arg t_gate = 1;
var e = EnvGen.kr(Env.adr(),t_gate);
var sig = SinOsc.ar(\freq.kr(440))!2;
Out.ar(\bus.kr(0),sig*e*\amp.kr(1));
}).add;
)
(
~select = 0;
~a = Pmono(\testme,
\degree,Pseq([0,1,2,3],inf),
\gate, Pfunc{1-~select}
).play;
~b = Pmono(\testme,
\degree,Pseq([0,-1,-2,-3],inf),
\gate, Pfunc{~select}
).play;
)
~select = 1;
~select = 0;
~select = 1;
~select = 0;
~a.stop; ~b.stop;
However in this way, each of the Pmonos will run a Synth, and therefore i have 2 synths running, even though i would only need one.
I could theoretically also just run a synth like this:
(
~synth = Synth(\testme, [\t_gate,0]);
Pbind(
\freq, Pseq([60,62,64,65],inf).midicps,
\t_gate, 1,
\amp, 0.2,
\setter, Pfunc{|e| e.collect{|v,k|~synth.set(k,v)}},
\amp, 0,
).play
)
Latter would solve kinda-ish my problem, but in a not so beautiful way. Because I need to use the \freq key and cannot use the \degree key. Also a synth is played from Pbind, which im Muting.
Is there a good solution for the problem that when i have a Synth playing, that multiple patterns could change it (they are rested)?
Thank you very much!