1
0
mirror of https://github.com/RPCS3/soundtouch.git synced 2024-11-10 04:42:50 +01:00

Relaxed peak detection low limit from 1e-6 to 1e-9 to improve detections

This commit is contained in:
oparviai 2010-08-24 15:53:56 +00:00
parent cba79d510f
commit 16f0a95a30
2 changed files with 2 additions and 2 deletions

View File

@ -332,7 +332,7 @@ float BPMDetect::getBpm()
peakPos = peakFinder.detectPeak(xcorr, windowStart, windowLen); peakPos = peakFinder.detectPeak(xcorr, windowStart, windowLen);
assert(decimateBy != 0); assert(decimateBy != 0);
if (peakPos < 1e-6) return 0.0; // detection failed. if (peakPos < 1e-9) return 0.0; // detection failed.
// calculate BPM // calculate BPM
return (float)(60.0 * (((double)sampleRate / (double)decimateBy) / peakPos)); return (float)(60.0 * (((double)sampleRate / (double)decimateBy) / peakPos));

View File

@ -164,7 +164,7 @@ double PeakFinder::getPeakCenter(const float *data, int peakpos) const
groundLevel = max(data[gp1], data[gp2]); groundLevel = max(data[gp1], data[gp2]);
peakLevel = data[peakpos]; peakLevel = data[peakpos];
if (groundLevel < 1e-6) return 0; // ground level too small => detection failed if (groundLevel < 1e-9) return 0; // ground level too small => detection failed
if ((peakLevel / groundLevel) < 1.3) return 0; // peak less than 30% of the ground level => no good peak detected if ((peakLevel / groundLevel) < 1.3) return 0; // peak less than 30% of the ground level => no good peak detected
// calculate 70%-level of the peak // calculate 70%-level of the peak