comirva.audio.feature
Class SpectralPatternCent

java.lang.Object
  extended by comirva.audio.feature.Attribute
      extended by comirva.audio.feature.AudioFeature
          extended by comirva.audio.feature.SpectralPatternCent
All Implemented Interfaces:
XMLSerializable, Serializable

public class SpectralPatternCent
extends AudioFeature
implements XMLSerializable, Serializable

Fluctuation Pattern

Description:

The Fluctuation Pattern is an audio feature trying to describe the rhythmic structure of a song. This is done by summarizing the loudness changes in various frequency bands according to the cent scale.

See Also:
FluctuationPatternExtractor, Serialized Form

Field Summary
protected  Matrix m
           
 
Constructor Summary
protected SpectralPatternCent()
          Used for XML Serialization only.
  SpectralPatternCent(Matrix m)
          A matrix describing the rhythmic structure of a song in various frequency bands known as fluctuation patterns.
 
Method Summary
 double[] getAsArray()
          Returns the fluctuation pattern matrix as a double array.
 double getDistance(AudioFeature f)
          Computes the distance between two fluctuation patterns representing two songs.
 Matrix getMatrix()
          Returns the fluctuation pattern matrix.
 double[][] getMatrixAsArray()
          Returns the fluctuation pattern matrix as a matrix array.
 void readXML(XMLStreamReader parser)
          Reads the xml representation of an object form the xml input stream.
 void writeXML(XMLStreamWriter writer)
          Writes the xml representation of this object to the xml output stream.
 
Methods inherited from class comirva.audio.feature.Attribute
getClassName, getType, readAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m

protected Matrix m
Constructor Detail

SpectralPatternCent

public SpectralPatternCent(Matrix m)
A matrix describing the rhythmic structure of a song in various frequency bands known as fluctuation patterns.

Parameters:
m - Matrix the fluctuation pattern matrix

SpectralPatternCent

protected SpectralPatternCent()
Used for XML Serialization only.

Method Detail

getMatrix

public Matrix getMatrix()
Returns the fluctuation pattern matrix.

Returns:
Matrix the fluctuation pattern matrix

getAsArray

public double[] getAsArray()
Returns the fluctuation pattern matrix as a double array.

Specified by:
getAsArray in class AudioFeature
Returns:
double[] the fluctuation pattern matrix, row packed

getMatrixAsArray

public double[][] getMatrixAsArray()
Returns the fluctuation pattern matrix as a matrix array.

Returns:
double[][] the fluctuation pattern matrix

getDistance

public double getDistance(AudioFeature f)
                   throws ClassCastException
Computes the distance between two fluctuation patterns representing two songs. This is done by computing the euclidian distance of the two fluctuation pattern matrices.

Specified by:
getDistance in class AudioFeature
Parameters:
f - AudioFeature another fluctuation pattern feature
Returns:
double the euclidian distance between two fluctuation pattern matrices
Throws:
ClassCastException - if the passed AudioFeature is not an object of type FluctuationPattern

writeXML

public void writeXML(XMLStreamWriter writer)
              throws IOException,
                     XMLStreamException
Writes the xml representation of this object to the xml output stream.

There is the convention, that each call to a writeXML() method results in one xml element in the output stream.

Specified by:
writeXML in interface XMLSerializable
Parameters:
writer - XMLStreamWriter the xml output stream
Throws:
IOException - raised, if there are any io troubles
XMLStreamException - raised, if there are any parsing errors

readXML

public void readXML(XMLStreamReader parser)
             throws IOException,
                    XMLStreamException
Reads the xml representation of an object form the xml input stream.

There is the convention, that readXML() starts parsing by checking the start tag of this object and finishes parsing by checking the end tag. The caller has to ensure, that at method entry the current token is the start tag. After the method call it's the callers responsibility to move from the end tag to the next token.

Specified by:
readXML in interface XMLSerializable
Parameters:
parser - XMLStreamReader the xml input stream
Throws:
IOException - raised, if there are any io troubles
XMLStreamException - raised, if there are any parsing errors