by Adam Tindale

Accessing the stereo capabilities of ChucK is relatively simple. dac has three access points.

UGen u;
// standard mono connection
u => dac;
// access stereo halves
u => dac.left;
u => dac.right;

adc functionality mirrors dac.

// this reverses the stereo image of adc
adc.right => dac.left;
adc.left => dac.right;

If you have your great UGen network going and you want to throw it somewhere in the stereo field you can use Pan2. You can use the .pan function to move your sound between left (-1) and right (1).

// this is a stereo connection to the dac
SinOsc s => Pan2 p => dac;
1 => p.pan;
while(1::second => now){
  // this will flip the pan from left to right
  p.pan() * -1. => p.pan;

You can also mix down your stereo signal to a mono signal using the Mix2 object.

adc => Mix2 m => dac.left;

If you remove the Mix2 in the chain and replace it with a Gain object it will act the same way. When you connect a stereo object to a mono object it will sum the inputs. You will get the same effect as if you connect two mono signals to the input of another mono signal.

Multi Channel Audio

Individual audio inputs and outputs on available hardware can be addressed using .chan(x).

Audio inputs and outputs are number from 0.

//ChucK Audio input 0 to output 4
adc.chan(0) => dac.chan(4);