clarkezone / audiovisualizer

A UWP audio visualization component that provides a stream analyzer and XAML visualization controls for displaying VU and spectrum meters powered by Win2D
MIT License
122 stars 26 forks source link

Calculation of downsampleFactor does not seem right #45

Closed ghost closed 6 years ago

ghost commented 6 years ago

It looks like overlapFrames is being added twice. The call to ConfigureAnalyzer passes the argument m_StepTotalFrames which already has m_StepFrameOverlap. Then in the while loop it is added again.
Is this the intent ? if yes then why ?

Thanks in advance.

HRESULT MediaAnalyzer::Analyzer_Initialize() .... m_StepTotalFrames = m_StepFrameCount + m_StepFrameOverlap; ... _analyzer->ConfigureAnalyzer(m_FftLength, m_StepTotalFrames, m_StepFrameOverlap);

void CAudioAnalyzer::ConfigureAnalyzer(UINT32 fftLength, UINT32 stepFrames, UINT32 overlapFrames) ... // Calculate downsample factor, if FFT length is too short for step+overlap then downsample input UINT32 downsampleFactor = 1; while ((stepFrames + overlapFrames) / downsampleFactor > fftLength) downsampleFactor++;

tonuv commented 6 years ago

Thanks for the feedback - this issue should be fixed in the most recent major update and rewrite of the library (migrate to C++/WinRT)