You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import processing.sound.*;
|
|
|
|
|
|
|
|
SoundFile[] file;
|
|
|
|
|
|
|
|
// Initialize data
|
|
|
|
int numSounds = 0;
|
|
|
|
int numTracks = 0;
|
|
|
|
int bpm = 0;
|
|
|
|
int divider = 0;
|
|
|
|
int duration = 0;
|
|
|
|
int beat = 0;
|
|
|
|
|
|
|
|
int[][] samples;
|
|
|
|
|
|
|
|
void setup() {
|
|
|
|
size(640, 360);
|
|
|
|
background(255);
|
|
|
|
|
|
|
|
loadData();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void draw() {
|
|
|
|
background(255);
|
|
|
|
stroke(255);
|
|
|
|
|
|
|
|
for(int i=0; i<4; i++) {
|
|
|
|
fill(90);
|
|
|
|
for(int y=0; y<divider; y++) {
|
|
|
|
rect((width/divider)*y,(height/4)*i, width/divider, height/4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(int i=0; i<4; i++) {
|
|
|
|
|
|
|
|
fill(150);
|
|
|
|
if(samples[i][beat] != 0) {
|
|
|
|
fill(0, 200, 0);
|
|
|
|
file[samples[i][beat]].stop();
|
|
|
|
file[samples[i][beat]].play();
|
|
|
|
}
|
|
|
|
rect((width/divider)*beat,(height/4)*i, width/divider, height/4);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
beat++;
|
|
|
|
if(beat>=divider){beat=0;}
|
|
|
|
|
|
|
|
delay(duration);
|
|
|
|
|
|
|
|
}
|