Simple Question about output

in this code the output alternates between outputs 0 and 1

(
SynthDef(\pong,{
	var sig, ping;
	ping =LFPulse.kr(1);
	sig = Pulse.ar(300) * 0.1;
	Out.ar(ping, sig);
}).add;
)

x = Synth(\pong);

but curious why once Pulse is made multi-channel output 1 of stay open


(
SynthDef(\pong,{
	var sig, ping,env;
	ping =LFPulse.kr(2,width:0.5);
	sig = Pulse.ar([300, 600]) * 0.1;
	Out.ar(ping, sig);
}).add;
)

x = Synth(\pong);

Was expecting output 0 and 1 to still alternate but hear 300 and then 600…

sig is a 2-channel array: [Pulse.ar(300), Pulse.ar(600)]

when ping is 0, the first element of the array is output on Bus 0 and the second element on Bus 1. so both 300 and 600 cycles are heard.

when ping is 1, the first element of the array is output on 1 and the second on 2 (which may not make any sound on your system!)

Im still a bit fuzzy on it - sorry

I was assuming that as Im not summing the sig that
0 would correspond to 300
1 would correspond to 600
and as the pulse went up and down Id hear ch 0 / 300 and ch 1 / 600

in essence is they way I’m understanding is the incorrect as the way Im seeing it my single channel version should only omit sound from 0… ugh

What really happens is that the ping signal is shifting a fully stereo output between buses 0-1 and buses 1-2.

You could do:

Out.ar(0, Balance2.ar(sig[0], sig[1], ping * 2 - 1));

That is, ask the system directly for the result you want, instead of doing something tricky.

(Also, with Balance2, you can .lag the ping signal, and get a crossfade for free.)

hjh

yes this %100 makes the effect I was thinking I would get… why did I assume it was two mono signals I working with I wonder… hmm need to think a bit

Probably because the Out UGens are among the few that don’t multichannel expand array inputs: SinOsc.ar([300, 400]) produces two SinOscs, each with one frequency. But Out.ar(bus, [left, right]) does not produce two Outs – it produces only one, putting the channels onto successive buses.

hjh

I see
I was thinking each new channel would funnel straight out unless summed or mixed or some other direction given to it