SpectralODF Class Reference

Algorithm to perform onset detection functions on vectors of Complex values representing the FFT of a signal. More...

#include <SpectralODF.h>

Inherits SpectralODFBase.

List of all members.

Public Types

enum  ODFMethod {
  FLUX = 0, HIGH_FREQUENCY_CONTENT = 1, PHASE_DEVIATION = 2, WEIGHTED_PHASE_DEVIATION = 3,
  NORM_WEIGHTED_PHASE_DEVIATION = 4, MODIFIED_KULLBACK_LIEBLER = 5, COMPLEX_DOMAIN = 6, RECTIFIED_COMPLEX_DOMAIN = 7,
  CENTER_OF_GRAVITY = 8
}
 Specifies the method for calculating the onset detection function to be used. More...

Public Member Functions

 SpectralODF (int fftSize=1024, ODFMethod odfMethod=COMPLEX_DOMAIN)
 ~SpectralODF ()
void process (const MatrixXC &ffts, MatrixXR *odfs)
ODFMethod odfMethod () const
void setOdfMethod (ODFMethod method, bool callSetup=true)


Detailed Description

Algorithm to perform onset detection functions on vectors of Complex values representing the FFT of a signal.

This class wraps several kind of spectral Onset Detection Functions (ODF). A spectral onset detection function is a function mapping from an FFT of an audio signal to a Real value. The onset detection function represents a value proportional to the probability of the frame being an onset.

The algorithm takes as input N-point vectors of Complex values and returns Real values.

5 types of ODF methods are implemented:

  1. Spectral flux
  2. High frequency content
  3. Phase deviation
  4. Weighted phase deviation
  5. Normalized weighted phase deviation
  6. Modified Kullback-Liebler
  7. Complex domain
  8. Rectified complex domain
  9. Peak center of gravity

The Phase deviation, Weighted phase deviation, Normalized weighted phase deviation, Complex domain and Rectified complex domain methods require the 2 past FFT frames. Therefore if any of these methods are specified, the process() method would require an input matrix of at least 3 rows and will output ODF values for all the rows but the first two.

The Spectral flux method requires the past FFT frame. Therefore if this method is used, the process() method would require an input matrix of at least 2 rows and will output ODF values for all the rows but the first.

The ODF method can be selected using the setOdfMethod() taking as argument an ODFMethod.

This function is often use to perform beat estimation and event segmentation tasks.

Author:
Ricard Marxer
See also:
FFT

Member Enumeration Documentation

enum ODFMethod

Specifies the method for calculating the onset detection function to be used.

See also:
odfMethod
Enumerator:
FLUX  Spectral flux method
HIGH_FREQUENCY_CONTENT  High frequency content method
PHASE_DEVIATION  Phase deviation method
WEIGHTED_PHASE_DEVIATION  Weighted phase deviation method
NORM_WEIGHTED_PHASE_DEVIATION  Normalized weighted phase deviation method
MODIFIED_KULLBACK_LIEBLER  Modified Kullback-Liebler method
COMPLEX_DOMAIN  Complex domain method
RECTIFIED_COMPLEX_DOMAIN  Rectified complex domain method
CENTER_OF_GRAVITY  Peak center of gravity method


Constructor & Destructor Documentation

SpectralODF ( int  fftSize = 1024,
ODFMethod  odfMethod = COMPLEX_DOMAIN 
)

Constructs a spectral onset detection function object with the specified fftSize and odfMethod settings.

Parameters:
fftSize size of the input FFT frames, must be > 0.
odfMethod the onset detection method to be used

References setOdfMethod().

~SpectralODF (  ) 

Destroys the algorithm and frees its resources.


Member Function Documentation

void process ( const MatrixXC &  ffts,
MatrixXR *  odfs 
)

Calculates the onset detection method on each of the rows of ffts and puts the resulting onset detection function values in the rows of odfs.

Parameters:
ffts matrix of Complex values. The number of columns of ffts must be equal to the fftSize / 2 + 1. Some onset detection methods require a minimum of 2 (or 3) rows to calculate the one onset detection function value. In this cases onset detection values for the first 2 (or 3 respectively) rows will not be output.
odfs pointer to a single-column matrix of Real values for the output. The matrix should have the same number of rows as ffts (minus 1 or 2 depending on the method used) and 1 single column.
Note that if the output matrix is not of the required size it will be resized, reallocating a new memory space if necessary.

SpectralODF::ODFMethod odfMethod (  )  const

Returns the method for calculating the spectral onset detection function.

By default it is COMPLEX_DOMAIN.

void setOdfMethod ( ODFMethod  method,
bool  callSetup = true 
)

Specifies the method for calculating the spectral onset detection function.

Note that PHASE_DEVIATION, WEIGHTED_PHASE_DEVIATION, NORM_WEIGHTED_PHASE_DEVIATION, COMPLEX_DOMAIN and RECTIFIED_COMPLEX_DOMAIN methods require at least 3 FFT frames, and therefore the input matrix to the process() method must have at least 3 rows. In these cases the output matrix will be 2 rows smaller than the input, since it only calculates ODF values for all the rows but the first two.

Note that SPECTRAL_FLUX method requires at least 2 FFT frames, and therefore the input matrix to the process() method must have at least 2 rows. In this case the output matrix will be 1 row smaller than the input, since it only calculates ODF values for all the rows but the first.

Parameters:
method the method used for calculating the spectral onset detection function.
callSetup a flag specifying whether the setup() method must be called after setting the parameter.

Referenced by SpectralODF().


The documentation for this class was generated from the following files:

Generated on Tue Mar 31 20:38:34 2009 for Loudia by  doxygen 1.5.6