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 & HelpSound,  Music Libraries › ESS audio input not working
Page Index Toggle Pages: 1
ESS audio input not working (Read 597 times)
ESS audio input not working
Jan 9th, 2010, 2:41pm
 
This is basically an audio input that generates shapes based on frequency...
Been getting these errors with previously functioning processing projects: line unsupported: interface TargetDataLine supporting format PCM_SIGNED 44100.0 Hz... I believe it used to work on a previous version of processing, so did some of my code get obsolete? Error is on line 42

Code:
import krister.Ess.*;

int bufferSize;
int steps;
float limitDiff;
int numAverages=32;
float myDamp=.1f;
float maxLimit,minLimit;

FFT myFFT;
AudioInput myInput;

void setup () {
 size(800,600);

 // start up Ess
 Ess.start(this);  

 // set up our AudioInput
 bufferSize=512;
 myInput=new AudioInput(bufferSize);

 // set up our FFT
 myFFT=new FFT(bufferSize*2);
 myFFT.equalizer(true);

 // set up our FFT normalization/dampening
 minLimit=.005;
 maxLimit=.05;
 myFFT.limits(minLimit,maxLimit);
 myFFT.damp(myDamp);
 myFFT.averages(numAverages);

 // get the number of bins per average
 steps=bufferSize/numAverages;

 // get the distance of travel between minimum and maximum limits
 limitDiff=maxLimit-minLimit;

 frameRate(25);        

 myInput.start();
}

void draw() {
  //rotate(90);
 background(0);
 colorMode(HSB, 400);
 smooth();
//line(0,500,50,-myFFT.spectrum[5]*500);

for (int i=0; i<bufferSize; i+=10) {
   //pushMatrix();
   
  int mycolor= round(myFFT.spectrum[i]*2000);
   noStroke();
   fill(mycolor-200,250,mycolor);
   println("mycolor is equal to "+mycolor);
   for(int y=1; y<=40; y+=2){
     
      ellipse(2*i, y*20, 70-mycolor/15, 70-mycolor/15);
   }
 
   //scale(1.1);
  // rotate(.4);
   //popMatrix();
   
//    }
 }

}
public void audioInputData(AudioInput theInput) {
 myFFT.getSpectrum(myInput);
}
Page Index Toggle Pages: 1