{"id":315,"date":"2009-03-06T22:11:38","date_gmt":"2009-03-07T03:11:38","guid":{"rendered":"http:\/\/gracefulspoon.com\/blog\/?p=315"},"modified":"2015-02-23T18:15:14","modified_gmt":"2015-02-23T23:15:14","slug":"iggy-wave","status":"publish","type":"post","link":"http:\/\/gracefulspoon.com\/blog\/2009\/03\/06\/iggy-wave\/","title":{"rendered":"iggy wave"},"content":{"rendered":"

\"dog\"<\/a>
\n“Now I Wanna Be Your Dog” as a 3d landscape. I was using the
minim library<\/a> in processing to visualize the sound level data stream, then exporting out to rhino. Many thanks to the proxyarch team for help with the code.<\/p>\n

 <\/div>\n

EDIT:
\nAdded link to processing app, see it in action (loud rock music will begin playing…so turn it up!)<\/p>\n

 <\/div>\n

http:\/\/gracefulspoon.com\/processingapps\/singlewave\/index.html<\/a><\/p>\n

 <\/div>\n

\"processingapp\"<\/a><\/p>\n


\nimport processing.dxf.*;
\nimport ddf.minim.analysis.*;
\nimport ddf.minim.*;
\nFFT fftLin;
\nFFT fftLog;<\/p>\n

Waveform myRects;<\/p>\n

Minim minim;
\nAudioPlayer groove;<\/p>\n

boolean record;<\/p>\n

void setup(){
\n size(1000, 500, P3D);
\n noStroke();
\n minim = new Minim(this);
\n groove = minim.loadFile(“groove.mp3”);
\n groove.loop();
\n background(255);<\/p>\n

fftLog = new FFT(groove.bufferSize(), groove.sampleRate());
\n fftLog.logAverages(22, 4); \/\/adjust spacing here<\/p>\n

float w = float(width\/fftLog.avgSize());
\n float x = w;
\n float y = 0;
\n float z = 50;
\n float radius = 10;
\n myRects = new Waveform(x,y,z,radius);
\n}<\/p>\n

void draw(){
\n background(0);
\n directionalLight(126,126,126,sin(radians(frameCount)),cos(radians(frameCount)),1);
\n ambientLight(102,102,102);<\/p>\n

float zoom = 1000;
\n PVector foc = new PVector(myRects.x*0.5, myRects.y*0.5, 0);
\n PVector cam = new PVector(zoom*sin(radians(frameCount)), zoom*cos(radians(frameCount)), -zoom);
\n camera(foc.x+cam.x,foc.y+cam.y,foc.z+cam.z,foc.x,foc.y,foc.z,0,0,1);<\/p>\n

\/\/play the song
\n fftLog.forward(groove.mix);<\/p>\n

myRects.update();<\/p>\n

if(record){
\n beginRaw(DXF, “output.dxf”);
\n }
\n \/\/ DXF will export the stuff drawn between here.<\/p>\n

myRects.plotTrace();<\/p>\n

if(record){
\n endRaw();
\n record = false;
\n println(“Done DXF~!”);
\n }
\n}<\/p>\n

void stop() {
\n \/\/ always close Minim audio classes when you finish with them
\n groove.close();
\n \/\/ always stop Minim before exiting
\n minim.stop();
\n super.stop();
\n}<\/p>\n

class Waveform{
\n float x,y,z;
\n float radius;<\/p>\n

PVector[] pts = new PVector[fftLog.avgSize()];<\/p>\n

PVector[] trace = new PVector[0];<\/p>\n

Waveform(float incomingX, float incomingY, float incomingZ, float incomingRadius){
\n x = incomingX;
\n y = incomingY;
\n z = incomingZ;
\n radius = incomingRadius;
\n }<\/p>\n

void update(){
\n plot();
\n }<\/p>\n

void plot(){
\n for(int i = 0; i < fftLog.avgSize(); i++){\n int w = int(width\/fftLog.avgSize());\n \n x = i*w;\n y = frameCount*5;\n z = height\/4-fftLog.getAvg(i)*10;\n \n stroke(0);\n point(x, y, z);\n pts[i] = new PVector(x, y, z);\n \n trace = (PVector[]) expand(trace, trace.length+1);\n trace[trace.length-1] = new PVector(pts[i].x, pts[i].y, pts[i].z);\n \n }\n }\n \n void plotTrace(){\n \/*\n \/\/drawing points\n for(int i=0; i\n","protected":false},"excerpt":{"rendered":"

“Now I Wanna Be Your Dog” as a 3d landscape. I was using the minim library in processing to visualize the sound level data stream, then exporting out to rhino. Many thanks to the proxyarch team for help with the code.   EDIT: Added link to processing app, see it in action (loud rock music […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10,12,9,15],"tags":[77,80,76,85,92],"_links":{"self":[{"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/posts\/315"}],"collection":[{"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/comments?post=315"}],"version-history":[{"count":10,"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/posts\/315\/revisions"}],"predecessor-version":[{"id":3854,"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/posts\/315\/revisions\/3854"}],"wp:attachment":[{"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/media?parent=315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/categories?post=315"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/gracefulspoon.com\/blog\/wp-json\/wp\/v2\/tags?post=315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}