projects
/
vamp-aubio-plugins.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
include math.h, add onset timestamps, fix default block and step sizes, switch to...
[vamp-aubio-plugins.git]
/
plugins
/
Onset.cpp
diff --git
a/plugins/Onset.cpp
b/plugins/Onset.cpp
index
68322d8
..
c4bc76a
100644
(file)
--- a/
plugins/Onset.cpp
+++ b/
plugins/Onset.cpp
@@
-14,6
+14,7
@@
*/
*/
+#include <math.h>
#include "Onset.h"
using std::string;
#include "Onset.h"
using std::string;
@@
-29,7
+30,7
@@
Onset::Onset(float inputSampleRate) :
m_pv(0),
m_peakpick(0),
m_onsetdet(0),
m_pv(0),
m_peakpick(0),
m_onsetdet(0),
- m_onsettype(aubio_onset_
mkl
),
+ m_onsettype(aubio_onset_
complex
),
m_threshold(0.3),
m_silence(-90),
m_channelCount(1)
m_threshold(0.3),
m_silence(-90),
m_channelCount(1)
@@
-83,21
+84,13
@@
Onset::initialise(size_t channels, size_t stepSize, size_t blockSize)
m_stepSize = stepSize;
m_blockSize = blockSize;
m_stepSize = stepSize;
m_blockSize = blockSize;
- size_t processingBlockSize;
- if (m_onsettype == aubio_onset_energy ||
- m_onsettype == aubio_onset_hfc) {
- processingBlockSize = stepSize * 2;
- } else {
- processingBlockSize = stepSize * 4;
- }
-
m_ibuf = new_fvec(stepSize, channels);
m_onset = new_fvec(1, channels);
m_ibuf = new_fvec(stepSize, channels);
m_onset = new_fvec(1, channels);
- m_fftgrain = new_cvec(
processingB
lockSize, channels);
- m_pv = new_aubio_pvoc(
processingB
lockSize, stepSize, channels);
+ m_fftgrain = new_cvec(
b
lockSize, channels);
+ m_pv = new_aubio_pvoc(
b
lockSize, stepSize, channels);
m_peakpick = new_aubio_peakpicker(m_threshold);
m_peakpick = new_aubio_peakpicker(m_threshold);
- m_onsetdet = new_aubio_onsetdetection(m_onsettype,
processingB
lockSize, channels);
+ m_onsetdet = new_aubio_onsetdetection(m_onsettype,
b
lockSize, channels);
return true;
}
return true;
}
@@
-110,18
+103,13
@@
Onset::reset()
size_t
Onset::getPreferredStepSize() const
{
size_t
Onset::getPreferredStepSize() const
{
- if (m_onsettype == aubio_onset_energy ||
- m_onsettype == aubio_onset_hfc) {
- return 512;
- } else {
- return 128;
- }
+ return 512;
}
size_t
Onset::getPreferredBlockSize() const
{
}
size_t
Onset::getPreferredBlockSize() const
{
- return getPreferredStepSize();
+ return
2*
getPreferredStepSize();
}
Onset::ParameterList
}
Onset::ParameterList
@@
-134,7
+122,7
@@
Onset::getParameterDescriptors() const
desc.description = "Onset Detection Function Type";
desc.minValue = 0;
desc.maxValue = 6;
desc.description = "Onset Detection Function Type";
desc.minValue = 0;
desc.maxValue = 6;
- desc.defaultValue = (int)aubio_onset_
mkl
;
+ desc.defaultValue = (int)aubio_onset_
complex
;
desc.isQuantized = true;
desc.quantizeStep = 1;
desc.valueNames.push_back("Energy Based");
desc.isQuantized = true;
desc.quantizeStep = 1;
desc.valueNames.push_back("Energy Based");
@@
-253,7
+241,9
@@
Onset::process(float **inputBuffers, Vamp::RealTime /* timestamp */)
FeatureSet returnFeatures;
if (isonset) {
FeatureSet returnFeatures;
if (isonset) {
- returnFeatures[0].push_back(Feature());
+ Feature onsettime;
+ onsettime.hasTimestamp = false;
+ returnFeatures[0].push_back(onsettime);
}
Feature feature;
for (size_t j = 0; j < m_channelCount; ++j) {
}
Feature feature;
for (size_t j = 0; j < m_channelCount; ++j) {