RecordBuf, multiple channels

hi all -

i’ve been trying to take a bunch of instances of a function (each to a different channel) and mix them together/record the final output in a separate function. It only seems to be recording the first channel, though.
Can anyone tell me where I’ve gone wrong?


~buffer= Buffer.alloc(s, 44100*1, 8);
~bus = Array.fill(8, {Bus.audio(s, 1)});

~sines = {
	|out, freq|
	Out.ar(out, SinOsc.ar(freq, 0, 0.01));
};

~mixer = {|in, buf|
	var sig = In.ar(in, 8);
	RecordBuf.ar(sig, buf);
	Out.ar(0, sig);
};

{~mixer.(~bus, ~buffer)}.play;

8.do{|i| {~sines.(~bus[i], 3000.rand)}.play};

One problem here is that In.ar(in, 8) assumes that the buses are consecutive, but Array.fill(8, {Bus.audio(s, 1)}); doesn’t guarantee that. Bus.audio(s, 8) would be better.

Then, your mixer synth should get a single bus number – the first of the 8 consecutive buses. Currently you’re passing an array – probably not catastrophic, but it is leaving something up to chance.

Last,

8.do{ |i|
    { ~sines.(~bus.index + i, 3000.rand) }.play
};

hjh

1 Like