Mercurial > hg > chp
changeset 9:5fb59edfab99
no pitch output in case of a) edge case or b) interpolated is outside freq range
author | matthiasm |
---|---|
date | Thu, 10 Apr 2014 18:37:55 +0100 |
parents | e9b629578488 |
children | f82a28c2209f |
files | ConstrainedHarmonicPeak.cpp Makefile.osx |
diffstat | 2 files changed, 15 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ConstrainedHarmonicPeak.cpp Mon Mar 10 14:51:09 2014 +0000 +++ b/ConstrainedHarmonicPeak.cpp Thu Apr 10 18:37:55 2014 +0100 @@ -317,16 +317,25 @@ double maxdb = -120.0; int maxidx = 0; for (int i = 0; i <= maxbin - minbin; ++i) { - if (hps[i] > maxdb) { - maxdb = hps[i]; - maxidx = i; - } + if (hps[i] > maxdb) { + maxdb = hps[i]; + maxidx = i; + } + } + + if (maxidx == 0 || maxidx == maxbin - minbin) { // edge cases are useless + return fs; } double interpolated = findInterpolatedPeak(hps, maxidx, maxbin - minbin + 1); + interpolated = interpolated + minbin; double freq = interpolated * m_inputSampleRate / m_fftSize; + + if (freq < m_minFreq || freq > m_maxFreq) { + return fs; + } Feature f; f.values.push_back(freq);
--- a/Makefile.osx Mon Mar 10 14:51:09 2014 +0000 +++ b/Makefile.osx Thu Apr 10 18:37:55 2014 +0100 @@ -1,8 +1,8 @@ ARCHFLAGS := -arch x86_64 -mmacosx-version-min=10.7 -CFLAGS := $(ARCHFLAGS) -O3 -I../vamp-plugin-sdk -I../../vamp-plugin-sdk -I/usr/local/boost -Wall -fPIC +CFLAGS := $(ARCHFLAGS) -O3 -I../vamp-plugin-sdk -I/usr/local/boost -Wall -fPIC CXXFLAGS := $(CFLAGS) -LDFLAGS := -L../vamp-plugin-sdk -L../../vamp-plugin-sdk -lvamp-sdk $(ARCHFLAGS) +LDFLAGS := -L../vamp-plugin-sdk -lvamp-sdk $(ARCHFLAGS) PLUGIN_LDFLAGS := -dynamiclib $(LDFLAGS) -exported_symbols_list vamp-plugin.list TEST_LDFLAGS := $(LDFLAGS) -lboost_unit_test_framework PLUGIN_EXT := .dylib