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 & HelpVideo Capture,  Movie Playback,  Vision Libraries › help with speeding up process(video + sonia)
Page Index Toggle Pages: 1
help with speeding up process(video + sonia) (Read 290 times)
help with speeding up process(video + sonia)
Mar 30th, 2008, 4:26pm
 
hello there, this is my first message on this board, so please forgive any errors i make etc. I am creating a project that capture sound and uses this to alter the image of a live input (web cam)using the video library and sonia

Here is the code-
-----------------------------------------------------------

import pitaru.sonia_v2_9.*;
import processing.video.*;

Capture cam;

void setup(){
 size(640,480);
 background(0);
   cam = new Capture(this, 640, 480);
   loadPixels();
 
 frameRate(10);
 Sonia.start(this);
 LiveInput.start(32);
 
}

void draw(){
 background(0);
 LiveInput.getSpectrum();
 
   for(int a=1;a<32;a+=1){
     circleStrip(a*20, LiveInput.spectrum[a]);
     
   }
}

void circleStrip(int stripLoc, float spectrumData){
   
   for (int i = -20; i < height ; i+=20){
     int j = stripLoc;
   
     noStroke();

     int intspectrumdata = int(spectrumData);
 
     noStroke();
     
     cam.read();
     color d = cam.get(j, i);
       
      fill(d, 50);
      rectMode(CENTER);
     rect (j, i , 30 + intspectrumdata, 30 + intspectrumdata);
   
   }
}
-----------------------------------------------------------

My major problem is that it i am only receiving an image every 7 seconds, and i would preferably have two every second, in order to speed it up i can use less channels (16 instead of 32), or use a faster computer, but i was wandering if anybody knew of a way to speed it up in other ways such as code structure, retaining the image quality,  any help would be greatly appreciated ,

many thanks
Page Index Toggle Pages: 1