comirva.audio.extraction
Class FluctuationPatternCentExtractor

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

public class FluctuationPatternCentExtractor
extends AudioFeatureExtractor

Title: Fluctuation Patterns

Description:

This class supports the extraction of the so-called "Fluctuation Patterns" from an audio stream. This is a advanced version based on the cent scale instead of the bark scale.

See Also:
AudioFeatureExtractor, FluctuationPattern

Field Summary
protected  int blockSize
           
protected  CentSpectrum centProcessor
           
protected  int fftSize
           
protected  int frameHop
           
protected  FFT magnitudeFFT
           
protected  NormalizedConvolution normalizedConvolution
           
protected  AudioPreProcessor preProcessor
           
protected  float sampleRate
           
 
Constructor Summary
FluctuationPatternCentExtractor()
          The default constructor uses segments of size 65536 samples.
FluctuationPatternCentExtractor(float sampleRate, int fftSize)
          Constructs an individualized FluctuationPatternExtractor.
 
Method Summary
 Attribute calculate(File input)
          This method is used to calculate the fluctuation pattern for a whole song.
 AttributeExtractor copy()
          This method returns a copy of an AttributeExtractor.
protected  Matrix createPattern(double[][] spectrum)
          Computes the fluctuation pattern for a short piece of audio.
 int getAttributeType()
          Returns the type of the attribute that the class implementing this interface will return as the result of its extraction process.
(package private)  double[][] getBlock(Vector<double[]> normalizedCentSpectrum, int start)
           
protected  Vector<Matrix> getFluctuationPatterns()
          Splits the audio stream in short segments and computes a fluctuation pattern for every third segment.
 double[] getFluxWeights()
          Returns weights for the amplitude modulation coefficients based on the psychoarcoustic model of the fluctuation strength.
static double getMedian(double[] array)
          Computes the median of all the elements in the array.
 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

frameHop

protected int frameHop

blockSize

protected int blockSize

fftSize

protected int fftSize

sampleRate

protected float sampleRate

magnitudeFFT

protected FFT magnitudeFFT

centProcessor

protected CentSpectrum centProcessor

normalizedConvolution

protected NormalizedConvolution normalizedConvolution

preProcessor

protected AudioPreProcessor preProcessor
Constructor Detail

FluctuationPatternCentExtractor

public FluctuationPatternCentExtractor()
The default constructor uses segments of size 65536 samples. This corresponds to about 6 sec. of audio @11kHz.


FluctuationPatternCentExtractor

public FluctuationPatternCentExtractor(float sampleRate,
                                       int fftSize)
Constructs an individualized FluctuationPatternExtractor. The number of samples to use for a segment has to be chosen with respect to an 11kHz audio stream. An fft size of 512 is used to get the rhythmic structure out of the sone representation. This corresponds to a range of 10bpm up to 2584bpm.

Parameters:
fftSize - int number of cent values to consider
segmentSize - int number of samples a segments consists of
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 IllegalArgumentException,
                           IOException,
                           UnsupportedAudioFileException
This method is used to calculate the fluctuation pattern 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 AudioPreProcessor representing the audio input stream;
Returns:
Feature a FluctuationPattern feature is returned as a result of this feature extraction process
Throws:
IOException - if there are any problems regarding the inputstream
IllegalArgumentException - raised if method contract of a subroutine is violated
UnsupportedAudioFileException

getFluctuationPatterns

protected Vector<Matrix> getFluctuationPatterns()
                                         throws IOException,
                                                IllegalArgumentException
Splits the audio stream in short segments and computes a fluctuation pattern for every third segment. The returned Vector contains all these patterns, which altogether describe the rhythmic structure of the whole song.

Returns:
Vector a vector containing all the fluctuation patterns
Throws:
IOException - if there are any problems regarding the inputstream
IllegalArgumentException - raised if method contract of a subroutine is violated

getBlock

double[][] getBlock(Vector<double[]> normalizedCentSpectrum,
                    int start)

createPattern

protected Matrix createPattern(double[][] spectrum)
Computes the fluctuation pattern for a short piece of audio. The fluctuation pattern characterizes the rhythmic structure of the short audio segment. The input data are Sone (Specific Loudness Sensation) values.

Parameters:
sone - double[][] sone values; must not be a null value;
Returns:
Matrix fluctuation pattern

getFluxWeights

public double[] getFluxWeights()
Returns weights for the amplitude modulation coefficients based on the psychoarcoustic model of the fluctuation strength. The number of the weights depends on the base frequency. For details take a look at [1].

Returns:
double[] weights for the amplitude modulation coefficients

getMedian

public static double getMedian(double[] array)
                        throws IllegalArgumentException
Computes the median of all the elements in the array. The elements in the array are sorted after a calling this method.

Parameters:
array - double[] array of values; must not be a null value and must contain at least one element;
Returns:
double the median of all the elements of the given array
Throws:
IllegalArgumentException - raised if method contract is violated

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