Class BeatDetector

java.lang.Object
processing.sound.Analyzer
processing.sound.BeatDetector

public class BeatDetector extends Analyzer
The BeatDetector analyzer looks for spikes in the energy of an audio signal which are often associated with rhythmic musical beats and can be used to trigger a response whenever the incoming audio signal pulses. Note that this implementation does not return a tempo or BPM (beats per minute) value — it can only tell you whether the current moment of audio contains a beat or not.
  • Constructor Details

    • BeatDetector

      public BeatDetector(PApplet parent)
      Parameters:
      parent - Typically "this"
  • Method Details

    • isBeat

      public boolean isBeat()
      Returns true if the current moment of the audio signal contains a beat, false otherwise.
      A "beat" is defined as a spike in the energy of the audio signal - it may or may not coincide exactly with a musical beat.
    • sensitivity

      public void sensitivity(int sensitivity)
      Sets the sensitivity, in milliseconds, of the beat detection algorithm. The sensitivity determines how long the detector will wait after detecting a beat to detect the next one. For example, a sensitivity of 10 will cause the detector to wait 10ms before returning any new beats. A higher sensitivity value means the algorithm will be less sensitive. You can tune this appropriately if you notice the detector returning too many false positive beats.
      Parameters:
      sensitivity - Sensitivity in milliseconds. Must be a positive number.
    • sensitivity

      public int sensitivity()
      Sets the sensitivity of the beat detector.
      Returns:
      The sensitivity in milliseconds.
    • getEnergyBuffer

      public double[] getEnergyBuffer()
    • getEnergyCursor

      public int getEnergyCursor()
    • getBeatBuffer

      public boolean[] getBeatBuffer()