public class SpectralPeaks extends FeatureExtractor<float[][],float[]>
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.featureDescriptions, features, name, numFeatures| Constructor and Description |
|---|
SpectralPeaks(AudioContext context)
Instantiates a new Peaks.
|
SpectralPeaks(AudioContext context,
int numFeatures)
Instantiates a new Peaks with the given number of features.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
addListener, forward, getFeatureDescriptions, getName, getNumberOfFeatures, removeListener, setNamegetKillListener, isDeleted, isPaused, kill, message, messageReceived, pause, setKillListener, start, toStringpublic SpectralPeaks(AudioContext context)
context - the AudioContext.public SpectralPeaks(AudioContext context, int numFeatures)
context - the AudioContext.numFeatures - the number of features.public void process(TimeStamp startTime, TimeStamp endTime, float[] powerSpectrum)
FeatureExtractorprocess in class FeatureExtractor<float[][],float[]>powerSpectrum - the data.public float[][] getFeatures()
FeatureExtractorgetFeatures in class FeatureExtractor<float[][],float[]>public void setNumberOfFeatures(int numFeatures)
FeatureExtractorsetNumberOfFeatures in class FeatureExtractor<float[][],float[]>numFeatures - the new number of features.