We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › Total Newbie 3d Vizualization
Page Index Toggle Pages: 1
Total Newbie 3d Vizualization (Read 656 times)
Total Newbie 3d Vizualization
Aug 31st, 2009, 4:20pm
 
Hi there-

The project I am working on is by no means a new idea-Audio visualization. However, my end goal is to take the generated surface data and export it as a dxf. I've gotten as far as exporting a single frame of data at 44100*sec rate. However, I will need this number to be much less (30*sec) as the mesh density would be ridiculously huge at that size. Anywhos-So yeah, I can grab a single frame by using the key press command=record=true function, but 2 hurdles I am facing:
-Compile the stream and record as one constant DXF file. (I was able to set it to record a DXF for as long as my 'R' key was pressed, but it was in the format of 'Output-###.dxf' and wound up giving me hundred of dxf files for either frame. I suppose I could import each frame to Rhino using the import function, but it would take forever considering the amount of data this stream generates.

I'd like to limit the sample to around 10 fps as any bigger than that will generate a hell of a mesh.

-With each step, I need to create a Z++ type step so the next frame is created on the z=0 frame and the previous step back in space +1. I have no idea how to start that. but I'm sure I can figure it out.

The code is below. Please don't give me the complete answer as part of this is I want to learn from my mistakes. But a hint here or there would be really appreciated-.

import processing.opengl.*;
import pitaru.sonia_v2_9.*;
import processing.dxf.*;
boolean record=false;

Sample mySoundObj;


void setup(){
 size(1020,300, P3D);
 Sonia.start(this);
 LiveInput.start(256);
 LiveInput.useEqualizer(true);
 LiveInput.useEnvelope(true, 100);
 int recTimeSec = 10;
 mySoundObj = new Sample(44100*recTimeSec);
}

void draw(){
 if (record == true) {
   beginRaw(DXF, "img/output.dxf");
 }
 background(0);
 getSpectrum(); // Show FFT reading
 if (record == true) {
   endRaw();
   record = false;
 }
}

void getSpectrum(){
 strokeWeight(2);
 stroke(5,44,255);
 LiveInput.getSpectrum();
 for ( int i = 0; i < LiveInput.spectrum.length; i++){
   line(i*4, height, i*4, 250 - LiveInput.spectrum[i]/4);
 }
}

void keyPressed() {
 if (key == 'R' || key == 'r') {
   record = true;
 }
}


void mousePressed(){
 LiveInput.startRec(mySoundObj);
 print("REC");
}
void mouseReleased(){
 LiveInput.stopRec(mySoundObj);
 mySoundObj.play();
 print("PLAY");
}


public void stop(){
 Sonia.stop();
 super.stop();
}

//////////////////////////////////////////////////end!

Thanks for any and all input. you can reply direct at gabriel at gabrielmathews dot com.
Page Index Toggle Pages: 1