ChimneyFish_xmas_lights_sound/BeatListener.pde
class BeatListener implements AudioListener {
  private BeatDetect beat;
  private AudioPlayer source;

  BeatListener(BeatDetect beat, AudioPlayer source) {
    this.source = source;
    this.source.addListener(this);
    this.beat = beat;
  }

  void samples(float[] samps) {
    beat.detect(source.mix);
  }

  void samples(float[] sampsL, float[] sampsR) {
    beat.detect(source.mix);
  }

  void onset(int time, int val) {
    // Add conditions to trigger actions based on onset values at specific indices
    if (time == 2 && val > 100) {
      // Trigger an action for onset at index 2 with a threshold value of 100
      // Example: arduino.digitalWrite(ledPin11, Arduino.HIGH);
    } else if (time == 4 && val > 100) {
      // Trigger an action for onset at index 4 with a threshold value of 100
      // Example: arduino.digitalWrite(ledPin9, Arduino.HIGH);
    }
    // Add more conditions as needed
  }
}
