Class PitchDetector

java.lang.Object
processing.sound.Analyzer
processing.sound.PitchDetector

public class PitchDetector extends Analyzer
Detects the pitch (also known as the 'fundamental frequency') of a sound signal. For complex signals this is not a trivial task, so the analyzer only returns a frequency measurement (measured in Hertz) when its measurement exceeds a 'confidence level' that can be specified by the user.
  • Constructor Details

    • PitchDetector

      public PitchDetector(PApplet parent, float minimumConfidence)
      Parameters:
      parent - typically "this"
      minimumConfidence - the minimum confidence level required for frequency measurements, between 0.0 (accept all measurements, no matter how unreliable) to 1.0 (only accept perfect measurements). Defaults to 0.8.
    • PitchDetector

      public PitchDetector(PApplet parent)
  • Method Details

    • analyze

      public float analyze()
    • analyze

      public float analyze(float minimumConfidence)
      Returns an estimate of the current pitch (or 'fundamental frequency') of the input sound signal, in Hertz. If the confidence in the current measurement does not exceed the minimum confidence, this method returns 0.0.
      Parameters:
      minimumConfidence - the minimum confidence level required for frequency measurements, between 0 (accept all measurements, no matter how unreliable) to 1 (only accept perfect measurements). If omitted, uses the confidence level specified when this PitchDetector was created.
      target - a float array of length 2 that will be filled with the frequency and confidence in that frequency measurement
    • analyze

      public float analyze(float[] target)