Audacity 3.2.0
|
Used for finding the peaks, for snapping to peaks. More...
#include <SpectrumAnalyst.h>
Public Types | |
enum | Algorithm { Spectrum , Autocorrelation , CubeRootAutocorrelation , EnhancedAutocorrelation , Cepstrum , NumAlgorithms } |
using | ProgressFn = std::function< void(long long num, long long den)> |
Public Member Functions | |
SpectrumAnalyst () | |
~SpectrumAnalyst () | |
bool | Calculate (Algorithm alg, int windowFunc, size_t windowSize, double rate, const float *data, size_t dataLen, float *pYMin=NULL, float *pYMax=NULL, ProgressFn progress=NULL) |
const float * | GetProcessed () const |
int | GetProcessedSize () const |
float | GetProcessedValue (float freq0, float freq1) const |
float | FindPeak (float xPos, float *pY) const |
Private Member Functions | |
float | CubicInterpolate (float y0, float y1, float y2, float y3, float x) const |
float | CubicMaximize (float y0, float y1, float y2, float y3, float *max) const |
Private Attributes | |
Algorithm | mAlg |
double | mRate |
size_t | mWindowSize |
std::vector< float > | mProcessed |
Used for finding the peaks, for snapping to peaks.
This class is used to do the 'find peaks' snapping both in FreqPlot and in the spectrogram spectral selection.
Definition at line 17 of file SpectrumAnalyst.h.
using SpectrumAnalyst::ProgressFn = std::function<void(long long num, long long den)> |
Definition at line 31 of file SpectrumAnalyst.h.
Enumerator | |
---|---|
Spectrum | |
Autocorrelation | |
CubeRootAutocorrelation | |
EnhancedAutocorrelation | |
Cepstrum | |
NumAlgorithms |
Definition at line 21 of file SpectrumAnalyst.h.
SpectrumAnalyst::SpectrumAnalyst | ( | ) |
Definition at line 29 of file SpectrumAnalyst.cpp.
SpectrumAnalyst::~SpectrumAnalyst | ( | ) |
Definition at line 36 of file SpectrumAnalyst.cpp.
bool SpectrumAnalyst::Calculate | ( | Algorithm | alg, |
int | windowFunc, | ||
size_t | windowSize, | ||
double | rate, | ||
const float * | data, | ||
size_t | dataLen, | ||
float * | pYMin = NULL , |
||
float * | pYMax = NULL , |
||
ProgressFn | progress = NULL |
||
) |
Definition at line 40 of file SpectrumAnalyst.cpp.
References Autocorrelation, Cepstrum, CubeRootAutocorrelation, EnhancedAutocorrelation, ignore, InverseRealFFT(), mAlg, mProcessed, mRate, mWindowSize, NumAlgorithms, NumWindowFuncs(), fast_float::detail::power(), PowerSpectrum(), RealFFT(), Spectrum, staffpad::audio::simd::sqrt(), and WindowFunc().
Referenced by SelectHandle::StartSnappingFreqSelection().
|
private |
Definition at line 388 of file SpectrumAnalyst.cpp.
Referenced by GetProcessedValue().
|
private |
Definition at line 403 of file SpectrumAnalyst.cpp.
References staffpad::audio::simd::sqrt().
Referenced by FindPeak().
float SpectrumAnalyst::FindPeak | ( | float | xPos, |
float * | pY | ||
) | const |
Definition at line 336 of file SpectrumAnalyst.cpp.
References CubicMaximize(), GetProcessedSize(), mAlg, mProcessed, mRate, mWindowSize, and Spectrum.
Referenced by SelectHandle::SnapCenterOnce().
const float * SpectrumAnalyst::GetProcessed | ( | ) | const |
Definition at line 277 of file SpectrumAnalyst.cpp.
References mProcessed.
int SpectrumAnalyst::GetProcessedSize | ( | ) | const |
Definition at line 282 of file SpectrumAnalyst.cpp.
References mProcessed.
Referenced by FindPeak(), and GetProcessedValue().
float SpectrumAnalyst::GetProcessedValue | ( | float | freq0, |
float | freq1 | ||
) | const |
Definition at line 287 of file SpectrumAnalyst.cpp.
References CubicInterpolate(), GetProcessedSize(), mAlg, mProcessed, mRate, mWindowSize, and Spectrum.
|
private |
Definition at line 55 of file SpectrumAnalyst.h.
Referenced by Calculate(), FindPeak(), and GetProcessedValue().
|
private |
Definition at line 58 of file SpectrumAnalyst.h.
Referenced by Calculate(), FindPeak(), GetProcessed(), GetProcessedSize(), and GetProcessedValue().
|
private |
Definition at line 56 of file SpectrumAnalyst.h.
Referenced by Calculate(), FindPeak(), and GetProcessedValue().
|
private |
Definition at line 57 of file SpectrumAnalyst.h.
Referenced by Calculate(), FindPeak(), and GetProcessedValue().