import pitaru.sonia_v2_9.*; import processing.opengl.*; int ITERATIONS = 32; int SPECT_DEF = 8; int SHAPE_SCALE = 1; int LONG = 4; float circlePoints[][]; float[] data; float a, inc; int f,s; Sample[][] mySample; void setup(){ size(800,600,OPENGL); framerate(60); Sonia.start(this); print("initializing... "); fill(240,240,240); stroke(200,200,200); noStroke(); getCircle(); mySample = new Sample[3][4]; for(f=0; f<3; f++){ for(s=0; s<4; s++){ mySample[f][s] = new Sample("0"+f+"-"+s+".aif"); } } f = 1; LiveInput.start(256); LiveInput.useEnvelope(true,5); for (int i = 0; i < 256; i++){ data[i] = 0; } print("ok"); } void draw(){ background(40); // Get the DATAS from the LIVE LiveInput.getSpectrum(); for (int i = 0; i < 256; i++){ data[i] = (data[i] + LiveInput.spectrum[i])/2; } pointLight(255, 255, 255, 0, 0, 0); ambientLight(102, 102, 102); translate(width/2,height/2,0); rotateX(mouseY * 0.01); rotateY(mouseX * 0.01); translate(0, 0, ((-SPECT_DEF*LONG)*(128/SPECT_DEF))); //for each stape for(int i=SPECT_DEF*10; i<256; i+=SPECT_DEF){ //for each face for(int j=0; j4){ITERATIONS--; getCircle();}} if(key=='w' || key=='W') {if(SPECT_DEF<20){SPECT_DEF++;}} if(key=='s' || key=='S') {if(SPECT_DEF>1){SPECT_DEF--;}} if(key=='e' || key=='E') {LONG++;} if(key=='d' || key=='D') {if(LONG>0){LONG--;}} } } void getCircle(){ circlePoints = new float[ITERATIONS][2]; data = new float[256]; a = 0; inc = TWO_PI/ITERATIONS; for(int i=1; i 2){f = 0;} for(s=0; s<3; s++){ mySample[f][s].connectLiveInput(true); mySample[f][s].play(); mySample[f][s].repeat(); } } void keyPressed() { if(keyCode == ESC){ for(s=0; s<3; s++){ mySample[f][s].stop(); } } } // Safely close the sound engine upon Browser shutdown. public void stop(){ Sonia.stop(); super.stop(); }