net.beadsproject.beads.analysis.featureextractors
Class SpectralPeaks

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.SpectralPeaks

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

Peaks finds the strongest N peaks in a signal passed from a PowerSpectrum, where N is the specified number of features. Peaks must be set as a listener to a PowerSpectrum object to work properly. Its output is an array of [frequency, power] tuples.


Field Summary
 
Fields inherited from class net.beadsproject.beads.analysis.FeatureExtractor
featureDescriptions, features, name, numFeatures
 
Constructor Summary
SpectralPeaks(AudioContext context)
          Instantiates a new Peaks.
SpectralPeaks(AudioContext context, int numFeatures)
          Instantiates a new Peaks with the given number of features.
 
Method Summary
 float[][] getFeatures()
          Gets the current features of type R, specified in the class def.
 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, getName, getNumberOfFeatures, 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

SpectralPeaks

public SpectralPeaks(AudioContext context)
Instantiates a new Peaks.

Parameters:
context - the AudioContext.

SpectralPeaks

public SpectralPeaks(AudioContext context,
                     int numFeatures)
Instantiates a new Peaks with the given number of features.

Parameters:
context - the AudioContext.
numFeatures - the number of features.
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<float[][],float[]>
powerSpectrum - the data.

getFeatures

public float[][] getFeatures()
Description copied from class: FeatureExtractor
Gets the current features of type R, specified in the class def.

Overrides:
getFeatures in class FeatureExtractor<float[][],float[]>
Returns:
the features.

setNumberOfFeatures

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

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