Krotos Modules 3
Loading...
Searching...
No Matches
SuperFluxOnsetDetection.h
Go to the documentation of this file.
1namespace krotos
2{
3 //==============================================================================
20 {
21 public:
29 SuperFluxOnsetDetection(std::vector<std::vector<float>>& logSpectrum, float sampleRate, int hopSize);
30
42 void setParametersMS(float preMax, float postMax, float preAvg, float postAvg, float combWidth);
43
45 void setDeltaPercentage(float deltaPrcnt);
46
52 std::vector<float> trajectoryTracking(std::vector<std::vector<float>> logSpectrum);
53
61 std::vector<float> calculateDetectionFunction(const std::vector<std::vector<float>>& logSpectrum,
62 const std::vector<float>& maxLogSpectum);
63
68 std::vector<int> peakPicking(std::vector<float> detectionFunction);
69
70 /* Triggers trajectory tracking and peak picking stages. */
71 std::vector<int> findOnsetsInSamples();
72
73 private:
75 float halfWaveRect(float x) { return (x + std::abs(x)) / 2.0f; };
76
78 std::vector<float> movingMax(std::vector<float> detectionFunction);
79
81 std::vector<float> movingMean(std::vector<float> detectionFunction);
82
83 std::vector<std::vector<float>> m_inputLogSpectrum;
84
86 // Tunable threshold
87 float m_deltaPrcnt{0.0f}; // TODO how to set from slider values, mean/max of
88 // detection function etc.
94
95 // trajectory tracking parameter
96 const int mi = 2;
97 int m_numBands{0};
99 float m_sampleRate{0.0f};
100 int m_hopSize{0};
101 };
102} // namespace krotos
Performs Onset Detection with vibrato suppresion.
Definition SuperFluxOnsetDetection.h:20
std::vector< float > calculateDetectionFunction(const std::vector< std::vector< float > > &logSpectrum, const std::vector< float > &maxLogSpectum)
Definition SuperFluxOnsetDetection.cpp:56
void setParametersMS(float preMax, float postMax, float preAvg, float postAvg, float combWidth)
Definition SuperFluxOnsetDetection.cpp:12
std::vector< float > movingMean(std::vector< float > detectionFunction)
Definition SuperFluxOnsetDetection.cpp:167
int m_numBands
Definition SuperFluxOnsetDetection.h:97
float m_sampleRate
Definition SuperFluxOnsetDetection.h:99
int m_combWidthFrames
Definition SuperFluxOnsetDetection.h:93
std::vector< int > findOnsetsInSamples()
Definition SuperFluxOnsetDetection.cpp:206
int m_numFrames
Definition SuperFluxOnsetDetection.h:98
float halfWaveRect(float x)
Definition SuperFluxOnsetDetection.h:75
int m_preMaxFrames
Definition SuperFluxOnsetDetection.h:89
const int mi
Definition SuperFluxOnsetDetection.h:96
int m_preAvgFrames
Definition SuperFluxOnsetDetection.h:91
std::vector< std::vector< float > > m_inputLogSpectrum
Definition SuperFluxOnsetDetection.h:83
SuperFluxOnsetDetection(std::vector< std::vector< float > > &logSpectrum, float sampleRate, int hopSize)
Definition SuperFluxOnsetDetection.cpp:3
void setDeltaPercentage(float deltaPrcnt)
Definition SuperFluxOnsetDetection.cpp:25
int m_postMaxFrames
Definition SuperFluxOnsetDetection.h:90
std::vector< int > peakPicking(std::vector< float > detectionFunction)
Definition SuperFluxOnsetDetection.cpp:77
std::vector< float > movingMax(std::vector< float > detectionFunction)
Definition SuperFluxOnsetDetection.cpp:128
int m_postAvgFrames
Definition SuperFluxOnsetDetection.h:92
std::vector< float > trajectoryTracking(std::vector< std::vector< float > > logSpectrum)
Definition SuperFluxOnsetDetection.cpp:27
float m_deltaPrcnt
Definition SuperFluxOnsetDetection.h:87
int m_hopSize
Definition SuperFluxOnsetDetection.h:100
Definition AirAbsorptionFilter.cpp:2