projects
/
vamp-aubio-plugins.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Get Onset and Notes to build against new aubio
[vamp-aubio-plugins.git]
/
plugins
/
Onset.cpp
diff --git
a/plugins/Onset.cpp
b/plugins/Onset.cpp
index
5aa318e
..
8d91587
100644
(file)
--- a/
plugins/Onset.cpp
+++ b/
plugins/Onset.cpp
@@
-25,14
+25,12
@@
using std::endl;
Onset::Onset(float inputSampleRate) :
Plugin(inputSampleRate),
m_ibuf(0),
Onset::Onset(float inputSampleRate) :
Plugin(inputSampleRate),
m_ibuf(0),
- m_fftgrain(0),
m_onset(0),
m_onset(0),
- m_pv(0),
- m_peakpick(0),
m_onsetdet(0),
m_onsettype(OnsetComplex),
m_threshold(0.3),
m_onsetdet(0),
m_onsettype(OnsetComplex),
m_threshold(0.3),
- m_silence(-90)
+ m_silence(-70),
+ m_minioi(4)
{
}
{
}
@@
-41,9
+39,6
@@
Onset::~Onset()
if (m_onsetdet) del_aubio_onset(m_onsetdet);
if (m_ibuf) del_fvec(m_ibuf);
if (m_onset) del_fvec(m_onset);
if (m_onsetdet) del_aubio_onset(m_onsetdet);
if (m_ibuf) del_fvec(m_ibuf);
if (m_onset) del_fvec(m_onset);
- if (m_fftgrain) del_cvec(m_fftgrain);
- if (m_pv) del_aubio_pvoc(m_pv);
- if (m_peakpick) del_aubio_peakpicker(m_peakpick);
}
string
}
string
@@
-95,10
+90,6
@@
Onset::initialise(size_t channels, size_t stepSize, size_t blockSize)
m_ibuf = new_fvec(stepSize);
m_onset = new_fvec(1);
m_ibuf = new_fvec(stepSize);
m_onset = new_fvec(1);
- m_fftgrain = new_cvec(blockSize);
- m_pv = new_aubio_pvoc(blockSize, stepSize);
- m_peakpick = new_aubio_peakpicker();
- aubio_peakpicker_set_threshold(m_peakpick, m_threshold);
m_onsetdet = new_aubio_onset
(const_cast<char *>(getAubioNameForOnsetType(m_onsettype)),
m_onsetdet = new_aubio_onset
(const_cast<char *>(getAubioNameForOnsetType(m_onsettype)),
@@
-106,6
+97,10
@@
Onset::initialise(size_t channels, size_t stepSize, size_t blockSize)
stepSize,
lrintf(m_inputSampleRate));
stepSize,
lrintf(m_inputSampleRate));
+ aubio_onset_set_threshold(m_onsetdet, m_threshold);
+ aubio_onset_set_silence(m_onsetdet, m_silence);
+ aubio_onset_set_minioi(m_onsetdet, m_minioi);
+
m_delay = Vamp::RealTime::frame2RealTime(4 * stepSize,
lrintf(m_inputSampleRate));
m_delay = Vamp::RealTime::frame2RealTime(4 * stepSize,
lrintf(m_inputSampleRate));
@@
-140,7
+135,7
@@
Onset::getParameterDescriptors() const
desc.identifier = "onsettype";
desc.name = "Onset Detection Function Type";
desc.minValue = 0;
desc.identifier = "onsettype";
desc.name = "Onset Detection Function Type";
desc.minValue = 0;
- desc.maxValue =
6
;
+ desc.maxValue =
7
;
desc.defaultValue = (int)OnsetComplex;
desc.isQuantized = true;
desc.quantizeStep = 1;
desc.defaultValue = (int)OnsetComplex;
desc.isQuantized = true;
desc.quantizeStep = 1;
@@
-151,6
+146,7
@@
Onset::getParameterDescriptors() const
desc.valueNames.push_back("Phase Deviation");
desc.valueNames.push_back("Kullback-Liebler");
desc.valueNames.push_back("Modified Kullback-Liebler");
desc.valueNames.push_back("Phase Deviation");
desc.valueNames.push_back("Kullback-Liebler");
desc.valueNames.push_back("Modified Kullback-Liebler");
+ desc.valueNames.push_back("Spectral Flux");
list.push_back(desc);
desc = ParameterDescriptor();
list.push_back(desc);
desc = ParameterDescriptor();
@@
-167,11
+163,22
@@
Onset::getParameterDescriptors() const
desc.name = "Silence Threshold";
desc.minValue = -120;
desc.maxValue = 0;
desc.name = "Silence Threshold";
desc.minValue = -120;
desc.maxValue = 0;
- desc.defaultValue = -
9
0;
+ desc.defaultValue = -
7
0;
desc.unit = "dB";
desc.isQuantized = false;
list.push_back(desc);
desc.unit = "dB";
desc.isQuantized = false;
list.push_back(desc);
+ desc = ParameterDescriptor();
+ desc.identifier = "minioi";
+ desc.name = "Minimum Inter-Onset Interval";
+ desc.minValue = 0;
+ desc.maxValue = 40;
+ desc.defaultValue = 4;
+ desc.unit = "ms";
+ desc.isQuantized = true;
+ desc.quantizeStep = 1;
+ list.push_back(desc);
+
return list;
}
return list;
}
@@
-184,6
+191,8
@@
Onset::getParameter(std::string param) const
return m_threshold;
} else if (param == "silencethreshold") {
return m_silence;
return m_threshold;
} else if (param == "silencethreshold") {
return m_silence;
+ } else if (param == "minioi") {
+ return m_minioi;
} else {
return 0.0;
}
} else {
return 0.0;
}
@@
-201,11
+210,14
@@
Onset::setParameter(std::string param, float value)
case 4: m_onsettype = OnsetPhase; break;
case 5: m_onsettype = OnsetKL; break;
case 6: m_onsettype = OnsetMKL; break;
case 4: m_onsettype = OnsetPhase; break;
case 5: m_onsettype = OnsetKL; break;
case 6: m_onsettype = OnsetMKL; break;
+ case 7: m_onsettype = OnsetSpecFlux; break;
}
} else if (param == "peakpickthreshold") {
m_threshold = value;
} else if (param == "silencethreshold") {
m_silence = value;
}
} else if (param == "peakpickthreshold") {
m_threshold = value;
} else if (param == "silencethreshold") {
m_silence = value;
+ } else if (param == "minioi") {
+ m_minioi = value;
}
}
}
}
@@
-248,13
+260,7
@@
Onset::process(const float *const *inputBuffers,
aubio_onset_do(m_onsetdet, m_ibuf, m_onset);
aubio_onset_do(m_onsetdet, m_ibuf, m_onset);
- bool isonset = aubio_peakpick_pimrt(m_onset, m_peakpick);
-
- if (isonset) {
- if (aubio_silence_detection(m_ibuf, m_silence)) {
- isonset = false;
- }
- }
+ bool isonset = m_onset->data[0];
FeatureSet returnFeatures;
FeatureSet returnFeatures;
@@
-268,12
+274,13
@@
Onset::process(const float *const *inputBuffers,
m_lastOnset = timestamp;
}
}
m_lastOnset = timestamp;
}
}
+/*!!! todo!
Feature feature;
for (size_t j = 0; j < m_channelCount; ++j) {
feature.values.push_back(m_onset->data[j][0]);
}
returnFeatures[1].push_back(feature);
Feature feature;
for (size_t j = 0; j < m_channelCount; ++j) {
feature.values.push_back(m_onset->data[j][0]);
}
returnFeatures[1].push_back(feature);
-
+*/
return returnFeatures;
}
return returnFeatures;
}