I'm working on a very bare bones oscilloscope program using the minim library:
import ddf.minim.*;
Minim minim;
AudioInput in;
color white;
void setup()
{
size(512, 100, P2D);
white = color(255);
colorMode(HSB,100);
minim = new Minim(this);
minim.debugOn();
in = minim.getLineIn(Minim.STEREO, 512);
background(0);
}
void draw()
{
background(0);
// draw the waveforms
for(int i = 0; i < in.bufferSize() - 1; i++)
{
stroke((1+in.left.get(i))*50,100,100);
line(i, 50 + in.left.get(i)*50, i, 50 + in.left.get(i+1)*50);
}
}
void stop()
{
in.close();
minim.stop();
super.stop();
}
My question is, how do I make the waveform trigger/stabilize like an actual oscilloscope? I'm trying to figure that out so I can make the waveform stay at a certain spot so it doesn't jump around. Basically keep the waveform stable at all times.
Thanks for your help.