be.hogent.tarsos.dsp.pitch
Class AMDF

java.lang.Object
  extended by be.hogent.tarsos.dsp.pitch.AMDF
All Implemented Interfaces:
PitchDetector

public class AMDF
extends java.lang.Object
implements PitchDetector

A pitch extractor that extracts the Average Magnitude Difference (AMDF) from an audio buffer. This is a good measure of the Pitch (f0) of a signal.

AMDF is calculated by the the difference between the waveform summing a lagged version of itself.

The main bulk of the code is written by Eder de Souza for the jAudio framework. Adapted for TarsosDSP by Joren Six.

Author:
Eder Souza (ederwander on github), Joren Six

Constructor Summary
AMDF(float sampleRate, int bufferSize)
           
AMDF(float sampleRate, int bufferSize, double minFrequency, double maxFrequency)
           
 
Method Summary
 PitchDetectionResult getPitch(float[] audioBuffer)
          Analyzes a buffer with audio information and estimates a pitch in Hz.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AMDF

public AMDF(float sampleRate,
            int bufferSize)

AMDF

public AMDF(float sampleRate,
            int bufferSize,
            double minFrequency,
            double maxFrequency)
Method Detail

getPitch

public PitchDetectionResult getPitch(float[] audioBuffer)
Description copied from interface: PitchDetector
Analyzes a buffer with audio information and estimates a pitch in Hz. Currently this interface only allows one pitch per buffer.

Specified by:
getPitch in interface PitchDetector
Parameters:
audioBuffer - The buffer with audio information. The information in the buffer is not modified so it can be (re)used for e.g. FFT analysis.
Returns:
An estimation of the pitch in Hz or -1 if no pitch is detected or present in the buffer.