Using mic as Blow Switch

I wasn’t expecting to be able to create such  direct way of creating the image at such an early point, I expected this to come later, maybe after the first term was over and I could work on this whilst the Arduino and Physical computing workshop in january. I was direct to to simple example call //get line in by Damien Di Fede.

I’ve looked at the code alittle, but not yet found a way of using it to my advantage, but I’m hoping to be able to create a way for the drawing to start a new “random” line once the peek of the audio reaches a certain point, more to follow…….

import ddf.minim.*;
Minim minim;
AudioInput in;
void setup()
{
  size(512, 200, P2D);
  minim = new Minim(this);
  minim.debugOn();
  // get a line in from Minim, default bit depth is 16
  in = minim.getLineIn(Minim.STEREO, 512);
}
void draw()
{
  background(0);
  stroke(255);
  // draw the waveforms
  for(int i = 0; i < in.bufferSize() – 1; i++)
  {
    line(i, 50 + in.left.get(i)*50, i+1, 50 + in.left.get(i+1)*50);
    line(i, 150 + in.right.get(i)*50, i+1, 150 + in.right.get(i+1)*50);
  }
}
void stop()
{
  // always close Minim audio classes when you are done with them
  in.close();
  minim.stop();
  super.stop();
}////end

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>