be.hogent.tarsos.dsp.util
Class PeakPicker

java.lang.Object
  extended by be.hogent.tarsos.dsp.util.PeakPicker

public class PeakPicker
extends java.lang.Object

Implements a moving mean adaptive threshold peak picker. The implementation is a translation of peakpicker.c from Aubio, Copyright (C) 2003-2009 Paul Brossier

Author:
Joren Six

Constructor Summary
PeakPicker(double threshold)
          Initializes a new moving mean adaptive threshold peak picker.
 
Method Summary
 float getLastPeekValue()
           
 boolean pickPeak(float onset)
          Modified version for real time, moving mean adaptive threshold this method is slightly more permissive than the off-line one, and yields to an increase of false positives.
 void setThreshold(double threshold)
          Sets a new threshold.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PeakPicker

public PeakPicker(double threshold)
Initializes a new moving mean adaptive threshold peak picker.

Parameters:
threshold - The threshold defines when a peak is selected. It should be between zero and one, 0.3 is a reasonable value. If too many peaks are detected go to 0.5 - 0.8.
Method Detail

setThreshold

public void setThreshold(double threshold)
Sets a new threshold.

Parameters:
threshold - The threshold defines when a peak is selected. It should be between zero and one, 0.3 is a reasonable value. If too many peaks are detected go to 0.5 - 0.8.

pickPeak

public boolean pickPeak(float onset)
Modified version for real time, moving mean adaptive threshold this method is slightly more permissive than the off-line one, and yields to an increase of false positives.

Parameters:
onset - The new onset value.
Returns:
True if a peak is detected, false otherwise.

getLastPeekValue

public float getLastPeekValue()
Returns:
The value of the last detected peak, or zero.