Gist
OnsetDetectionFunction.h
Go to the documentation of this file.
1 //=======================================================================
22 //=======================================================================
23 
24 #ifndef __GIST__ONSETDETECTIONFUNCTION__
25 #define __GIST__ONSETDETECTIONFUNCTION__
26 
27 #define _USE_MATH_DEFINES
28 #include <vector>
29 #include <cmath>
30 
34 template <class T>
36 {
37 public:
38  //===========================================================
40  OnsetDetectionFunction (int frameSize);
41 
42  //===========================================================
47  void setFrameSize (int frameSize);
48 
49  //===========================================================
54  T energyDifference (const std::vector<T>& buffer);
55 
56  //===========================================================
62  T spectralDifference (const std::vector<T>& magnitudeSpectrum);
63 
64  //===========================================================
70  T spectralDifferenceHWR (const std::vector<T>& magnitudeSpectrum);
71 
72  //===========================================================
79  T complexSpectralDifference (const std::vector<T>& fftReal, const std::vector<T>& fftImag);
80 
81  //===========================================================
87  T highFrequencyContent (const std::vector<T>& magnitudeSpectrum);
88 
89 private:
91  T princarg (T phaseVal);
92 
93  //===========================================================
95  T prevEnergySum;
96 
99  std::vector<T> prevMagnitudeSpectrum_spectralDifference;
100 
103  std::vector<T> prevMagnitudeSpectrum_spectralDifferenceHWR;
104 
107  std::vector<T> prevPhaseSpectrum_complexSpectralDifference;
108 
111  std::vector<T> prevPhaseSpectrum2_complexSpectralDifference;
112 
115  std::vector<T> prevMagnitudeSpectrum_complexSpectralDifference;
116 };
117 
118 #endif
OnsetDetectionFunction::spectralDifferenceHWR
T spectralDifferenceHWR(const std::vector< T > &magnitudeSpectrum)
Definition: OnsetDetectionFunction.cpp:113
OnsetDetectionFunction::complexSpectralDifference
T complexSpectralDifference(const std::vector< T > &fftReal, const std::vector< T > &fftImag)
Definition: OnsetDetectionFunction.cpp:138
OnsetDetectionFunction::highFrequencyContent
T highFrequencyContent(const std::vector< T > &magnitudeSpectrum)
Definition: OnsetDetectionFunction.cpp:187
OnsetDetectionFunction::spectralDifference
T spectralDifference(const std::vector< T > &magnitudeSpectrum)
Definition: OnsetDetectionFunction.cpp:86
OnsetDetectionFunction::energyDifference
T energyDifference(const std::vector< T > &buffer)
Definition: OnsetDetectionFunction.cpp:63
OnsetDetectionFunction
Definition: OnsetDetectionFunction.h:36
OnsetDetectionFunction::OnsetDetectionFunction
OnsetDetectionFunction(int frameSize)
Definition: OnsetDetectionFunction.cpp:28
OnsetDetectionFunction::setFrameSize
void setFrameSize(int frameSize)
Definition: OnsetDetectionFunction.cpp:36