Sending different SendReply in SynthDef


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 = *,0,0.003), 4000);
		aEnv =, rel), doneAction: 2);
		pEnv =, pRel)) * pEnvScale;

		oscil = * pEnv, 0, amp) * aEnv;
		oscil2 = + 10 , 0, amp * 0.65) * aEnv;, + oscil2, freq: 1000.0, rq: 6, db: -10.0) + (noise * noiseLevel));, [, '/percEnvL', [aEnv]),, '/percEnvR', [aEnv])]);

Select evaluates everything and outputs only one, by design.

You’ll need to multiply the triggers by their own on/off switches.

var trig =;

... * (out <= 0), '/percEnvL', [aEnv]); * (out >= 1), '/percEnvR', [aEnv]);

EDIT: Another way – if you have control over the message format, you could put the output bus into the message as a parameter. It’s not strictly necessary to encode as part of the OSC command., '/percEnv', [out, aEnv]);

Then the receiver in Processing would disambiguate based on the parameter.


Thank you James - that makes sense, with Select both are evaluated, just not output.

This technique works - I didn’t think to use comparison operators but it’s clear and simple. Perfect!