# HG changeset patch # User Chris Cannam # Date 1165920141 0 # Node ID 62414aaaaa7e1d537029b6457bda46f821545af4 # Parent dcc20cd836d725d1f1ca07785e2d641b8cceecc1 * Update to new Vamp process() * Add hack for getting raw tempo out of hacked Aubio diff -r dcc20cd836d7 -r 62414aaaaa7e Makefile --- a/Makefile Tue Oct 31 13:54:21 2006 +0000 +++ b/Makefile Tue Dec 12 10:42:21 2006 +0000 @@ -16,7 +16,7 @@ # want to) statically link libstdc++, because our plugin exposes only # a C API so there are no boundary compatibility problems. # -PLUGIN_LIBS = -L$(VAMPLIBDIR) -Wl,-Bstatic -lvamp-sdk -laubio -Wl,-Bdynamic +PLUGIN_LIBS = -L$(VAMPLIBDIR) -Wl,-Bstatic -lvamp-sdk -laubio -lfftw3f -Wl,-Bdynamic #PLUGIN_LIBS = -L$(VAMPLIBDIR) -lvamp-sdk /usr/lib/libaubio.a /usr/lib/libfftw3f.a #PLUGIN_LIBS = -L$(VAMPLIBDIR) -lvamp-sdk $(shell g++ -print-file-name=libstdc++.a) diff -r dcc20cd836d7 -r 62414aaaaa7e plugins/Notes.cpp --- a/plugins/Notes.cpp Tue Oct 31 13:54:21 2006 +0000 +++ b/plugins/Notes.cpp Tue Dec 12 10:42:21 2006 +0000 @@ -328,7 +328,7 @@ } Notes::FeatureSet -Notes::process(float **inputBuffers, Vamp::RealTime timestamp) +Notes::process(const float *const *inputBuffers, Vamp::RealTime timestamp) { for (size_t i = 0; i < m_stepSize; ++i) { for (size_t j = 0; j < m_channelCount; ++j) { diff -r dcc20cd836d7 -r 62414aaaaa7e plugins/Notes.h --- a/plugins/Notes.h Tue Oct 31 13:54:21 2006 +0000 +++ b/plugins/Notes.h Tue Dec 12 10:42:21 2006 +0000 @@ -48,7 +48,8 @@ OutputList getOutputDescriptors() const; - FeatureSet process(float **inputBuffers, Vamp::RealTime timestamp); + FeatureSet process(const float *const *inputBuffers, + Vamp::RealTime timestamp); FeatureSet getRemainingFeatures(); diff -r dcc20cd836d7 -r 62414aaaaa7e plugins/Onset.cpp --- a/plugins/Onset.cpp Tue Oct 31 13:54:21 2006 +0000 +++ b/plugins/Onset.cpp Tue Dec 12 10:42:21 2006 +0000 @@ -225,7 +225,8 @@ } Onset::FeatureSet -Onset::process(float **inputBuffers, Vamp::RealTime timestamp) +Onset::process(const float *const *inputBuffers, + Vamp::RealTime timestamp) { for (size_t i = 0; i < m_stepSize; ++i) { for (size_t j = 0; j < m_channelCount; ++j) { diff -r dcc20cd836d7 -r 62414aaaaa7e plugins/Onset.h --- a/plugins/Onset.h Tue Oct 31 13:54:21 2006 +0000 +++ b/plugins/Onset.h Tue Dec 12 10:42:21 2006 +0000 @@ -46,7 +46,8 @@ OutputList getOutputDescriptors() const; - FeatureSet process(float **inputBuffers, Vamp::RealTime timestamp); + FeatureSet process(const float *const *inputBuffers, + Vamp::RealTime timestamp); FeatureSet getRemainingFeatures(); diff -r dcc20cd836d7 -r 62414aaaaa7e plugins/Pitch.cpp --- a/plugins/Pitch.cpp Tue Oct 31 13:54:21 2006 +0000 +++ b/plugins/Pitch.cpp Tue Dec 12 10:42:21 2006 +0000 @@ -170,7 +170,8 @@ } Pitch::FeatureSet -Pitch::process(float **inputBuffers, Vamp::RealTime /* timestamp */) +Pitch::process(const float *const *inputBuffers, + Vamp::RealTime /* timestamp */) { for (size_t i = 0; i < m_stepSize; ++i) { for (size_t j = 0; j < m_channelCount; ++j) { diff -r dcc20cd836d7 -r 62414aaaaa7e plugins/Pitch.h --- a/plugins/Pitch.h Tue Oct 31 13:54:21 2006 +0000 +++ b/plugins/Pitch.h Tue Dec 12 10:42:21 2006 +0000 @@ -46,7 +46,8 @@ OutputList getOutputDescriptors() const; - FeatureSet process(float **inputBuffers, Vamp::RealTime timestamp); + FeatureSet process(const float *const *inputBuffers, + Vamp::RealTime timestamp); FeatureSet getRemainingFeatures(); diff -r dcc20cd836d7 -r 62414aaaaa7e plugins/Tempo.cpp --- a/plugins/Tempo.cpp Tue Oct 31 13:54:21 2006 +0000 +++ b/plugins/Tempo.cpp Tue Dec 12 10:42:21 2006 +0000 @@ -22,6 +22,8 @@ using std::cerr; using std::endl; +//#define HAVE_AUBIO_LOCKED_TEMPO_HACK + Tempo::Tempo(float inputSampleRate) : Plugin(inputSampleRate), m_ibuf(0), @@ -223,11 +225,23 @@ d.sampleRate = 0; list.push_back(d); +#ifdef HAVE_AUBIO_LOCKED_TEMPO_HACK + d.name = "tempo"; + d.unit = "bpm"; + d.description = "Tempo"; + d.hasFixedBinCount = true; + d.binCount = 1; + d.hasKnownExtents = false; + d.isQuantized = false; + d.sampleType = OutputDescriptor::OneSamplePerStep; + list.push_back(d); +#endif + return list; } Tempo::FeatureSet -Tempo::process(float **inputBuffers, Vamp::RealTime timestamp) +Tempo::process(const float *const *inputBuffers, Vamp::RealTime timestamp) { for (size_t i = 0; i < m_stepSize; ++i) { for (size_t j = 0; j < m_channelCount; ++j) { @@ -238,8 +252,16 @@ aubio_pvoc_do(m_pv, m_ibuf, m_fftgrain); aubio_onsetdetection(m_onsetdet, m_fftgrain, m_onset); +#ifdef HAVE_AUBIO_LOCKED_TEMPO_HACK + float locked_tempo = 0; +#endif + if ( m_btcounter == m_btstep - 1 ) { +#ifdef HAVE_AUBIO_LOCKED_TEMPO_HACK + aubio_beattracking_do(m_beattracking,m_dfframe,m_btout,&locked_tempo); +#else aubio_beattracking_do(m_beattracking,m_dfframe,m_btout); +#endif /* rotate dfframe */ for (size_t i = 0 ; i < m_winlen - m_btstep; i++ ) m_dfframe->data[0][i] = m_dfframe->data[0][i+m_btstep]; @@ -253,7 +275,6 @@ &(m_dfframe->data[0][m_winlen - m_btstep + m_btcounter])); bool istactus = 0; - /* check if any of the predicted beat correspond to the current time */ for (size_t i = 1; i < m_btout->data[0][0]; i++ ) { if (m_btcounter == m_btout->data[0][i]) { @@ -279,6 +300,17 @@ } } +#ifdef HAVE_AUBIO_LOCKED_TEMPO_HACK + if (locked_tempo >= 30 && locked_tempo <= 206) { + if (locked_tempo > 145) locked_tempo /= 2; + std::cerr << "Locked tempo: " << locked_tempo << std::endl; + Feature tempo; + tempo.hasTimestamp = false; + tempo.values.push_back(locked_tempo); + returnFeatures[1].push_back(tempo); + } +#endif + return returnFeatures; } diff -r dcc20cd836d7 -r 62414aaaaa7e plugins/Tempo.h --- a/plugins/Tempo.h Tue Oct 31 13:54:21 2006 +0000 +++ b/plugins/Tempo.h Tue Dec 12 10:42:21 2006 +0000 @@ -46,7 +46,7 @@ OutputList getOutputDescriptors() const; - FeatureSet process(float **inputBuffers, Vamp::RealTime timestamp); + FeatureSet process(const float *const *inputBuffers, Vamp::RealTime timestamp); FeatureSet getRemainingFeatures();