From 6a9e9a8f44ca5b9996acd239ddb16ee4f00f00d5 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 21 Nov 2013 16:10:21 +0000 Subject: intensity segmenter level redistribution --- rotord/src/nodes_audio_analysis.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'rotord/src/nodes_audio_analysis.cpp') diff --git a/rotord/src/nodes_audio_analysis.cpp b/rotord/src/nodes_audio_analysis.cpp index 6ec1188..ad6f5ad 100644 --- a/rotord/src/nodes_audio_analysis.cpp +++ b/rotord/src/nodes_audio_analysis.cpp @@ -178,9 +178,29 @@ namespace Rotor{ } //sort and convert to features std::sort(totals.begin(),totals.end(),sortsegments); + vector bucketoffsets; + for (auto t:totals) bucketoffsets.push_back(0.0f); + if (parameters["levels"]->value>0.0f&¶meters["levels"]->valuevalue); + int numberperbin=ceil((float)numbertoredistribute/totals.size()); + int added=0; + for (int j=0;j0) { + cerr<<"reducing number of levels by "< Date: Fri, 22 Nov 2013 14:18:24 +0000 Subject: intensity segmenter levels --- rotord/src/nodes_audio_analysis.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'rotord/src/nodes_audio_analysis.cpp') diff --git a/rotord/src/nodes_audio_analysis.cpp b/rotord/src/nodes_audio_analysis.cpp index ad6f5ad..5770fb2 100644 --- a/rotord/src/nodes_audio_analysis.cpp +++ b/rotord/src/nodes_audio_analysis.cpp @@ -182,12 +182,14 @@ namespace Rotor{ for (auto t:totals) bucketoffsets.push_back(0.0f); if (parameters["levels"]->value>0.0f&¶meters["levels"]->valuevalue); - int numberperbin=ceil((float)numbertoredistribute/totals.size()); + int numbertoredistribute=totals.size()-((int)parameters["levels"]->value-2); + float numberperbin=((float)numbertoredistribute/totals.size()); + float toadd=0.0f; int added=0; - for (int j=0;j0) { @@ -200,7 +202,7 @@ namespace Rotor{ } for (i=0;i Date: Fri, 22 Nov 2013 15:19:51 +0000 Subject: intensity segmenter update --- rotord/src/nodes_audio_analysis.cpp | 11 +++++++---- rotord/src/nodes_audio_analysis.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'rotord/src/nodes_audio_analysis.cpp') diff --git a/rotord/src/nodes_audio_analysis.cpp b/rotord/src/nodes_audio_analysis.cpp index 5770fb2..9ad33f6 100644 --- a/rotord/src/nodes_audio_analysis.cpp +++ b/rotord/src/nodes_audio_analysis.cpp @@ -69,6 +69,7 @@ namespace Rotor{ bits=_bits; samples=_samples; + features.clear(); return analyser.init(soname,id,_channels,_bits,_samples,_rate,outputNo,params); @@ -167,7 +168,6 @@ namespace Rotor{ if (intensity>max_intensity) max_intensity=intensity; if (intensity> totals; @@ -178,19 +178,22 @@ namespace Rotor{ } //sort and convert to features std::sort(totals.begin(),totals.end(),sortsegments); + for (i=0;i bucketoffsets; for (auto t:totals) bucketoffsets.push_back(0.0f); if (parameters["levels"]->value>0.0f&¶meters["levels"]->valuevalue-2); + int numbertoredistribute=totals.size()-((int)parameters["levels"]->value); float numberperbin=((float)numbertoredistribute/totals.size()); - float toadd=0.0f; + float toadd=0.5f; int added=0; for (int j=0;j0) { cerr<<"reducing number of levels by "< &_settings) { return new Intensity_segmenter(_settings);}; bool init(int _channels,int _bits,int _samples,int _rate) { + features.clear(); return analysers["segmenter"].init("qm-vamp-plugins","qm-segmenter",_channels,_bits,_samples,_rate,0,params)\ &&analysers["tempo"].init("qm-vamp-plugins","qm-tempotracker",_channels,_bits,_samples,_rate,2,params)\ &&analysers["intensity"].init("bbc-vamp-plugins","bbc-intensity",_channels,_bits,_samples,_rate,0,params); -- cgit v1.2.3