Go Down

Topic: Splitting LEFT and RIGHT Channels with AudioInput getLineIn (Read 1 time) previous topic - next topic


Is it possible to separate the right and left audio channels when using the getLineIn function???

I would like to perform separate processing on the left and right channels and use them in an audio visualization application.

If anyone knows how to does this, or can point me to another topic or source that explains it, I would very much appreciate it.


From an example I found:

Code: [Select]

import ddf.minim.*;
import processing.serial.*;
import cc.arduino.*;

Arduino arduino;
Minim minim;
AudioInput in;

arduino = new Arduino(this, Arduino.list()[0], 57600);
minim = new Minim(this);
  in = minim.getLineIn(Minim.STEREO, 1050);

  for(int i = 0; i < in.bufferSize(); i++)
    leftSample = in.left.get(i);
    rightSample = in.right.get(i);
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp


Awesome John!... thanks for the quick response.

The code, leftSample = in.left.get(i); will get the left audio channel data as type float. 

Any ideas on how to use this data with beatdetect??

beatL = new BeatDetect(leftSample.bufferSize(), leftSample.sampleRate());  does not work.  It results in the error, "Cannot invoke bufferSize() on the primitive type float."

How can I get BeatDetect to work with a single channel at a time?


Read the documentation for BeatDetect.


The first argument to the constructor is the number of samples in the buffer.  If you look at the example I quoted above you'll see the buffer size is "in.buffeSize()".

If you are lucky, in.left and in.right are objects of type AudioBuffer and can each be passed to "detect()".
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

Go Up