|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jAudioFeatureExtractor.AudioFeatures.FeatureExtractor
public abstract class FeatureExtractor
The prototype for feature extractors. Each class that extends this class will extract a particular feature from a window of audio samples. Such classes do not store feature values, only extract them.
Classes that extend this class should have a constructor that sets the three protected fields of this class.
Daniel McEnnis 05-07-05 Added code to allow generic access to feature attributes
Daniel McEnnis 05-08-05 Added setWindow and setParent features following the composite pattern for new features.
Field Summary | |
---|---|
protected FeatureDefinition |
definition
Meta-data describing a feature. |
protected java.lang.String[] |
dependencies
The names of other features that are needed in order for a feature to be calculated. |
protected int[] |
offsets
The offset in windows of each of the features named in the dependencies field. |
protected DataModel |
parent
If a feature alters its number of dimensions, it needs to be able to notify the holding object that a visible change has occured. |
Constructor Summary | |
---|---|
FeatureExtractor()
|
Method Summary | |
---|---|
abstract java.lang.Object |
clone()
Create an identical copy of this feature. |
abstract double[] |
extractFeature(double[] samples,
double sampling_rate,
double[][] other_feature_values)
The prototype function that classes extending this class will override in order to extract their feature from a window of audio. |
java.lang.String[] |
getDepenedencies()
Returns the names of other features that are needed in order to extract this feature. |
int[] |
getDepenedencyOffsets()
Returns the offsets of other features that are needed in order to extract this feature. |
java.lang.String |
getElement(int index)
Function permitting an unintelligent outside function (ie. |
FeatureDefinition |
getFeatureDefinition()
Returns meta-data describing this feature. |
void |
setElement(int index,
java.lang.String value)
Function permitting an unintelligent outside function (ie. |
void |
setParent(DataModel parent)
Gives features a reference to the container frame to notify it that features have changed state and need to be redrawn. |
void |
setWindow(int windowSize)
Function that must be overridden to allow this feature to be set globally by GlobalChange frame. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected FeatureDefinition definition
protected java.lang.String[] dependencies
protected int[] offsets
protected DataModel parent
Constructor Detail |
---|
public FeatureExtractor()
Method Detail |
---|
public FeatureDefinition getFeatureDefinition()
IMPORTANT: Note that a value of 0 in the returned dimensions of the FeatureDefinition implies that the feature dimensions are variable, and depend on the analyzed data.
public java.lang.String[] getDepenedencies()
public int[] getDepenedencyOffsets()
The offset is in windows, and the indice of the retuned array corresponds to the indice of the array returned by the getDependencies method. An offset of -1, for example, means that the feature returned by getDependencies with the same indice should be provided to this class's extractFeature method with a value that corresponds to the window prior to the window corresponding to this feature.
public abstract double[] extractFeature(double[] samples, double sampling_rate, double[][] other_feature_values) throws java.lang.Exception
samples
- The samples to extract the feature from.sampling_rate
- The sampling rate that the samples are encoded with.other_feature_values
- The values of other features that are needed to calculate this
value. The order and offsets of these features must be the
same as those returned by this class's getDependencies and
getDependencyOffsets methods respectively. The first indice
indicates the feature/window and the second indicates the
value.
java.lang.Exception
- Throws an informative exception if the feature cannot be
calculated.public java.lang.String getElement(int index) throws java.lang.Exception
index
- which of AreaMoment's attributes should be edited.
java.lang.Exception
public void setElement(int index, java.lang.String value) throws java.lang.Exception
index
- attribute to be setvalue
- new value of the attribute
java.lang.Exception
public void setWindow(int windowSize) throws java.lang.Exception
windowSize
- the number of windows of offset to be used in calculating this
feature
java.lang.Exception
public void setParent(DataModel parent)
parent
- container frame which holds the model for displaying features
in the feature display panel.public abstract java.lang.Object clone()
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |