Mercurial > hg > qm-vamp-plugins
changeset 90:52c6817a414e
* Add a beat spectral difference output to bar detector
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 27 Feb 2009 10:24:07 +0000 |
parents | f4a2f5aa743c |
children | 93f7edb0564b |
files | plugins/BarBeatTrack.cpp |
diffstat | 1 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/BarBeatTrack.cpp Tue Feb 10 16:38:02 2009 +0000 +++ b/plugins/BarBeatTrack.cpp Fri Feb 27 10:24:07 2009 +0000 @@ -234,9 +234,20 @@ beatcounts.sampleType = OutputDescriptor::VariableSampleRate; beatcounts.sampleRate = 1.0 / m_stepSecs; + OutputDescriptor beatsd; + beatsd.identifier = "beatsd"; + beatsd.name = "Beat Spectral Difference"; + beatsd.description = "Beat spectral difference function used for bar-line detection"; + beatsd.unit = ""; + beatsd.hasFixedBinCount = true; + beatsd.binCount = 1; + beatsd.sampleType = OutputDescriptor::VariableSampleRate; + beatsd.sampleRate = 1.0 / m_stepSecs; + list.push_back(beat); list.push_back(bars); list.push_back(beatcounts); + list.push_back(beatsd); return list; } @@ -319,6 +330,9 @@ const float *downsampled = m_d->downBeat->getBufferedAudio(downLength); m_d->downBeat->findDownBeats(downsampled, downLength, beats, downbeats); + vector<double> beatsd; + m_d->downBeat->getBeatSD(beatsd); + // std::cerr << "BarBeatTracker: found downbeats at: "; // for (int i = 0; i < downbeats.size(); ++i) std::cerr << downbeats[i] << " " << std::endl; @@ -360,6 +374,13 @@ feature.values.push_back(beat + 1); returnFeatures[2].push_back(feature); // beat function + if (i > 0 && i <= beatsd.size()) { + feature.values.clear(); + feature.values.push_back(beatsd[i-1]); + feature.label = ""; + returnFeatures[3].push_back(feature); // beat spectral difference + } + if (beat == 0) { feature.values.clear(); sprintf(label, "%d", bar);