|
Krotos Modules 3
|
Performs Onset Detection with vibrato suppresion. More...
#include <SuperFluxOnsetDetection.h>
Public Member Functions | |
| SuperFluxOnsetDetection (std::vector< std::vector< float > > &logSpectrum, float sampleRate, int hopSize) | |
| void | setParametersMS (float preMax, float postMax, float preAvg, float postAvg, float combWidth) |
| void | setDeltaPercentage (float deltaPrcnt) |
| std::vector< float > | trajectoryTracking (std::vector< std::vector< float > > logSpectrum) |
| std::vector< float > | calculateDetectionFunction (const std::vector< std::vector< float > > &logSpectrum, const std::vector< float > &maxLogSpectum) |
| std::vector< int > | peakPicking (std::vector< float > detectionFunction) |
| std::vector< int > | findOnsetsInSamples () |
Private Member Functions | |
| float | halfWaveRect (float x) |
| std::vector< float > | movingMax (std::vector< float > detectionFunction) |
| std::vector< float > | movingMean (std::vector< float > detectionFunction) |
Private Attributes | |
| std::vector< std::vector< float > > | m_inputLogSpectrum |
| float | m_deltaPrcnt {0.0f} |
| int | m_preMaxFrames {0} |
| int | m_postMaxFrames {0} |
| int | m_preAvgFrames {0} |
| int | m_postAvgFrames {0} |
| int | m_combWidthFrames {0} |
| const int | mi = 2 |
| int | m_numBands {0} |
| int | m_numFrames {0} |
| float | m_sampleRate {0.0f} |
| int | m_hopSize {0} |
Performs Onset Detection with vibrato suppresion.
This class implements the SuperFlux onset detection algorithm, which is an enhanced version of the universal spectral flux onset detection. It only considers the magnitude spectrogram, relying on detection of positive changes in the energy over time, but instead of calculating the difference between adjacent frames, it uses a trajectory tracking phase, incorporating a maximum filter for tracking. To facilitate trajectory tracking, the linear magnitude spectrogram has to be filtered with a filterBank with M=138 triangular filters with center frequencies alligned on the western music scale(Call MusicScaleFilterBak.h before). TODO: Online version (super simple), ComplexFlux (incorporates phase info as well.)
| krotos::SuperFluxOnsetDetection::SuperFluxOnsetDetection | ( | std::vector< std::vector< float > > & | logSpectrum, |
| float | sampleRate, | ||
| int | hopSize ) |
Constructor
| logSpectrum | the filtered Spectrogram of the audiosignal in the form of [frames, bands] |
| sampleRate | the sampleRate of the audio signal ih Hz |
| hopSize | the hopSize of the STFT that initially was used on the signal to produce the spectrogram |
| std::vector< float > krotos::SuperFluxOnsetDetection::calculateDetectionFunction | ( | const std::vector< std::vector< float > > & | logSpectrum, |
| const std::vector< float > & | maxLogSpectum ) |
Caclulates the Detection function vector using the trajectory tracking parameter mi.
| logSpectrum | the filtered Spectrogram of the audiosignal in the form of [frames, bands] |
| maxLogSpectrum | the maximum filtered Spectrogram |
| std::vector< int > krotos::SuperFluxOnsetDetection::findOnsetsInSamples | ( | ) |
|
inlineprivate |
HalfWave Rectifier function.
|
private |
Moving maximum.
|
private |
Moving average.
| std::vector< int > krotos::SuperFluxOnsetDetection::peakPicking | ( | std::vector< float > | detectionFunction | ) |
Peak picking stage.
| detectionFunction | the Detection function vector |
| void krotos::SuperFluxOnsetDetection::setDeltaPercentage | ( | float | deltaPrcnt | ) |
Set delta threshold parameter percentage.
| void krotos::SuperFluxOnsetDetection::setParametersMS | ( | float | preMax, |
| float | postMax, | ||
| float | preAvg, | ||
| float | postAvg, | ||
| float | combWidth ) |
Sets the peak picking parameters
| preMax | number of frames the moving max filter looks back in time |
| postMax | number of frames the moving max filter looks forward in time [set to 0 for online version] |
| preAvg | number of frames the moving avg filter looks forward in time |
| postAvg | number of frames the moving avg filter looks forward in time [set to 0 for online version] |
| combWidth | number of frames between two valid onsets |
| std::vector< float > krotos::SuperFluxOnsetDetection::trajectoryTracking | ( | std::vector< std::vector< float > > | logSpectrum | ) |
Applies maximum filter on each frequency bin of the filtered spectrogram and its near neighbors, limited to each frame.
| logSpectrum | the filtered Spectrogram of the audiosignal in the form of [frames, bands] returns the maximum filtered Spectrogram |
|
private |
|
private |
Peak picking parameters
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |