comirva.audio.feature
Class TimbreDistribution

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

public class TimbreDistribution
extends AudioFeature
implements XMLSerializable, Serializable

Timbre Distribution

Description:

Represents a similarity measure based on the song's timbre. The distribution of the MFCCs of a song is used to summarize the song. Songs having similar distributions are consider similar.

See Also:
TimbreDistributionExtractor, Serialized Form

Constructor Summary
protected TimbreDistribution()
          Used for xml serialization only.
  TimbreDistribution(GaussianMixture gmm)
          Constructs a TimbreDistribution feature.
 
Method Summary
 double[] getAsArray()
          Returns a vector representation of each feature.
 double getDistance(AudioFeature f)
          Computes the distance between two timbre distributions representing two songs.
 GaussianMixture getGaussianMixtureModel()
          For testing purpose only.
 double getLogLikelihood()
          Returns the log likelihood for the own samples points, which have been drawn from the gmm representing the song.
 double getLogLikelihood(PointList samplePoints)
          Returns the log likelihood for a given sample set.
 PointList getSamplePoints()
          Returns a list of samples drawn from the gmm representing this song.
 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 ouput 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
 

Constructor Detail

TimbreDistribution

public TimbreDistribution(GaussianMixture gmm)
Constructs a TimbreDistribution feature.

Parameters:
gmm - GaussianMixture the gmm summarizing the song

TimbreDistribution

protected TimbreDistribution()
Used for xml serialization only.

Method Detail

getLogLikelihood

public double getLogLikelihood(PointList samplePoints)
Returns the log likelihood for a given sample set.

Parameters:
samplePoints - PointList sample set
Returns:
double log likelihood

getLogLikelihood

public double getLogLikelihood()
Returns the log likelihood for the own samples points, which have been drawn from the gmm representing the song.

Returns:
double the log likelihood of the own samples

getAsArray

public double[] getAsArray()
Returns a vector representation of each feature.

Specified by:
getAsArray in class AudioFeature
Returns:

getSamplePoints

public PointList getSamplePoints()
Returns a list of samples drawn from the gmm representing this song.

Returns:
PointList list of samples

getDistance

public double getDistance(AudioFeature f)
                   throws ClassCastException
Computes the distance between two timbre distributions representing two songs. This is done by mutually computing the log likelihood of drawn samples.

Specified by:
getDistance in class AudioFeature
Parameters:
f - AudioFeature another timbre distribution feature
Returns:
double the distance between the two timbre distributions
Throws:
ClassCastException - thrown if the passed AudioFeature is not an object of type TimbreDistribution

getGaussianMixtureModel

public GaussianMixture getGaussianMixtureModel()
For testing purpose only.

Returns:
GaussianMixture the gmm

writeXML

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

There is the convetion, 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