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.

54 lines
830 B

5 years ago
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;
boolean[][] samples;
void setup() {
size(640, 360);
background(255);
loadData();
}
void draw() {
background(255);
stroke(255);
for(int i=0; i<numSounds; i++) {
fill(90);
for(int y=0; y<divider; y++) {
rect((width/divider)*y,(height/numSounds)*i, width/divider, height/numSounds);
}
}
for(int i=0; i<numSounds; i++) {
fill(150);
if(samples[i][beat]) {
fill(0, 200, 0);
file[i].stop();
file[i].play();
}
rect((width/divider)*beat,(height/numSounds)*i, width/divider, height/numSounds);
}
beat++;
if(beat>=divider){beat=0;}
delay(duration);
}