From 404ae5da503cb6856b73b2638abb8785f6c47f6d Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 24 May 2018 22:02:36 +0100 Subject: can draw dots --- gistanalysis/notes | 20 +++++++++++++++++++- gistanalysis/src/ofApp.cpp | 16 +++++++++------- gistanalysis/src/ofApp.h | 38 +++++++++++++++++++++++++++----------- 3 files changed, 55 insertions(+), 19 deletions(-) diff --git a/gistanalysis/notes b/gistanalysis/notes index 18b7564..8b2a7d7 100644 --- a/gistanalysis/notes +++ b/gistanalysis/notes @@ -49,4 +49,22 @@ we could draw fft bars we could graduate the colours -make a realistic breakdown between technicalities (ie audio, mapping) and content \ No newline at end of file +make a realistic breakdown between technicalities (ie audio, mapping) and content + +a better way to plan scanning area not pixel based? guess warp scale is ok for now +subtlety not really the thing? +drawing dots would be good. +warping dots in interesting ways +wraparound +other kinds of audio analysis + + + +1- make dots work (+mirror?) - why- atm does it not +2- an FFT thing with bars, similar, what's the ideal interface + +- audio input +- mapping +- fix length overlap + + diff --git a/gistanalysis/src/ofApp.cpp b/gistanalysis/src/ofApp.cpp index ab5f374..59e7bdd 100644 --- a/gistanalysis/src/ofApp.cpp +++ b/gistanalysis/src/ofApp.cpp @@ -17,9 +17,7 @@ void ofApp::setup(){ bufferSize = 512; sampleRate = 44100; - - - + useMic = 1; isPaused = 0; @@ -49,6 +47,7 @@ void ofApp::setup(){ gui.setup("panel"); // most of the time you don't need a name but don't forget to call setup + gui.add(joined.set("joined",true)); gui.add(numPlots.set("num plots", 50, 1, 256)); gui.add(scalePlot.set( "scale plot", 0.1f, 0.0f, 1.0f )); gui.add(decayPlot.set( "decay", 0.9f, 0.0f, 1.0f )); @@ -71,7 +70,7 @@ void ofApp::setup(){ ofAddListener(GistEvent::ON,this,&ofApp::onNoteOn); ofAddListener(GistEvent::OFF,this,&ofApp::onNoteOff); - + noteOnRadius = 0; @@ -278,11 +277,14 @@ void ofApp::drawOutput(ofEventArgs & args){ } */ + + plotter.set_joined(joined); + ofMatrix4x4 _xform; _xform.makeTranslationMatrix(xform->x,xform->y,0); - auto lines=plotter.output(_xform,scalePlot,decayPlot); - laser.draw(lines,30); + vector lines=plotter.output(_xform,scalePlot,decayPlot); + int num=laser.draw(lines,30); ofTranslate(0,ofGetHeight()/2); @@ -290,7 +292,7 @@ void ofApp::drawOutput(ofEventArgs & args){ line->draw(); } - ofSetWindowTitle(ofToString(ofGetFrameRate())+" fps, "+ofToString(plotter.numpoints())+" pts"); + ofSetWindowTitle(ofToString(ofGetFrameRate())+" fps, "+ofToString(num)+" pts"); } //-------------------------------------------------------------- diff --git a/gistanalysis/src/ofApp.h b/gistanalysis/src/ofApp.h index eca2a91..59bbfe6 100644 --- a/gistanalysis/src/ofApp.h +++ b/gistanalysis/src/ofApp.h @@ -35,7 +35,7 @@ public: void set_joined(bool _joined){ joined=_joined; } - const vector &output(const ofMatrix4x4 xform=ofMatrix4x4(1.0f,0.0f,0.0f,0.0f, + vector output(const ofMatrix4x4 xform=ofMatrix4x4(1.0f,0.0f,0.0f,0.0f, 0.0f,1.0f,0.0f,0.0f, 0.0f,0.0f,1.0f,0.0f, 0.0f,0.0f,0.0f,1.0f), @@ -44,27 +44,42 @@ public: //destructive or non? float fadefactor=decay<0.0f?1.0f-(1.0f/history_size):decay; + vector outdata; + for (int i=0;i newdata; + for (int j=0;j &audio,int number){ - colourPolyline newdata; int num=min(number,(int)audio.size()); int step=audio.size()/(num+1); - for (int i=0;i newdata; + if (joined){ + colourPolyline line; + for (int i=0;ihistory_size) { data.pop_back(); } - } int numpoints(){ int num=0; @@ -74,7 +89,7 @@ public: return num; } private: - vector data; + vector < vector> data; bool joined; int history_size; ofColor colour; @@ -157,6 +172,7 @@ class ofApp : public ofBaseApp, public ofxMidiListener{ ofxPanel gui; + ofParameter joined; ofParameter numPlots; ofParameter scalePlot; ofParameter decayPlot; -- cgit v1.2.3