When one sound device has four inputs

If openframeworks has 4 inputs on one sound device, can you process them separately?

Depends on what you want to do with them, for audio which is more complex than just playing a sound back I use ofxPD. you are then able to setup the ofSoundStreamSetup with 4 inputs, and have 4 adc~ objects in PD and then you an go to town with what you do with them

Yes you can.
take a look at the example in examples/sound/audioInputExample
inside ofApp::setup() change the number of input channels to 4.
Then in the callback function ofApp::audioIn(ofSoundBuffer & input) which gets called each time a new audio buffer arrives, you can process each channel independently. you can use ofSoundBuffer’s method getChannel()
so it will look something like

ofSoundBuffer someChannel; //create a new instance of ofSoundBuffer, name as you want.
input.getChannel(someChannel, 1);// pass the newly created sound buffer and then pass the channel you want to get. Notice that the first channel is 0 not 1. After calling this function, some Channel will contain the samples of the channel you requested and you can use however you wish.

Thank you! !
My problem was solved perfectly.
Thanks!

1 Like