net.beadsproject.beads.analysis.featureextractors
Class SpectralCentroid

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

public class SpectralCentroid
extends FeatureExtractor<java.lang.Float,float[]>

SpectralCentroid calculates the spectral centroid of a signal. It should be set up to listen to a PowerSpectrum object.


Field Summary
 
Fields inherited from class net.beadsproject.beads.analysis.FeatureExtractor
featureDescriptions, features, name, numFeatures
 
Constructor Summary
SpectralCentroid(float sampleRate)
          Instantiates a new SpectralCentroid.
 
Method Summary
 int getNumberOfFeatures()
          Gets the number of features.
 void process(TimeStamp startTime, TimeStamp endTime, float[] powerSpectrum)
          Process some data of type P (specified by the class def).
 void setNumberOfFeatures(int numFeatures)
          Sets the number of features.
 
Methods inherited from class net.beadsproject.beads.analysis.FeatureExtractor
addListener, forward, getFeatureDescriptions, getFeatures, getName, removeListener, setName
 
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
 

Constructor Detail

SpectralCentroid

public SpectralCentroid(float sampleRate)
Instantiates a new SpectralCentroid.

Parameters:
sampleRate - the sample rate in samples per second.
Method Detail

process

public void process(TimeStamp startTime,
                    TimeStamp endTime,
                    float[] powerSpectrum)
Description copied from class: FeatureExtractor
Process some data of type P (specified by the class def). This method must be overidden by implementing classes.

Specified by:
process in class FeatureExtractor<java.lang.Float,float[]>
powerSpectrum - the data.

getNumberOfFeatures

public int getNumberOfFeatures()
Description copied from class: FeatureExtractor
Gets the number of features.

Overrides:
getNumberOfFeatures in class FeatureExtractor<java.lang.Float,float[]>
Returns:
the number of features.

setNumberOfFeatures

public void setNumberOfFeatures(int numFeatures)
Description copied from class: FeatureExtractor
Sets the number of features.

Overrides:
setNumberOfFeatures in class FeatureExtractor<java.lang.Float,float[]>
Parameters:
numFeatures - the new number of features.