Gist
|
#include <OnsetDetectionFunction.h>
Public Member Functions | |
OnsetDetectionFunction (int frameSize) | |
void | setFrameSize (int frameSize) |
T | energyDifference (const std::vector< T > &buffer) |
T | spectralDifference (const std::vector< T > &magnitudeSpectrum) |
T | spectralDifferenceHWR (const std::vector< T > &magnitudeSpectrum) |
T | complexSpectralDifference (const std::vector< T > &fftReal, const std::vector< T > &fftImag) |
T | highFrequencyContent (const std::vector< T > &magnitudeSpectrum) |
template class for calculating onset detection functions Instantiations of the class should be of either 'float' or 'double' types and no others
OnsetDetectionFunction< T >::OnsetDetectionFunction | ( | int | frameSize | ) |
constructor
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
fftReal | a vector containing the real part of the FFT |
fftImag | a vector containing the imaginary part of the FFT |
T OnsetDetectionFunction< T >::energyDifference | ( | const std::vector< T > & | buffer | ) |
calculates the energy difference onset detection function
buffer | the time domain audio frame containing audio samples |
T OnsetDetectionFunction< T >::highFrequencyContent | ( | const std::vector< T > & | magnitudeSpectrum | ) |
calculates the high frequency content onset detection function from the magnitude spectrum
magnitudeSpectrum | a vector containing the magnitude spectrum |
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)
frameSize | the frame size |
T OnsetDetectionFunction< T >::spectralDifference | ( | const std::vector< T > & | magnitudeSpectrum | ) |
calculates the spectral difference between the current magnitude spectrum and the previous magnitude spectrum
magnitudeSpectrum | a vector containing the magnitude spectrum |
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
magnitudeSpectrum | a vector containing the magnitude spectrum |