We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, wouldn't someone of you know how to make those lines return back when they reach bottom? and then go again down? please
import ddf.minim.*;
import ddf.minim.signals.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
Minim minim;
AudioPlayer track;
AudioInput in;
float bpm = 80;
float mspb = 54000/bpm;
float x = 0;
float y = 0;
float x1 =0;
float x2 =0;
float y2 =0;
float y1 =0;
float R_x =0;
float R_y =0;
float line_height = 1;
int time = 0;
void setup()
{
fullScreen(P2D);
background(255);
strokeWeight(0);
frameRate(20);
smooth();
minim = new Minim(this);
track = minim.loadFile("alno.mp3", 2048);
in = minim.getLineIn(Minim.STEREO, 1024);
track.loop();
}
void draw() {
int lapse = millis();
for (int i = 0; i < track.left.size()-1; i++) {
x1 = x;
x2 = x;
y1 = track.left.get(i);
y2 = track.left.get(i+1);
fill(0,abs(track.left.get(i))*255);
noStroke();
ellipse(x, y,lapse % abs(track.left.get(i))*10,lapse % abs(track.left.get(i))*10);
x+=abs(track.left.get(i)+7);
}
if (lapse > mspb || x > width ) {
time = millis();
y += 6;
x = 0;
if (y > height){
y = 0;
}
}
}
void stop(){
track.close();
minim.stop();
super.stop();
}