Hi,
you can try with Julian’s \pari event type he suggested a few days ago on the SC mailing list:
https://www.listarc.bham.ac.uk/lists/sc-users/msg62866.html
The synth combos can be defined in a separate pattern, e.g.
(
SynthDef(\synth_0, {|out = 0, freq = 440, amp = 0.1, pan = 0|
Out.ar(out, Pan2.ar(SinOsc.ar(freq, mul: amp), pan) * EnvGate.new)
}).add;
SynthDef(\synth_1, {|out = 0, freq = 440, amp = 0.1, pan = 0|
Out.ar(out, Pan2.ar(Saw.ar(freq, mul: amp), pan) * EnvGate.new)
}).add;
SynthDef(\synth_2, {|out = 0, freq = 440, amp = 0.1, pan = 0|
Out.ar(out, Pan2.ar(Pulse.ar(freq, mul: amp), pan) * EnvGate.new)
}).add;
SynthDef(\synth_3, {|out = 0, freq = 440, amp = 0.1, pan = 0|
Out.ar(out, Pan2.ar(Formant.ar(freq, mul: amp), pan) * EnvGate.new)
}).add;
Event.addEventType(\pari, {
var instr = ~instrument;
~type = \note;
if(instr.isArray and: { instr.isString.not }) { // just to make sure
instr.do { |each|
~instrument = each;
currentEnvironment.play
}
} {
currentEnvironment.play
}
});
)
(
p = Pbind(
\midinote, Pstutter(Pwhite(3, 8), Pwhite(60, 90)),
\amp, Pstutter(Pwhite(3, 8), Pseq([0.05, 0.1], inf)),
\dur, 0.1,
\type, \pari
);
q = Pbind(
\instrument, Pstutter(Pwhite(1, 3), Pseq([[0], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]], inf))
.collect { |c| c.collect { |i| ("synth_" ++ i).asSymbol } }
) <> p;
x = q.trace.play
)
x.stop