In Processing and Minim you have direct access to the waveform data, so you can run whatever calculations you want. More importantly you can simply use the “level” method to directly get the volume of any AudioBuffer. I’ll just paste the example directly from the Minim docs:
* This sketch is an example of how to use the
level method of an
AudioBuffer to get the
* level of one of an
AudioSource’s sample buffers. The classes in Minim that extend
* and therefore inherit the
mix buffers of that class, are
* Not coincidentally, these are also all of the classes in Minim that are
* The value returned by
level will always be between zero and one, but you may find that the value
* returned is often smaller than you expect. The level is found by calculating the root-mean-squared amplitude of the
* samples in the buffer. First the samples are all squared, then the average (mean) of all the samples is taken (sum
* and then divide by the number of samples), then the square root of the average is returned. This is why the range can be
* determined as [0, 1] because the largest value a squared sample can have is 1. However, in order for the RMS amplitude
* to equal 1, every sample must have either -1 or 1 as its value (amplitude). This is only going to be the case
* if your sound is a square wave at full amplitude. If your sound is a song or other complex sound source,
* the level is generally going to be much lower.
size(200, 200, P3D);
minim = new Minim(this);
groove = minim.loadFile(“groove.mp3”);
// draw the current level of the left and right sample buffers
// level() returns a value between 0 and 1, so we scale it up
rect(0, height, width/2, height - groove.left.level()*1000);
rect(width/2, height, width, height - groove.right.level()*1000);
// always close Minim audio classes when you finish with them
// always stop Minim before exiting
sbright33: The OP is suggesting that Processing can't do what they want, and proposes sending audio out to an Arduino and then pulling it back into the computer. They haven't said they even want to do anything else with the Arduino besides use it to process audio. The whole idea seems completely backwards and inefficient compared to just learning to use the tools in Processing correctly, which is why I'm trying to point out easier ways.
I’ve been playing with Minim already:
But I couldn’t get it to work with any audio in from my soundcard, it just seems to listen to the motherboard’s line in which I don’t use. If you know how to tell Minim to listen to my other inputs (2 at once), please tell.
I’ve only got 2 line ins on my soundcard anyway, so I can’t process 6 signals at once with Processing, unless there’s a ReWire library.