net.beadsproject.beads.analysis.featureextractors
Class SpectralDifference

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

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

SpectralDifference calculates the spectral difference between one frame and the next.


Nested Class Summary
static class SpectralDifference.DifferenceType
           
 
Field Summary
 
Fields inherited from class net.beadsproject.beads.analysis.FeatureExtractor
featureDescriptions, features, name, numFeatures
 
Constructor Summary
SpectralDifference(float samplerate)
          Create a spectral difference feature extractor of the entire spectrum.
SpectralDifference(float samplerate, float minf, float maxf)
          Create a spectral difference feature extractor with a specific frequency window.
 
Method Summary
 void process(TimeStamp startTime, TimeStamp endTime, float[] spectrum)
          Process some data of type P (specified by the class def).
 void setDifferenceType(SpectralDifference.DifferenceType dt)
           
 void setFreqWindow(float minf, float maxf)
          Specify a window of the spectrum to analyse.
 
Methods inherited from class net.beadsproject.beads.analysis.FeatureExtractor
addListener, forward, getFeatureDescriptions, getFeatures, getName, getNumberOfFeatures, removeListener, 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
 

Constructor Detail

SpectralDifference

public SpectralDifference(float samplerate)
Create a spectral difference feature extractor of the entire spectrum.

Parameters:
samplerate - The sample rate of the AudioContext

SpectralDifference

public SpectralDifference(float samplerate,
                          float minf,
                          float maxf)
Create a spectral difference feature extractor with a specific frequency window.

Parameters:
samplerate - The sample rate of the AudioContext
minf - The lower frequency of the window
maxf - The upper frequency of the window
Method Detail

setFreqWindow

public void setFreqWindow(float minf,
                          float maxf)
Specify a window of the spectrum to analyse. By default the entire spectrum is analysed.

Parameters:
minf - The lower frequency
maxf - The upper frequency

setDifferenceType

public void setDifferenceType(SpectralDifference.DifferenceType dt)

process

public void process(TimeStamp startTime,
                    TimeStamp endTime,
                    float[] spectrum)
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[]>
spectrum - the data.