Hi Everyone,
I'm completely new to this, so apologies if it's in the wrong place.
I'm trying to display an image based on an audio input ie < than
If a certain threshold is reached I want one image to display. If the sound levels drop I want the image to disappear.
I don't know how to write the function which declares when to load the image? Or to be honest where to put it in the sketch
Thanks, I appreciate your help.
Here is what I have so far using GetLineIn and loadimage
import ddf.minim.*;
Minim minim;
AudioInput in;
PImage a; // Declare variable "a" of type PImage
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);
size(200, 200);
// The file "jelly.jpg" must be in the data folder
// of the current sketch to load successfully
a = loadImage("jelly.jpg"); // Load the image into the program
noLoop(); // Makes draw() only run once
}
void draw()
{
// Displays the image at its actual size at point (0,0)
image(a, 0, 0);
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);
// Displays the image at its actual size at point (0,0)
image(a, 0, 0);
}
}
void stop()
{
// always close Minim audio classes when you are done with them
in.close();
minim.stop();
super.stop();
}
I'm completely new to this, so apologies if it's in the wrong place.
I'm trying to display an image based on an audio input ie < than
If a certain threshold is reached I want one image to display. If the sound levels drop I want the image to disappear.
I don't know how to write the function which declares when to load the image? Or to be honest where to put it in the sketch
Thanks, I appreciate your help.
Here is what I have so far using GetLineIn and loadimage
import ddf.minim.*;
Minim minim;
AudioInput in;
PImage a; // Declare variable "a" of type PImage
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);
size(200, 200);
// The file "jelly.jpg" must be in the data folder
// of the current sketch to load successfully
a = loadImage("jelly.jpg"); // Load the image into the program
noLoop(); // Makes draw() only run once
}
void draw()
{
// Displays the image at its actual size at point (0,0)
image(a, 0, 0);
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);
// Displays the image at its actual size at point (0,0)
image(a, 0, 0);
}
}
void stop()
{
// always close Minim audio classes when you are done with them
in.close();
minim.stop();
super.stop();
}
2