package src.audio;
public class Beat {

  private float dst = 0.0f;
  private float[] beats = null;
  private int currBeat = 0;

  public Beat(float[] beats) {
    this.beats = beats;
  }

  public boolean detect(float pos) {
    pos /= 1000.0f;
    float beatTime = this.beats[currBeat];
    this.dst = Math.abs(pos - beatTime);

    /* Beat Detected */
    if (dst < 0.9) {
      System.out.println(beatTime);
      currBeat++; 
      return true;
    } 

    /* Missed Beat */
    if (pos > beatTime) {
      System.out.println("Missing " + beatTime);
      currBeat++; 
      return false;
    }

    return false;
  }
}

@@ -12,16 +12,45 @@
 .audio;%0A
+import java.util.ArrayList;%0A%0A
 public c
@@ -100,23 +100,32 @@
 private 
-f
+ArrayList%3CF
 loat
-%5B%5D
+%3E
  beats =
@@ -178,15 +178,24 @@
 eat(
-f
+ArrayList%3CF
 loat
-%5B%5D
+%3E
  bea
@@ -286,16 +286,76 @@
 000.0f;%0A
+    if (currBeat %3E= this.beats.size())%0A       return false;%0A
     floa
@@ -381,17 +381,21 @@
 eats
-%5B
+.get(
 currBeat
 %5D;%0A 
@@ -394,9 +394,9 @@
 Beat
-%5D
+)
 ;%0A  

switch from float[] to ArrayList<Float>