From 858cb95b8539f5695c5348c340b9f982d8b66719 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Tue, 29 Oct 2013 14:45:49 +0000 Subject: making intensity segmenter --- rotord/src/nodes_audio_analysis.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 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 220f14b..1e65668 100644 --- a/rotord/src/nodes_audio_analysis.cpp +++ b/rotord/src/nodes_audio_analysis.cpp @@ -83,11 +83,11 @@ namespace Rotor{ } void Vamp_node::cleanup() { analyser.cleanup(); - //print_features(); + features=analyser.features; } string Vamp_node::get_features(){ string data; - for (auto i: analyser.features) { + for (auto i: features) { data=data+" ["+toString(i.second.number)+":"+toString(i.first); if (i.second.values.size()) { data+=" ("; -- cgit v1.2.3 From b3abde4531510b7accbc58174ecd9ec27c52ee3a Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Wed, 30 Oct 2013 14:15:47 +0000 Subject: intensity segmenter --- rotord/src/nodes_audio_analysis.cpp | 80 +++++++++++++++++++++++++++++++++++++ rotord/src/nodes_audio_analysis.h | 20 +++------- 2 files changed, 85 insertions(+), 15 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 1e65668..5318bb1 100644 --- a/rotord/src/nodes_audio_analysis.cpp +++ b/rotord/src/nodes_audio_analysis.cpp @@ -105,4 +105,84 @@ namespace Rotor{ } return data; } + bool sortsegments(std::pair i,std::pair j){ + return (i.second tempos; + vector intensities; + vector times; + 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; + if (analysers["tempo"].features.size()) { + float pt=f->first; + float 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; + pv=u->second.values[0]; + } + tempo +=(g->first-pt)*(analysers["tempo"].get_value(g->first)+pv)*0.5f; //area of the last slice + tempo /=g->first-f->first; //average value; + } + if (tempo>max_tempo) max_tempo=tempo; + if (tempofirst; + float 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; + pv=u->second.values[0]; + } + intensity +=(g->first-pt)*(analysers["intensity"].get_value(g->first)+pv)*0.5f; //area of the last slice + intensity /=g->first-f->first; //average value; + } + if (intensity>max_intensity) max_intensity=intensity; + if (intensity> totals; + for (i=0;ivalue)+(intensities[i]*parameters["intensity_weight"]->value))); + } + //sort and convert to features + std::sort(totals.begin(),totals.end(),sortsegments); + for (int i=0;i &settings):Intensity_segmenter() { base_settings(settings); @@ -306,21 +308,7 @@ namespace Rotor { analysers["intensity"].process_frame(data,samples_in_frame); return 1; } - void cleanup(){ - //for (auto a:analysers) a.second.cleanup(); //WHY NOT WORK - its as if the call is const - analysers["segmenter"].cleanup(); - analysers["tempo"].cleanup(); - analysers["intensity"].cleanup(); - cerr< Date: Thu, 31 Oct 2013 12:57:59 +0000 Subject: thumbnail stills and svgs --- install_dependencies_linux.sh | 9 ++++++++- rotord/src/graph.h | 38 ++++++++++++++++++++++++++++++++++++- rotord/src/nodes_audio_analysis.cpp | 2 +- rotord/src/nodes_drawing.h | 7 +++++-- rotord/src/rotor.h | 1 + 5 files changed, 52 insertions(+), 5 deletions(-) (limited to 'rotord/src/nodes_audio_analysis.cpp') diff --git a/install_dependencies_linux.sh b/install_dependencies_linux.sh index b9ca61f..c9fdfbf 100755 --- a/install_dependencies_linux.sh +++ b/install_dependencies_linux.sh @@ -69,4 +69,11 @@ sudo apt-get -y install libjsoncpp0 libjsoncpp-dev sudo mkdir /usr/lib/vamp sudo cp qm-vamp-plugins-1.7-amd64-linux/* /usr/lib/vamp -sudo apt-get install librsvg2-2 librsvg2-dev +git clone https://github.com/bbcrd/bbc-vamp-plugins.git +cd bbc-vamp-plugins +make -f Makefile.linux +sudo mv bbc-vamp-plugins.so bbc-vamp-plugins.cat bbc-vamp-plugins.n3 /usr/local/lib/vamp/ +cd .. +sudo rm -r bbc-vamp-plugins + +sudo apt-get -y install librsvg2-2 librsvg2-dev diff --git a/rotord/src/graph.h b/rotord/src/graph.h index 6f2ee79..2f8843d 100644 --- a/rotord/src/graph.h +++ b/rotord/src/graph.h @@ -97,6 +97,43 @@ namespace Rotor { class Thumbnailer{ public: bool make(const string &inputfilename,int w,int h,const string &outputfilename) { + Poco::StringTokenizer t1(inputfilename,"."); + if (t1.count()>1) { + if (t1[t1.count()-1]=="svg"){ + cerr<<"found an svg"< 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); diff --git a/rotord/src/nodes_drawing.h b/rotord/src/nodes_drawing.h index b26841e..1bd6375 100644 --- a/rotord/src/nodes_drawing.h +++ b/rotord/src/nodes_drawing.h @@ -3,7 +3,6 @@ #include "rotor.h" #include -#include namespace Rotor { class Draw_node: public Image_node { @@ -217,6 +216,7 @@ namespace Rotor { }; class Svg: public Draw_node { public: + //rsvg should be cleanup? Svg(){ title="SVG"; description="Draws svg files"; @@ -238,7 +238,10 @@ namespace Rotor { } else cerr<<"Rotor: SVG failed to load "<value< &_settings) { return new Svg(_settings);}; void vector_output(cairo_t * cr,const Frame_spec &frame){ //to make it resolution independent diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h index f179efd..50ae266 100644 --- a/rotord/src/rotor.h +++ b/rotord/src/rotor.h @@ -75,6 +75,7 @@ Requirements #include #include +#include #include "Poco/Net/HTTPResponse.h" #include "Poco/Logger.h" -- cgit v1.2.3