diff options
| author | Tim Redfern <tim@getdrop.com> | 2018-05-24 22:02:36 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@getdrop.com> | 2018-05-24 22:02:36 +0100 |
| commit | 404ae5da503cb6856b73b2638abb8785f6c47f6d (patch) | |
| tree | ebdb680f31229d5932a5516a5573fb5dc9a4943d /gistanalysis | |
| parent | 5d13e1e25db4bc1627873485d1164e641f6ef19f (diff) | |
can draw dots
Diffstat (limited to 'gistanalysis')
| -rw-r--r-- | gistanalysis/notes | 20 | ||||
| -rw-r--r-- | gistanalysis/src/ofApp.cpp | 16 | ||||
| -rw-r--r-- | 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 <colourPolyline> 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 <colourPolyline> &output(const ofMatrix4x4 xform=ofMatrix4x4(1.0f,0.0f,0.0f,0.0f, + vector <colourPolyline> 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 <colourPolyline> outdata; + for (int i=0;i<data.size();i++){ - data[i]=lineTransformer::polyLineTransform(xform,data[i],fadefactor); + vector <colourPolyline> newdata; + for (int j=0;j<data[i].size();j++){ + colourPolyline line=lineTransformer::polyLineTransform(xform,data[i][j],fadefactor); + newdata.push_back(line); + outdata.push_back(line); + } + data[i]=newdata; } - - return data; + return outdata; } void addpoints(vector <float> &audio,int number){ - colourPolyline newdata; int num=min(number,(int)audio.size()); int step=audio.size()/(num+1); - for (int i=0;i<num;i++){ - newdata.addVertex(((step*(i+1))*ofGetWidth())/audio.size(),audio[step*(i+1)]*ofGetHeight(),colour); - if (!joined){ - newdata.addVertex((((step*(i+1))*ofGetWidth())/audio.size())+5,(audio[step*(i+1)])*ofGetHeight(),0,0,0); + vector <colourPolyline> newdata; + if (joined){ + colourPolyline line; + for (int i=0;i<num;i++){ + line.addVertex(((step*(i+1))*ofGetWidth())/audio.size(),audio[step*(i+1)]*ofGetHeight(),colour); + } + newdata.push_back(line); + } + else{ + for (int i=0;i<num;i++){ + colourPolyline line; + line.addVertex(((step*(i+1))*ofGetWidth())/audio.size(),audio[step*(i+1)]*ofGetHeight(),colour); + line.addVertex(((step*(i+1))*ofGetWidth())/audio.size()+2,audio[step*(i+1)]*ofGetHeight(),colour); + newdata.push_back(line); } } data.insert(data.begin(),newdata); while (data.size()>history_size) { data.pop_back(); } - } int numpoints(){ int num=0; @@ -74,7 +89,7 @@ public: return num; } private: - vector <colourPolyline> data; + vector < vector<colourPolyline>> data; bool joined; int history_size; ofColor colour; @@ -157,6 +172,7 @@ class ofApp : public ofBaseApp, public ofxMidiListener{ ofxPanel gui; + ofParameter<bool> joined; ofParameter<int> numPlots; ofParameter<float> scalePlot; ofParameter<float> decayPlot; |
