Processing Codes

I have manipulated a code from sonita in order to response it to sound more precise. I also changed the way it looks. Here is the code:


import pitaru.sonia_v2_9.*; // automcatically added when importing the library from the processing menu.

void setup(){
//size(1024,600,P3D);
size(1024,600);
Sonia.start(this); // Start Sonia engine.
LiveInput.start(32); // Start LiveInput and return 32 FFT frequency bands.
smooth ();
frameRate(30);
}

void draw(){

background(70,190,255);
getMeterLevel(); // Show meter-level reading for Left/Right channels.
getSpectrum(); // Show FFT reading

}

void getSpectrum(){
strokeWeight(0);
stroke(30,90,120);

LiveInput.getSpectrum();

for ( int i = 0; i < LiveInput.spectrum.length; i++){

line(i*32, height, i*32, height - LiveInput.spectrum[i]/1);
strokeWeight(12);

}
}

void getMeterLevel(){

}

// Safely close the sound engine
public void stop(){
Sonia.stop();
super.stop();
}

0 Comments:

Post a Comment

<< Home