Gist
Public Member Functions | List of all members
OnsetDetectionFunction< T > Class Template Reference

#include <OnsetDetectionFunction.h>

Public Member Functions

 OnsetDetectionFunction (int frameSize)
 
void setFrameSize (int frameSize)
 
energyDifference (const std::vector< T > &buffer)
 
spectralDifference (const std::vector< T > &magnitudeSpectrum)
 
spectralDifferenceHWR (const std::vector< T > &magnitudeSpectrum)
 
complexSpectralDifference (const std::vector< T > &fftReal, const std::vector< T > &fftImag)
 
highFrequencyContent (const std::vector< T > &magnitudeSpectrum)
 

Detailed Description

template<class T>
class OnsetDetectionFunction< T >

template class for calculating onset detection functions Instantiations of the class should be of either 'float' or 'double' types and no others

Constructor & Destructor Documentation

◆ OnsetDetectionFunction()

template<class T >
OnsetDetectionFunction< T >::OnsetDetectionFunction ( int  frameSize)

constructor

Member Function Documentation

◆ complexSpectralDifference()

template<class T >
T OnsetDetectionFunction< T >::complexSpectralDifference ( const std::vector< T > &  fftReal,
const std::vector< T > &  fftImag 
)

calculates the complex spectral difference from the real and imaginary parts of the FFT

Parameters
fftReala vector containing the real part of the FFT
fftImaga vector containing the imaginary part of the FFT
Returns
the complex spectral difference onset detection function sample

◆ energyDifference()

template<class T >
T OnsetDetectionFunction< T >::energyDifference ( const std::vector< T > &  buffer)

calculates the energy difference onset detection function

Parameters
bufferthe time domain audio frame containing audio samples
Returns
the energy difference onset detection function sample for the frame

◆ highFrequencyContent()

template<class T >
T OnsetDetectionFunction< T >::highFrequencyContent ( const std::vector< T > &  magnitudeSpectrum)

calculates the high frequency content onset detection function from the magnitude spectrum

Parameters
magnitudeSpectruma vector containing the magnitude spectrum
Returns
the high frequency content onset detection function sample

◆ setFrameSize()

template<class T >
void OnsetDetectionFunction< T >::setFrameSize ( int  frameSize)

Sets the frame size of internal buffers. Assumes all magnitude spectra are passed as the first half (i.e. not mirrored)

Parameters
frameSizethe frame size

◆ spectralDifference()

template<class T >
T OnsetDetectionFunction< T >::spectralDifference ( const std::vector< T > &  magnitudeSpectrum)

calculates the spectral difference between the current magnitude spectrum and the previous magnitude spectrum

Parameters
magnitudeSpectruma vector containing the magnitude spectrum
Returns
the spectral difference onset detection function sample

◆ spectralDifferenceHWR()

template<class T >
T OnsetDetectionFunction< T >::spectralDifferenceHWR ( const std::vector< T > &  magnitudeSpectrum)

calculates the half wave rectified spectral difference between the current magnitude spectrum and the previous magnitude spectrum

Parameters
magnitudeSpectruma vector containing the magnitude spectrum
Returns
the HWR spectral difference onset detection function sample

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