getPCMScale() too large?

This commit is contained in:
Matthew Bellew
2020-02-02 12:26:34 -08:00
parent 8fd6b2d85c
commit 324a5c19f3
2 changed files with 12 additions and 12 deletions

View File

@ -109,6 +109,17 @@ void BeatDetect::detectFromSamples()
}
float BeatDetect::getPCMScale()
{
// the constant here just depends on the particulars of getBeatVals(), the
// range of vol_history, and what "looks right".
// larger value means larger, more jagged waveform.
return 1.5 / fmax(0.0001f,sqrtf(vol_history));
}
void BeatDetect::getBeatVals( float samplerate, unsigned fft_length, float *vdataL, float *vdataR )
{
assert( 512==fft_length || 1024==fft_length ); // should be power of 2, expect >= 512