Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : How to get an If to work with audioinput?

$
0
0
Never mind I solved it!

import ddf.minim.spi.*;
import ddf.minim.signals.*;
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.ugens.*;
import ddf.minim.effects.*;

Minim minim;
AudioInput in;

PImage img; // Deklarera en variabel för typ PImage

void setup()
{
size(612, 300, P2D);
minim = new Minim(this);
minim.debugOn();

// get a line in from Minim, default bit depth is 16
in = minim.getLineIn(Minim.STEREO, 160);
img = loadImage("moonwalk.jpg"); // Ladda in bilden i programmet
}

void draw()
{
  background(0);
  for (int i = 0; i < 1; i++){
   float r = (1000*in.right.get(i));
   float l = (1000*in.left.get(i+1));
   float number = ((r*l)/2);
   //println(number);
   if ( number > 100) {
     ellipse(10, 10, 10, 10);
     
     image(img, 0, height/2, img.width/2, img.height/2);
   //trigger AudioSample q
   }

println(in.left.level()*1); // signalvärdet *1000


}
}


Viewing all articles
Browse latest Browse all 1768

Trending Articles