We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Get line in (Read 537 times)
Get line in
Apr 5th, 2009, 11:01pm
 
Hello.

This could potentially be a very simple question. I am working on a project where an object reacts to the tone and volume of a voice through microphone. I am trying this first by using the sample code for the GetLineIn minim library.  I made the draw function this :

void draw()
{
 background(30);
 stroke(255);

 for(int i = 0; i < in.bufferSize() - 1; i++)
 {
float total = in.mix.get(i);
   float diff = in.right.get(i) - in.left.get(i);
   int s = round(total * 200) + 10;
   int y = width/4;
   ellipse(500 - (diff * 500), y, s, s);
 }
}

It is not very effective. I want it to redraw the shape in X according to volume, and Y according to tone, while keeping the position and not jumping back as soon as the sound ends.
Help?
Thank you.
Page Index Toggle Pages: 1