I'm trying to get the volume level from my mic to adjust the size of a box (louder = bigger). But I have the following issues: a) getGain seems to be giving me -64 constantly b) getVolume doesnt seem to be available
I edited a Processing example to respond to the mic rather than the audio file provided but could not figure out how to get the volume
Here is what I have
import ddf.minim.analysis.*;
import ddf.minim.*;
Minim minim;
AudioInput accessMic;
FFT fft;
float boxSize;
void setup () {
size(512, 200, P3D);
minim = new Minim(this);
accessMic = minim.getLineIn();
rectMode(CENTER);
}
void draw() {
background(255);
boxSize = accessMic.getGain();
stroke(255);
println(boxSize);
fill(0);
rect(width/2,height/2,boxSize,boxSize);
}
Any help you can give me would be greatly appreciated Thanks
I had similar problem with .getGain(); in minim
I got around to something similar by using left.level(); which returns float between 0 and 1. And obviously that only take into account one of the stereo input, you can totally also do .right.level(); for result from another channel there.
so your code could lookin kinda like
boxSize = accessMic.left.level() * 100;
and you'll get box with a size bouncing between 0 and 100!
hope that helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With