From 1d05d2380bb4f1fd265aef55744f432af38b08aa Mon Sep 17 00:00:00 2001 From: Comment Date: Sun, 8 Dec 2013 10:55:03 +0000 Subject: switched signals to double and random to uint16 --- rotord/src/nodes_audio_analysis.cpp | 44 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 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 9ad33f6..a6aa4ec 100644 --- a/rotord/src/nodes_audio_analysis.cpp +++ b/rotord/src/nodes_audio_analysis.cpp @@ -8,7 +8,7 @@ namespace Rotor{ samples=_samples; samples_per_column=samples/width; offset=0x1<<(bits-1); //signed audio - scale=1.0f/offset; + scale=1.0/offset; out_sample=0; //sample in whole track sample=0; @@ -106,7 +106,7 @@ namespace Rotor{ } return data; } - bool sortsegments(std::pair i,std::pair j){ + bool sortsegments(std::pair i,std::pair j){ return (i.second tempos; - vector intensities; - vector times; + double min_tempo=9999999.0; + double min_intensity=9999999.0; + double max_tempo=0.0; + double max_intensity=0.0; + vector tempos; + vector intensities; + vector times; auto g=++analysers["segmenter"].features.begin(); for (auto f=analysers["segmenter"].features.begin();g!=analysers["segmenter"].features.end();f++,g++,i++){ cerr<<"segment "<first<<" to "<first<first); //integrate tempo and intensity algorithmically - float tempo=0; + double tempo=0; if (analysers["tempo"].features.size()) { - float pt=f->first; - float pv=analysers["tempo"].get_value(f->first); + double pt=f->first; + double pv=analysers["tempo"].get_value(f->first); for (auto u=analysers["tempo"].features.upper_bound(f->first);u!=analysers["tempo"].features.upper_bound(g->first);u++){ tempo +=(u->first-pt)*(u->second.values[0]+pv)*0.5f; //area of the slice pt=u->first; @@ -153,10 +153,10 @@ namespace Rotor{ tempos.push_back(tempo); cerr<<"segment "<first; - float pv=analysers["intensity"].get_value(f->first); + double pt=f->first; + double pv=analysers["intensity"].get_value(f->first); for (auto u=analysers["intensity"].features.upper_bound(f->first);u!=analysers["intensity"].features.upper_bound(g->first);u++){ intensity +=(u->first-pt)*(u->second.values[0]+pv)*0.5f; //area of the slice pt=u->first; @@ -170,7 +170,7 @@ namespace Rotor{ intensities.push_back(intensity); } //make relative scale 0.0-1.0 and save weighted totals - vector< pair> totals; + vector< pair> totals; for (i=0;i bucketoffsets; - for (auto t:totals) bucketoffsets.push_back(0.0f); - if (parameters["levels"]->value>0.0f&¶meters["levels"]->value bucketoffsets; + for (auto t:totals) bucketoffsets.push_back(0.0); + if (parameters["levels"]->value>0.0&¶meters["levels"]->valuevalue); - float numberperbin=((float)numbertoredistribute/totals.size()); - float toadd=0.5f; + double numberperbin=((double)numbertoredistribute/totals.size()); + double toadd=0.5f; int added=0; for (int j=0;j