* 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;
}
}