net.beadsproject.beads.analysis.featureextractors
Class PeakDetector

java.lang.Object
  extended by net.beadsproject.beads.core.Bead
      extended by net.beadsproject.beads.analysis.FeatureExtractor<float[],float[]>
          extended by net.beadsproject.beads.analysis.featureextractors.PeakDetector

public class PeakDetector
extends FeatureExtractor<float[],float[]>

Detects Peaks/Onsets in input. It updates listeners when peaks in energy are detected Assumes input is a 1 element array (i.e., a single value)

Author:
ben

Field Summary
protected  java.util.ArrayList<FeatureExtractor<?,float[]>> listeners
           
 
Fields inherited from class net.beadsproject.beads.analysis.FeatureExtractor
featureDescriptions, features, name, numFeatures
 
Constructor Summary
PeakDetector()
           
 
Method Summary
 void addListener(FeatureExtractor<?,float[]> fe)
          Adds a FeatureExtractor as a listener.
 void process(float[] input)
          process: assumes input is a 1 element array
 void setFilter(Buffer b)
          Sets the window for the FIR filter.
 void setThreshold(float thresh)
           
 void useMeanFilterOfSize(int m)
          Tell the Peak Detector to use a moving average filter of a certain size.
 
Methods inherited from class net.beadsproject.beads.analysis.FeatureExtractor
getFeatureDescriptions, getFeatures, getName, getNumberOfFeatures, setName, setNumberOfFeatures
 
Methods inherited from class net.beadsproject.beads.core.Bead
getKillListener, isDeleted, isPaused, kill, message, messageReceived, pause, setKillListener, start, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

listeners

protected java.util.ArrayList<FeatureExtractor<?,float[]>> listeners
Constructor Detail

PeakDetector

public PeakDetector()
Method Detail

useMeanFilterOfSize

public void useMeanFilterOfSize(int m)
Tell the Peak Detector to use a moving average filter of a certain size.

Parameters:
m - Size of the filter. Larger = Smoother. M must be greater than 3.

setThreshold

public void setThreshold(float thresh)

setFilter

public void setFilter(Buffer b)
Sets the window for the FIR filter.

Parameters:
b -

process

public void process(float[] input)
process: assumes input is a 1 element array

Specified by:
process in class FeatureExtractor<float[],float[]>
Parameters:
input - the data.

addListener

public void addListener(FeatureExtractor<?,float[]> fe)
Adds a FeatureExtractor as a listener.

Parameters:
the - FeatureExtractor.