* Detection function fix (was losing crispness in transients)

This commit is contained in:
Chris Cannam
2010-04-30 22:29:37 +01:00
parent b9d2bbdf49
commit 23b9aa9c51
2 changed files with 33 additions and 12 deletions

View File

@@ -111,11 +111,7 @@ double
CompoundAudioCurve::processFiltering(double percussive, double hf)
{
if (m_type == PercussiveDetector) {
if (percussive > 0.35) {
return 1.0;
} else {
return 0.0;
}
return percussive;
}
double rv = 0.f;
@@ -138,15 +134,16 @@ CompoundAudioCurve::processFiltering(double percussive, double hf)
result = hfDeriv - hfDerivFiltered;
}
if (m_type != SoftDetector && percussive > 0.35 && hfExcess > 0.0) {
rv = 1.0;
if (result < m_lastResult) {
if (m_risingCount > 3 && m_lastResult > 0) rv = 0.5;
m_risingCount = 0;
} else {
if (result < m_lastResult) {
if (m_risingCount > 3 && m_lastResult > 0) rv = 0.5;
m_risingCount = 0;
} else {
m_risingCount ++;
m_risingCount ++;
}
if (m_type == CompoundDetector) {
if (percussive > 0.35 && percussive > rv) {
rv = percussive;
}
}

View File

@@ -26,6 +26,8 @@
#endif
#ifdef USE_KISSFFT
#include "kissfft/kiss_fftr.h"
#endif
@@ -80,6 +82,8 @@ namespace FFTs {
#ifdef HAVE_FFTW3
// Define FFTW_DOUBLE_ONLY to make all uses of FFTW functions be
@@ -1280,6 +1284,26 @@ FFT::FFT(int size, int debugLevel)
#endif
break;
case 5:
std::cerr << "FFT::FFT(" << size << "): WARNING: Selected implemention not available" << std::endl;
#ifdef USE_BUILTIN_FFT
d = new FFTs::D_Cross(size);
#else
std::cerr << "FFT::FFT(" << size << "): ERROR: Fallback implementation not available!" << std::endl;
abort();
#endif
break;
case 6:
std::cerr << "FFT::FFT(" << size << "): WARNING: Selected implemention not available" << std::endl;
#ifdef USE_BUILTIN_FFT
d = new FFTs::D_Cross(size);
#else
std::cerr << "FFT::FFT(" << size << "): ERROR: Fallback implementation not available!" << std::endl;
abort();
#endif
break;
default:
#ifdef USE_BUILTIN_FFT
std::cerr << "FFT::FFT(" << size << "): WARNING: using slow built-in implementation" << std::endl;