title:: 09_Buses
summary:: Mark Polishook tutorial
categories:: Tutorials>Mark_Polishook_tutorial
related:: Tutorials/Mark_Polishook_tutorial/00_Introductory_tutorial


By default, SuperCollider has 128 buses for audio signals and 4096 for control signals. The buses, which are items in an array, are what SuperCollider uses to represent audio and control rate data.

////////////////////////////////////////////////////////////////////////////////////////////////////

code::
// the array of audio buses (channels)
[ channel0, channel1, channel2, channel3, channel4, ... , ..., ..., etc., ... channel127 ]

// the array of control buses (channels)
[ channel0, channel1, channel2, channel3, channel4, ... , ..., ..., etc., ... channel4095 ]
::

section::Placing audio into a bus

Use an Out ugen at the audio rate to put data into an audio bus.

code::
(
SynthDef("dataForABus", {
	Out.ar(
		0,		// write 1 channel of audio into bus 0
		Saw.ar(100, 0.1)
	)
}).add;
)

Synth("dataForABus");
::

A SynthDef browser

code::
(
SynthDescLib.global.read;
SynthDescLib.global.browse;
)
::

shows 1 channel of output on channel 0.

section::Getting audio from a bus

Send an .ar message to an In ugen to get data from an audio bus.

code::
(
SynthDef("dataFromABus", {
	Out.ar(
		0,
		[	// the left channel gets input from an audio bus
			In.ar(0, 1),
			SinOsc.ar(440, 0.2)
		]
	)
}).add;
)

(
Synth("dataForABus");	// synthesize a sawtooth wave on channel 0
Synth("dataFromABus");	// pair it with a sine wave on channel 1
)
::

section::Control rate buses

Use code::In.kr:: and code::Out.kr:: to read from or write to control buses.

////////////////////////////////////////////////////////////////////////////////////////////////////

For additional information, see the link::Classes/Out::, link::Classes/In::, and link::Classes/Bus:: files in the SuperCollider help system.

////////////////////////////////////////////////////////////////////////////////////////////////////

go to link::Tutorials/Mark_Polishook_tutorial/10_Controls::
