Mercurial > hg > vamp-aubio-plugins
changeset 12:62414aaaaa7e
* Update to new Vamp process()
* Add hack for getting raw tempo out of hacked Aubio
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Tue, 12 Dec 2006 10:42:21 +0000 |
parents | dcc20cd836d7 |
children | 1169d00391d8 |
files | Makefile plugins/Notes.cpp plugins/Notes.h plugins/Onset.cpp plugins/Onset.h plugins/Pitch.cpp plugins/Pitch.h plugins/Tempo.cpp plugins/Tempo.h |
diffstat | 9 files changed, 47 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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) {
--- 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();
--- 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) {
--- 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();
--- 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) {
--- 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();
--- 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; }
--- 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();