waveforms question
in
Core Library Questions
•
2 years ago
How do i get the waveforms to go all the way across the screen? Why are they only going across half of the screen?
Here is the code:
import ddf.minim.*;
Minim minim;
AudioInput in;
void setup()
{
size(1050, 550, 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);
noFill();
smooth();
sum = 0;
// draw the waveforms
for(int i = 0; i < in.bufferSize() - 1; i++)
{
line(i, height/2 + in.left.get(i)*height, i+1, height/2 + in.left.get(i+1)*height);
}
}
void stop()
{
// always close Minim audio classes when you are done with them
in.close();
minim.stop();
super.stop();
}
Here is the code:
import ddf.minim.*;
Minim minim;
AudioInput in;
void setup()
{
size(1050, 550, 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);
noFill();
smooth();
sum = 0;
// draw the waveforms
for(int i = 0; i < in.bufferSize() - 1; i++)
{
line(i, height/2 + in.left.get(i)*height, i+1, height/2 + in.left.get(i+1)*height);
}
}
void stop()
{
// always close Minim audio classes when you are done with them
in.close();
minim.stop();
super.stop();
}
1