# HG changeset patch # User Chris Cannam # Date 1417453939 0 # Node ID 00fab71b80ec8adf50a28ae53c222650d9bc8cc7 # Parent ba5f3b08446692f033432a4de146c8814bf1436c More tweaking of frequencies diff -r ba5f3b084466 -r 00fab71b80ec Makefile.linux --- a/Makefile.linux Fri Nov 28 18:15:44 2014 +0000 +++ b/Makefile.linux Mon Dec 01 17:12:19 2014 +0000 @@ -1,12 +1,12 @@ -CFLAGS := -Wall -O3 -fopenmp -ffast-math -msse -msse2 -mfpmath=sse -ftree-vectorize -fPIC -I../vamp-plugin-sdk/ -DUSE_PTHREADS +CFLAGS := -Wall -O3 -ffast-math -msse -msse2 -mfpmath=sse -ftree-vectorize -fPIC -I../vamp-plugin-sdk/ -DUSE_PTHREADS #CFLAGS := -g -fPIC -I../vamp-plugin-sdk CXXFLAGS := $(CFLAGS) VAMPSDK_DIR := ../vamp-plugin-sdk -PLUGIN_LDFLAGS := -lgomp -shared -Wl,-Bsymbolic -Wl,-z,defs -Wl,--version-script=vamp-plugin.map -lpthread +PLUGIN_LDFLAGS := -shared -Wl,-Bsymbolic -Wl,-z,defs -Wl,--version-script=vamp-plugin.map -lpthread PLUGIN_EXT := .so diff -r ba5f3b084466 -r 00fab71b80ec src/LiveInstruments.cpp --- a/src/LiveInstruments.cpp Fri Nov 28 18:15:44 2014 +0000 +++ b/src/LiveInstruments.cpp Mon Dec 01 17:12:19 2014 +0000 @@ -17,6 +17,8 @@ #include "data/include/templates.h" +#include + using namespace std; InstrumentPack @@ -24,6 +26,8 @@ { vector templates; + cerr << "LiveAdapter: reduced template height is " << SILVET_TEMPLATE_HEIGHT/5 << endl; + for (vector::const_iterator i = original.templates.begin(); i != original.templates.end(); ++i) { @@ -34,12 +38,22 @@ t.data.resize(i->data.size()); for (int j = 0; j < int(i->data.size()); ++j) { + t.data[j].resize(SILVET_TEMPLATE_HEIGHT/5); + float sum = 0.f; + for (int k = 0; k < SILVET_TEMPLATE_HEIGHT/5; ++k) { - t.data[j][k] = i->data[j][k * 5 + 2 - SILVET_TEMPLATE_MAX_SHIFT]; + + t.data[j][k] = 0.f; + + for (int m = 0; m < 5; ++m) { + t.data[j][k] += i->data[j][k * 5 + m + 2]; + } + sum += t.data[j][k]; } + // re-normalise for (int k = 0; k < (int)t.data[j].size(); ++k) { t.data[j][k] *= 1.f / sum; diff -r ba5f3b084466 -r 00fab71b80ec src/Silvet.cpp --- a/src/Silvet.cpp Fri Nov 28 18:15:44 2014 +0000 +++ b/src/Silvet.cpp Mon Dec 01 17:12:19 2014 +0000 @@ -351,7 +351,12 @@ float((shiftCount - shift) - int(shiftCount / 2) - 1) / shiftCount; } - return float(27.5 * pow(2.0, (note + pshift) / 12.0)); + float freq = float(27.5 * pow(2.0, (note + pshift) / 12.0)); + + cerr << "note = " << note << ", shift = " << shift << ", shiftCount = " + << shiftCount << ", obtained freq = " << freq << endl; + + return freq; } bool @@ -402,6 +407,17 @@ m_flattener = new FlattenDynamics(m_inputSampleRate); // before resampling m_flattener->reset(); + // this happens to be processingSampleRate / 3, and is the top + // freq used for the EM templates: + double maxFreq = 14700; + + if (m_mode == LiveMode) { + // We only have 12 bpo rather than 60, so we need the top bin + // to be the middle one of the top 5, i.e. 2/5 of a semitone + // lower than 14700 + maxFreq *= powf(2.0, -1.0 / 30.0); + } + double minFreq = 27.5; if (m_mode != HighQualityMode) { @@ -412,7 +428,7 @@ int bpo = 12 * (m_mode == LiveMode ? binsPerSemitoneLive : binsPerSemitoneNormal); - + CQParameters params(processingSampleRate, minFreq, processingSampleRate / 3, @@ -429,7 +445,8 @@ m_cq = new CQSpectrogram(params, CQSpectrogram::InterpolateLinear); - cerr << "cq latency = " << m_cq->getLatency() << endl; + cerr << "CQ bins = " << m_cq->getTotalBins() << endl; + cerr << "CQ min freq = " << m_cq->getMinFrequency() << " (and for confirmation, freq of bin 0 = " << m_cq->getBinFrequency(0) << ")" << endl; m_colsPerSec = (m_mode == DraftMode ? 25 : 50);