import ddf.minim.*; import ddf.minim.signals.*; import ddf.minim.analysis.*; import ddf.minim.effects.*; // ripples in 3D // by Steven Kay Minim minim; AudioOutput out; SineWave wave; PinkNoise beat; SawWave beatEnv; HighPassSP filter1; FFT fft; int RIPPLES=3; color to=color(0); // bg color cycling extreme colours color from=color(77,0,77); float CYCLEPERIOD=100.0; // bg color cycling speed float DAMPING=0.998; // speed ripples fade at, low value=faster float currentx, currenty; float[][] points = new float[100][2]; int separation; class source{ public float x; public float y; public float amp; public float wavelength; public source(float _x,float _y, float _amp,float _wave) { x=_x;y=_y;amp=_amp;wavelength=_wave; } public float getPart(float xx,float yy,float time) { float distt=mag(xx-x,yy-y); return amp*(float)Math.cos(((time-distt)/wavelength)); } public void fade() { amp*=DAMPING; // damping factor } } ArrayList ripples; void setup() { size(400,400,P3D); sphereDetail(15); frameRate(30); for(int i=0;i100) { // don't bother unless cube bright enough to see :) pushMatrix(); translate(x,y,hite/4); sphere(5); popMatrix(); } else { point(x, y, hite/4); } //} } } // once settled down to a calm sea, start again if (totalAmp<2000.0) { print ("Settled down, start again"); reset(); } else { //if (frameCount%10==0) print ("TotalAmp="+totalAmp+"\n"); ; } } void stop() { out.close(); minim.stop(); super.stop(); } void keyPressed() { if(key == 'w'){ currenty-=separation; } else if(key == 's'){ currenty+=separation; } else if(key == 'a'){ currentx-=separation; } else if(key == 'd'){ currentx+=separation; } }