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 & HelpPrograms › can this be done in processing - soundreact eyes
Page Index Toggle Pages: 1
can this be done in processing? - soundreact eyes (Read 813 times)
can this be done in processing? - soundreact eyes
Feb 12th, 2010, 6:31am
 
justin lui created some visuals for his circuiot bend speak and spell.
its viewable here:
http://vimeo.com/4484850
it works like this
an eye is simulated and the different layers of iris are made of strokes changing colors from the center towards the outer regions.
the movements of the strokes are actuated by sound i guess.

ive tried to do it with plain for loops and minims fft analysis, but i got stuck with my bad results.
anyone having ideas on how to and which functions i should use to recreate something like justins beautiful piece of art
here my code:
Code:
import ddf.minim.analysis.*;
import ddf.minim.*;

Minim minim;
AudioInput in;
FFT fft;

int xx;
int yy;
PVector [] vectors = new PVector[360];
PVector [] vectors2 = new PVector[360];
float angle;
float cosine;
float jitter;
void setup(){
size(500,500);
smooth();
stroke(255);
minim = new Minim(this);
in = minim.getLineIn(Minim.STEREO, 512);
fft = new FFT(in.bufferSize(), in.sampleRate());
fft.linAverages(20);
textFont(createFont("SanSerif", 12));
}
void draw(){
background(0);
fft.forward(in.mix);
if(second()%2 == 0){
jitter = (random(-0.1, 0.1));
}
angle = angle + jitter;
cosine = cos(angle);
for(int i = 0; i < fft.avgSize(); i++){
for(xx=0;xx<360;xx=xx+20){
vectors[xx]=new PVector(sin(radians(xx+fft.getAvg(5)*2)),cos(radians(xx+fft.getAvg(5)*2)));
vectors2[xx]=new PVector(sin(radians(xx+fft.getAvg(5)*5)),cos(radians(xx+fft.getAvg(5)*5)));
pushMatrix();
translate(width/2,height/2);// bring zero point to the center
//point (sin(radians(x))*50,cos(radians(x))*50);
//line(vectors[xx].x,vectors[xx].y,sin(radians(xx))*100,cos(radians(xx))*100);
line(vectors[xx].x*100,vectors[xx].y*100,vectors2[xx].x*110,vectors2[xx].y*110);
line(vectors[xx].x*150,vectors[xx].y*150,vectors2[xx].x*160,vectors2[xx].y*160);
popMatrix();
}
}
}

Re: can this be done in processing? - soundreact eyes
Reply #1 - Feb 12th, 2010, 3:45pm
 
What exactly is missing from your example?  It looks good -- two pinwheels of lines that wiggle when I tap my speaker.  If you want different colors, you can just use stroke()...
?
Re: can this be done in processing? - soundreact eyes
Reply #2 - Feb 13th, 2010, 4:31am
 
yeah it kinda functions ok. but is not what i really wanna do. i want to have the lines moving with ramping and more dynamic in their movements.
and then i also want maybe 10 rings with 100 strokes on each ring with every stroke changing color from its start to its end. like from red to blue.

its just about me trying to recreate a great visual. its reverse engineering one could say was the topic of this thread.

so i want to come as close to the original as possible as i think mastering that effect could be used in a lot of different stuff.'

hey btw nice to hear it works at you com also Smiley
Re: can this be done in processing? - soundreact eyes
Reply #3 - Feb 13th, 2010, 12:44pm
 
You are using getAvg(5) for every stroke, which means every stroke has the same audio reaction.

If you're using the same "impetus" for each stroke, there needs to be some other factor(s) determining the stroke parameters (position, colour, etc), such as an initial random state that you keep track of and adjust by the impetus.

Audio reaction is something that has a bunch of messy problems (like jitter, higher response in lower frequencies, etc) that I don't particularly know how to solve, but I have seen some discussions on the subject, similar to what you might find yourself by searching elsewhere on the web.

It seems your code led me on a rather lengthy distraction... I've been playing with your code and changed it somewhat to make my own eye-like visualisation.

Link: spxlIris on OpenProcessing.org

-spxl
Page Index Toggle Pages: 1