|
From: Lasse Kärkkäi. <tr...@us...> - 2011-02-08 14:57:10
|
Module: editor
Branch: master
Commit: 0d98609cc5bcd73cc143fb16381376e1d558f304
Author: Lasse Karkkainen <tro...@tr...>
Date: Tue Feb 8 15:57:00 2011 +0100
Simple post-filtering to remove some noise.
---
pitch.cc | 2 +-
pitchvis.cc | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/pitch.cc b/pitch.cc
index 85d159d..903eeb2 100644
--- a/pitch.cc
+++ b/pitch.cc
@@ -82,7 +82,7 @@ void Analyzer::calcTones() {
Combos combos;
for (size_t k = kMin; k < kMax; ++k) {
Peak const& p = m_peaks[k];
- bool ok = p.level > 1e-4 && p.freq >= FFT_MINFREQ && p.freq <= FFT_MAXFREQ;
+ bool ok = p.level > 1e-6 && p.freq >= FFT_MINFREQ && p.freq <= FFT_MAXFREQ;
if (!ok) continue;
// Do we need to add a new Combo (rather than using the last one)?
if (combos.empty() || !combos.back().match(p.freq)) combos.push_back(Combo());
diff --git a/pitchvis.cc b/pitchvis.cc
index 2151e6f..92bcaea 100644
--- a/pitchvis.cc
+++ b/pitchvis.cc
@@ -74,16 +74,18 @@ void PitchVis::run()
for (Tone const* n = &*it2; n; n = n->next) { tones.push_back(n); }
if (tones.size() < 3) continue; // Too short tone, ignored
PitchPath path(ch);
+ double score = 0.0;
Analyzer::Moments::const_iterator momit = mit[ch];
// Store path used for rendering
for (unsigned i = 0; i < tones.size(); ++i, ++momit) {
float t = momit->m_time;
float n = scale.getNote(tones[i]->freq);
float level = level2dB(tones[i]->level);
+ score += tones[i]->level;
path.fragments.push_back(PitchFragment(t, n, level));
}
QMutexLocker locker(&mutex);
- paths.push_back(path);
+ if (score > 1.0) paths.push_back(path);
moreAvailable = true;
}
}
|