How can I get signal from audio interface?

Hi. I am using 4 contact mics plugged into audio interface.
How can I get the 4-channel signals in openframeworks from audio interface?
Can I use Ableton as the transmitter to transmit signal to oF?
If I wanna use the 4-channel signals to trigger some sound sample, can I send the sound to Ableton back using OSC?

Thanks for any reply and better solution.

using ofSoundStream and setting it up with 4 channels input shoudl work. osc won’t work for sending audio it’s too much data, osc is more oriented for control signals. if you want to send the audio from or to ableton probably something like soundflower or jack is the best solution

Thank you so much, Arturo. I am trying on that.

Hi Arturo. Can I ask u sth?

Now, I get the 4-channel signals and draw them in time domain.

  1. How can I do FFT for the four signals and draw them in frequency domain?
    Here are some code I searched for FFT using ofSoundStream:

indent preformatted text by 4 spaces
const int N = 256; //Number of bands in spectrum, time domain samples
float spectrum[ N ]; //Smoothed spectrum values
int bandRad = 2; //Band index in spectrum, affecting Rad value
int bandVel = 100; //Band index in spectrum, affecting Vel value

void ofapp::setup(){
sound.loadSound( “surface.wav” );
sound.setLoop( true );;

for (int i=0; i<N; i++) {
    spectrum[i] = 0.0f;


void ofApp::update(){

float *val = ofSoundGetSpectrum( N );
for ( int i=0; i<N; i++ ) {
    spectrum[i] *= 0.97;	//Slow decreasing
    spectrum[i] = max( spectrum[i], val[i] );


void ofApp::draw(){
ofSetColor( 0, 0, 0 );
for (int i=0; i<N; i++) {
if ( i == bandRad || i == bandVel ) {
ofSetColor( 0, 0, 0 ); //Black color
else {
ofSetColor( 128, 128, 128 ); //Gray color
ofRect( 10 + i * 5, 700, 3, -spectrum[i] * 100 );
}indent preformatted text by 4 spaces

2.How can I get the Start Point,Max Amp,Mode Frequency,Attack of the 4-channel signals?

Thanks a lot!!!


ofSoundGetSpectrum only works for the sound player by now, if you want to do FFT over a raw signal comming from the soundcard you have to do it manually. you can use:

Hi Arturo.

How can I know which mic is the first one to receive signal? and How can I get the time difference between 4 mics which receive signals respectively?