Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Support for minimum music segment length complete

  • Loading branch information...
commit 5febc8226856567db67602a11033dfebcb32471b 1 parent 935d992
Yves Raimond moustaki authored
Showing with 3 additions and 8 deletions.
  1. +3 −8 SpeechMusicSegmenter.cpp
11 SpeechMusicSegmenter.cpp
View
@@ -26,7 +26,7 @@ SpeechMusicSegmenter::SpeechMusicSegmenter(float inputSampleRate) :
margin(14),
change_threshold(0.0781),
decision_threshold(0.2734),
- min_music_length(30)
+ min_music_length(0)
// Also be sure to set your plugin parameters (presumably stored
// in member variables) to their default values here -- the host
// will not do that for you
@@ -361,13 +361,7 @@ SpeechMusicSegmenter::getRemainingFeatures()
mean /= resolution;
if ((n > 0 && std::abs(mean - old_mean) > change_threshold) || n == 0) {
Feature feature; feature.hasTimestamp = true;
- int segment_start_frame;
- if (n > 0) {
- segment_start_frame = (n * resolution + resolution / 2.0) * m_blockSize;
- } else {
- segment_start_frame = 0;
- }
- feature.timestamp = Vamp::RealTime::frame2RealTime(segment_start_frame, static_cast<unsigned int>(m_inputSampleRate));
+ feature.timestamp = Vamp::RealTime::frame2RealTime((n * resolution + resolution / 2.0) * m_blockSize, static_cast<unsigned int>(m_inputSampleRate));
vector<float> floatval;
floatval.push_back(mean);
if (mean < decision_threshold) {
@@ -382,6 +376,7 @@ SpeechMusicSegmenter::getRemainingFeatures()
) {
features[0].pop_back();
} else {
+ if (features[0].size() == 0) feature.timestamp = Vamp::RealTime::fromSeconds(0);
features[0].push_back(feature);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.