net.beadsproject.beads.analysis.featureextractors
Class SpectralCentroid
java.lang.Object
net.beadsproject.beads.core.Bead
net.beadsproject.beads.analysis.FeatureExtractor<java.lang.Float,float[]>
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.
Constructor Summary |
SpectralCentroid(float sampleRate)
Instantiates a new SpectralCentroid. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
SpectralCentroid
public SpectralCentroid(float sampleRate)
- Instantiates a new SpectralCentroid.
- Parameters:
sampleRate
- the sample rate in samples per second.
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.