Hello,
I am trying to activate different SendReply uGens in a single SynthDef, using a Select uGen to switch them according to which ‘out’ argument the synth is given.
What seems to be happening is that both are sending at once. Is there any way to get the behaviour I’m after? Essentially, it needs to send the amp envelope to a separate OSC receiver according to which output is selected.
Unfortunately I can’t send as a bundle, because then overlapping synths affect the whole OSC stream - I am sending the OSC on to Processing after receiving it using OSCDefs in SC.
My SynthDef:
//define perc synth
SynthDef(\perc, { arg out, gate = 0, freq = 100, atk = 0.00001, rel = 0.75, pAtk = 0.0001, pRel = 0.3, pEnvScale = 2.5, dTime = 0, amp = 0.8, noiseLevel = 0.5;
var aEnv, pEnv, oscil, oscil2, noise;
noise = LPF.ar(WhiteNoise.ar(0.75) * Line.ar(1,0,0.003), 4000);
aEnv = EnvGen.kr(Env.perc(atk, rel), doneAction: 2);
pEnv = EnvGen.kr(Env.perc(pAtk, pRel)) * pEnvScale;
oscil = SinOsc.ar(freq * pEnv, 0, amp) * aEnv;
oscil2 = SinOsc.ar(freq + 10 , 0, amp * 0.65) * aEnv;
Out.ar(out, BPeakEQ.ar(oscil + oscil2, freq: 1000.0, rq: 6, db: -10.0) + (noise * noiseLevel));
Select.ar(out, [SendReply.ar(Impulse.ar(50), '/percEnvL', [aEnv]), SendReply.ar(Impulse.ar(50), '/percEnvR', [aEnv])]);
}).add;