Audacity 3.2.0
|
#include <StftFrameProvider.h>
Public Member Functions | |
StftFrameProvider (const MirAudioReader &source) | |
bool | GetNextFrame (PffftFloatVector &frame) |
int | GetNumFrames () const |
int | GetSampleRate () const |
double | GetFrameRate () const |
int | GetFftSize () const |
Private Attributes | |
const MirAudioReader & | mAudio |
const int | mFftSize |
const double | mHopSize |
const std::vector< float > | mWindow |
const int | mNumFrames |
const long long | mNumSamples |
int | mNumFramesProvided = 0 |
Utility class to provide time-domain frames ready for FFT. The returned frames have power-of-two size and are already windowed with a Hann window, scaled such that it sums to unity. Also, GetNumFrames()
is the closest power of two that satifsies a hop size of 10ms. This property facilitates the FFT analysis of transformation of the STFT frames to some scalar, e.g. the novelty values of an onset detection function.
Definition at line 28 of file StftFrameProvider.h.
MIR::StftFrameProvider::StftFrameProvider | ( | const MirAudioReader & | source | ) |
Definition at line 46 of file StftFrameProvider.cpp.
References MIR::IsPowOfTwo(), and mNumFrames.
int MIR::StftFrameProvider::GetFftSize | ( | ) | const |
Definition at line 100 of file StftFrameProvider.cpp.
References mFftSize.
double MIR::StftFrameProvider::GetFrameRate | ( | ) | const |
Definition at line 95 of file StftFrameProvider.cpp.
References MIR::MirAudioReader::GetSampleRate(), mAudio, and mHopSize.
bool MIR::StftFrameProvider::GetNextFrame | ( | PffftFloatVector & | frame | ) |
Definition at line 59 of file StftFrameProvider.cpp.
References details::end(), mAudio, mFftSize, mHopSize, min(), mNumFrames, mNumFramesProvided, mNumSamples, mWindow, MIR::MirAudioReader::ReadFloats(), and fast_float::round().
int MIR::StftFrameProvider::GetNumFrames | ( | ) | const |
Definition at line 85 of file StftFrameProvider.cpp.
References mNumFrames.
int MIR::StftFrameProvider::GetSampleRate | ( | ) | const |
Definition at line 90 of file StftFrameProvider.cpp.
References MIR::MirAudioReader::GetSampleRate(), and mAudio.
|
private |
Definition at line 39 of file StftFrameProvider.h.
Referenced by GetFrameRate(), GetNextFrame(), and GetSampleRate().
|
private |
Definition at line 40 of file StftFrameProvider.h.
Referenced by GetFftSize(), and GetNextFrame().
|
private |
Definition at line 41 of file StftFrameProvider.h.
Referenced by GetFrameRate(), and GetNextFrame().
|
private |
Definition at line 43 of file StftFrameProvider.h.
Referenced by GetNextFrame(), GetNumFrames(), and StftFrameProvider().
|
private |
Definition at line 45 of file StftFrameProvider.h.
Referenced by GetNextFrame().
|
private |
Definition at line 44 of file StftFrameProvider.h.
Referenced by GetNextFrame().
|
private |
Definition at line 42 of file StftFrameProvider.h.
Referenced by GetNextFrame().