using std::cerr;
using std::endl;
+//#define HAVE_AUBIO_LOCKED_TEMPO_HACK
+
Tempo::Tempo(float inputSampleRate) :
Plugin(inputSampleRate),
m_ibuf(0),
}
string
-Tempo::getName() const
+Tempo::getIdentifier() const
{
return "aubiotempo";
}
string
+Tempo::getName() const
+{
+ return "Aubio Beat Tracker";
+}
+
+string
Tempo::getDescription() const
{
- return "Aubio Tempo Detector";
+ return "Estimate the musical tempo and track beat positions";
}
string
Tempo::getMaker() const
{
- return "Paul Brossier (plugin by Chris Cannam)";
+ return "Paul Brossier (method by Matthew Davies, plugin by Chris Cannam)";
}
int
ParameterList list;
ParameterDescriptor desc;
- desc.name = "onsettype";
- desc.description = "Onset Detection Function Type";
+ desc.identifier = "onsettype";
+ desc.name = "Onset Detection Function Type";
desc.minValue = 0;
desc.maxValue = 6;
desc.defaultValue = (int)aubio_onset_complex;
list.push_back(desc);
desc = ParameterDescriptor();
- desc.name = "peakpickthreshold";
- desc.description = "Peak Picker Threshold";
+ desc.identifier = "peakpickthreshold";
+ desc.name = "Peak Picker Threshold";
desc.minValue = 0;
desc.maxValue = 1;
desc.defaultValue = 0.3;
list.push_back(desc);
desc = ParameterDescriptor();
- desc.name = "silencethreshold";
- desc.description = "Silence Threshold";
+ desc.identifier = "silencethreshold";
+ desc.name = "Silence Threshold";
desc.minValue = -120;
desc.maxValue = 0;
desc.defaultValue = -90;
OutputList list;
OutputDescriptor d;
- d.name = "beats";
+ d.identifier = "beats";
+ d.name = "Beats";
d.unit = "";
- d.description = "Beats";
d.hasFixedBinCount = true;
d.binCount = 0;
d.sampleType = OutputDescriptor::VariableSampleRate;
d.sampleRate = 0;
list.push_back(d);
+#ifdef HAVE_AUBIO_LOCKED_TEMPO_HACK
+ d.identifier = "tempo";
+ d.name = "Tempo";
+ d.unit = "bpm";
+ 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) {
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];
&(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]) {
}
}
+#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;
}