import processing.sound.*; SoundFile[] file; // Define the number of samples int numsounds = 5; int bpm = 280; int divider = 16; int duration = int((60/float(bpm))*1000); int beat = 0; int[][] samples = { {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} }; void setup() { size(640, 360); background(255); // Load sound files file = new SoundFile[numsounds]; for (int i = 0; i < numsounds; i++) { file[i] = new SoundFile(this, "bank1/" + (i+3) + ".wav"); } } void draw() { background(255); stroke(255); for(int i=0; i<4; i++) { fill(90); for(int y=0; y=divider){beat=0;} delay(duration); }