It’s possible to output sound over multiple audio channels from Processing using a usb Audio Interfaces like the Gigaport HD+ or AG. The initial installation is a little fiddly, however once you have your system setup in will run perfectly every time.
Setting up USB Audio Interface.
It’s not possible for Processing to simply send multiple audio channels to the one device, so we are going to setup OSX to treat the Audio Interface as if it where multiple stereo devices. Then we will be able to send stereo audio to each of these virtual devices in Processing.
Steps
Processing
Install minim library and try out the following example code:
Code: import ddf.minim.*; import javax.sound.sampled.*; Minim minim; Minim minim2; Minim minim3; Minim minim4; AudioOutput output; AudioOutput output2; AudioOutput output3; AudioOutput output4; Mixer.Info[] mixerInfo; AudioPlayer player; AudioPlayer player2; AudioPlayer player3; AudioPlayer player4; void setup() { size(512, 200, P3D); // create Minim objects minim = new Minim(this); minim2 = new Minim(this); minim3 = new Minim(this); minim4 = new Minim(this); //show all the available channels mixerInfo = AudioSystem.getMixerInfo(); for(int i = 0; i < mixerInfo.length; i++){ println(i + " = " + mixerInfo[i].getName()); } // Assign the mixer based on the output from above, change mixerInfo[] Mixer mixer = AudioSystem.getMixer(mixerInfo[2]); Mixer mixer2 = AudioSystem.getMixer(mixerInfo[2]); Mixer mixer3 = AudioSystem.getMixer(mixerInfo[2]); Mixer mixer4 = AudioSystem.getMixer(mixerInfo[2]); minim.setOutputMixer(mixer); output = minim.getLineOut(); minim2.setOutputMixer(mixer2); output2 = minim2.getLineOut(); minim3.setOutputMixer(mixer3); output3 = minim3.getLineOut(); minim4.setOutputMixer(mixer4); output4 = minim4.getLineOut(); //playback sound player = minim.loadFile("1.wav"); player.play(); player2 = minim2.loadFile("2.wav"); player2.play(); player3 = minim3.loadFile("3.mp3"); player3.play(); player4 = minim4.loadFile("4.mp3"); player4.play(); }