// + global rotation import processing.opengl.*; import javax.media.opengl.*; import ddf.minim.*; import ddf.minim.analysis.*; PGraphicsOpenGL pgl; GL gl; Minim minim; int maxSeeds = 10; // max seeds int maxCurls = 10; // max number of curls in the colony float baseStrokeWeight = 1.0; // minimum stroke weight float strokeWeightEnergyFactor = 0.02; // relation between energy and stroke weight int audiomode = 1; // switch between canned and live input //other globals AudioInput input; // the minim input object AudioPlayer fieldrec; FFT spectrum; // minim spectrum object int numBands = 44; // how many freq bands float yspin = 0; // global rotation int[] histo = new int[numBands]; // utility histogram array ArrayList Curls = new ArrayList(maxCurls); ArrayList Seeds = new ArrayList(maxSeeds); void setup(){ frameRate(30); size(1000,400,OPENGL); background(1); minim = new Minim(this); //minim.start(); input = minim.getLineIn(Minim.MONO,1024); // set the input object //fieldrec = minim.loadFile("JCSMRFoyerUpstairs.mp3"); //fieldrec.loop(); spectrum = new FFT(1024,44100); // set the spectrum object spectrum.logAverages(11,4); // make 44 log spaced bands, lowest at 11Hz for (int s=0; s<5; s++){ // make some seeds with random parameters Curl newCurl = new Curl(20+int(random(-10,10)),random(40,100),random(50,150),random(TWO_PI), random(HALF_PI),0.07+random(-0.01,0.01)); } } /* // uncomment this for full screen display static public void main(String args[]) { PApplet.main(new String[] { "--present", "--display=1", "spectrum_helix_fileplayer" }); } */ void draw(){ // opengl stuff // end opengl doSpectrum(); // do the spectrum calculation // pgl = (PGraphicsOpenGL) g; // GL gl = pgl.beginGL(); // gl.glDisable(GL.GL_DEPTH_TEST); gl.glEnable(GL.GL_BLEND); gl.glBlendFunc(GL.GL_SRC_ALPHA,GL.GL_ONE_MINUS_SRC_ALPHA); // blend mode for the bg pgl.endGL(); fill(0,15); // this bit does the translucent fade noStroke(); rect(0,0,width,height); pgl.beginGL(); // gl.glBlendFunc(GL.GL_SRC_ALPHA,GL.GL_ONE); // additive blending for the curls pgl.endGL(); // translate(50,200,-50); // put it in the middle of the screen rotateZ(HALF_PI); // and turn it on its side noFill(); stroke(10); // translucent stroke for drawing smooth(); for (int s=0; s