In, Out, ReplaceOut, and busses

Hi, I’m very new to SuperCollider and am not sure how In, Out, ReplaceOut, and busses work together (e.g., what is In.kr vs. In.ar? What is the difference between Out and ReplaceOut?)

For example, here is some code that I believe is used by FoxDot.

s.boot;

SynthDef.new(\arpy,
{|amp=1, sus=1, pan=0, freq=0, vib=0, fmod=0, rate=0, bus=0, blur=1, beat_dur=1, atk=0.01, decay=0.01, rel=0.01, peak=1, level=0.8|
var osc, env;
sus = sus * blur;
freq = In.kr(bus, 1);
freq = [freq, freq+fmod];
freq=(freq / 2);
amp=(amp * 2);
freq=(freq + [0, 0.5]);
osc=LPF.ar(Impulse.ar(freq), 3000);
env=EnvGen.ar(Env.perc(attackTime: 0.01,releaseTime: (sus * 0.25),level: amp,curve: 0), doneAction: 0);
osc=(osc * env);
osc = Mix(osc) * 0.5;
osc = Pan2.ar(osc, pan);
ReplaceOut.ar(bus, osc)}).add;

SynthDef.new(\bitcrush,
{|bus, bits, sus, amp, crush|
var osc;
osc = In.ar(bus, 2);
osc = Decimator.ar(osc, rate: 44100/crush, bits: bits);
osc = osc * Line.ar(amp * 0.85, 0.0001, sus * 2);
ReplaceOut.ar(bus, osc)}).add;

How exactly do I play the arpy sound with the bitcrush effect? A simple Synth(\arpy) in SuperCollider does not seem to play any audio, presumably because I don’t have the proper bus setup. How do I fix this?

Actually the lack of audio is because the default frequency for arpy is 0: try Synth(\arpy, [freq: 440]). Its default output bus is 0, so you should hear that.

Out mixes the new signal into what was already on the bus – this is recommended for source synths to allow polyphony (so I don’t quite agree with the use of ReplaceOut in \arpy). ReplaceOut overwrites with the new signal. This is good for effect synths.

SC by default puts nodes at the head of the target group, so: play bitcrush onto bus 0 (prepare it first), then also play arpy onto bus 0. Then arpy should calculate first, and after that signal is available, bitcrush should process it. After that’s working, as a test, then you can set up buses to use basically as a mixer.

hjh