comirva.audio.extraction
Class TimbreDistributionExtractor

java.lang.Object
  extended by comirva.audio.extraction.AttributeExtractor
      extended by comirva.audio.extraction.AudioFeatureExtractor
          extended by comirva.audio.extraction.TimbreDistributionExtractor

public class TimbreDistributionExtractor
extends AudioFeatureExtractor

Timbre Distribution Extractor

Description:

This class supports the extraction of the "Timbre Distribution" summarizing the timbre of an audio stream.

This is done by computing the MFCC for each audio frame(usually between 20ms and 50ms and a 50% overlap). The MFCCs are known to somehow characterize the timbre of such a short audio frame. Then one estimates the distribution of the MFCC vectors using a Gaussian Mixture Model.

The resulting distribution is a model of the song's overall timbre and can be compared to other timbre models. [1] Aucouturier, Pachet, "Improving Timbre Similarity: How high's the sky?" Journal of Negative Results in Speech and Audio Sciences, 1(1), 2004.

See Also:
GaussianMixture, MFCC, TimbreDistribution

Field Summary
 int DEFAULT_NUMBER_COMPONENTS
           
protected  MFCC mfcc
           
 int minimumStreamLength
           
protected  int numberGaussianComponents
           
protected  AudioPreProcessor preProcessor
           
protected  float sampleRate
           
 int skipFinalSeconds
           
 int skipIntroSeconds
           
 
Constructor Summary
TimbreDistributionExtractor()
          The default constructor uses 3 gaussian components for modeling the timbre distribution.
TimbreDistributionExtractor(float sampleRate, int numberGaussianComponents, int skipIntro, int skipEnd, int minimumLength)
          This constructor in contrast to the default constructor allows to specify the number of gaussian components used for modeling the timbre distribution.
 
Method Summary
 Attribute calculate(File input)
          This method is used to calculate the timbre distribution for a whole song.
 AttributeExtractor copy()
          This method returns a copy of an AttributeExtractor.
 int getAttributeType()
          Returns the type of the attribute that the class implementing this interface will return as the result of its extraction process.
 String toString()
          Returns the feature extractors name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_NUMBER_COMPONENTS

public int DEFAULT_NUMBER_COMPONENTS

skipIntroSeconds

public int skipIntroSeconds

skipFinalSeconds

public int skipFinalSeconds

minimumStreamLength

public int minimumStreamLength

preProcessor

protected AudioPreProcessor preProcessor

mfcc

protected MFCC mfcc

numberGaussianComponents

protected int numberGaussianComponents

sampleRate

protected float sampleRate
Constructor Detail

TimbreDistributionExtractor

public TimbreDistributionExtractor()
The default constructor uses 3 gaussian components for modeling the timbre distribution. For more details on the default MFCC computation take a look at the MFCC documentation. The AudioPreProcessors default sample rate is used.

See Also:
MFCC, AudioPreProcessor

TimbreDistributionExtractor

public TimbreDistributionExtractor(float sampleRate,
                                   int numberGaussianComponents,
                                   int skipIntro,
                                   int skipEnd,
                                   int minimumLength)
This constructor in contrast to the default constructor allows to specify the number of gaussian components used for modeling the timbre distribution.

Parameters:
numberGaussianComponents - int number of gaussian components
skipIntro - int number of seconds to skip at the beginning of the song
skipEnd - int number of seconds to skip at the end of the song
minimumLength - int minimum length required for processing
Method Detail

copy

public AttributeExtractor copy()
Description copied from class: AttributeExtractor
This method returns a copy of an AttributeExtractor. This is useful to use multiple extractors in parallel or distributed environments as AttributeExtractors can be stateful.

Specified by:
copy in class AttributeExtractor
Returns:

calculate

public Attribute calculate(File input)
                    throws IOException,
                           IllegalArgumentException,
                           UnsupportedAudioFileException
This method is used to calculate the timbre distribution for a whole song. The song must be handed to this method as an AudioPreProcessor object. All settings are set by the constructor, so this method can easily be called for a large number of songs to extract this feature.

Specified by:
calculate in class AttributeExtractor
Parameters:
input - Object an object representing the input data to extract the feature out of
Returns:
Feature a feature extracted from the input data
Throws:
IOException - failures due to io operations are signaled by IOExceptions
IllegalArgumentException - raised if method contract is violated, especially if the open input type is not of the expected type
UnsupportedAudioFileException

getAttributeType

public int getAttributeType()
Returns the type of the attribute that the class implementing this interface will return as the result of its extraction process. By definition this is the hash code of the attribute's class name.

Specified by:
getAttributeType in class AttributeExtractor
Returns:
int an integer uniquely identifying the returned Attribute

toString

public String toString()
Returns the feature extractors name.

Overrides:
toString in class Object
Returns:
String name of this feature extractor