Re: Out ; summing ; phase cancellation

[email protected]
Newsgroups gmane.comp.audio.supercollider.user
Message-ID <CAFniQ7UZFePdm0t_KJ-h=JWPn=bAVgHy-vFXwXem=7oMqSb0AQ@mail.gmail.com>
Going back to the original question -- "why the graph 'x' below
doesn't phase cancel?" -- we could also ask why Out doesn't
multichannel-expand in the way you would expect at first.

I think it's because most UGen inputs interpret an array to mean
"produce a separate instance of the UGen for each array value," while
Out interprets a signal array to mean "feed all of the array elements,
in sequence, into a single UGen instance."

(
SynthDef(\x, {
    var a, b, c, d;
    #a, b, c, d = SinOsc.ar([0, 1, 2, 3]).debug("multichannel
expansion of SinOsc.ar");
    Out.ar(0, [a, b]);
}).dumpUGens;
)

The SinOsc with array produces [ a SinOsc, a SinOsc, a SinOsc, a
SinOsc ]. If Out followed the same pattern, you would have `Out.ar(0,
a)` and `Out.ar(0, b)` -- a mono mixdown. But it doesn't do that:

[ 0_SinOsc, audio, [ 0, 0.0 ] ]
[ 1_SinOsc, audio, [ 1, 0.0 ] ]
[ 2_Out, audio, [ 0, 0_SinOsc, 1_SinOsc ] ]

So, with Out, the first array element goes to input index 1, the
second to input index 2 and so on.

What if you have a single array element, but that element is an array?
Out is expecting a single UGen for each channel input, so sub-arrays
must multi-channel expand.

(
SynthDef(\x, {
    var a, b, c, d;
    #a, b, c, d = SinOsc.ar([0, 1, 2, 3]).debug("multichannel
expansion of SinOsc.ar");
    Out.ar(0, [[a, b]]);
}).dumpUGens;
)

[ 0_SinOsc, audio, [ 0, 0.0 ] ]
[ 1_Out, audio, [ 0, 0_SinOsc ] ]
[ 2_SinOsc, audio, [ 1, 0.0 ] ]
[ 3_Out, audio, [ 0, 2_SinOsc ] ]

That is -- here, both a and b belong to the first output channel
(because they are both members of the first array element given to
Out) -- two first-channel signals require two Out units.

If there are more top-level array elements, then the same logic
repeats for each channel: Out.ar([[a, b], [c, d]]) should put a and b
*both* on channel 0, and c and d *both* on channel 1 -- which it does:

(
SynthDef(\x, {
    var a, b, c, d;
    #a, b, c, d = SinOsc.ar([0, 1, 2, 3]).debug("multichannel
expansion of SinOsc.ar");
    Out.ar(0, [[a, b], [c, d]]);
}).dumpUGens;
)

[ 0_SinOsc, audio, [ 0, 0.0 ] ]
[ 1_SinOsc, audio, [ 1, 0.0 ] ]
[ 2_SinOsc, audio, [ 2, 0.0 ] ]
[ 3_Out, audio, [ 0, 0_SinOsc, 2_SinOsc ] ]  // a and c = L and R
[ 4_SinOsc, audio, [ 3, 0.0 ] ]
[ 5_Out, audio, [ 0, 1_SinOsc, 4_SinOsc ] ]  // b and d = L and R

The initial expectation was that the subarray [a, b] would define a
L-R stereo pair, and [c, d] another L-R pair. But if it did that, then
consider:

a = SinOsc.ar(440, 0);
b = SinOsc.ar(441, pi);
c = SinOsc.ar(440, pi);
d = SinOsc.ar(441, 0);

Out.ar(0, [a, b])  // we expect L = a, R = b

x = [a, b]
y = [c, d]

Out.ar(0, [x, y])

The rule is that x defines L and y defines R... but you were expecting
Out.ar(0, [a, b]) and Out.ar(0, [c, d]). By that logic, Out would
behave differently from "normal" multichannel expansion for
one-dimensional arrays, but the same as normal MCE for
multi-dimensional arrays, which would be inconsistent.

hjh

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.