We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi, I'm a music student but we're learning processing and our lecturer wants us to make and animation which reacts to sound.
I'm trying to make an animation which creates spheres. The brightness( cooler colors for loq freq, brighter for high) and the number and size of the spheres increase with amplitude. Can anyone help me with how to go about doing that?
This is my code so far:
int c = 255; float op = random(0, 255);
void setup() { size(960, 500, P3D); background(0); frameRate(25); noStroke(); rectMode(CENTER); }
void draw() { fill(c, random(100));
float sz = random(200); float big = random(1, 200); float placex = random(10, 960); float placey = random(10, 500);
fill(random(255), random(255), random(255)); ellipse(random(width), random(height), sz, sz); noStroke(); lights(); translate(placex, placey); sphere(big);
if (frameCount % 200 == 0) { c = 255 - c; // 255 0 255 0 255 0 .. } saveFrame("frame-####.tif");
if (frameCount > 500) { // 20 seconds * 25 fps = 500 noLoop(); } }
Answers
@rudeboi===
please format your code
use minim lib
@akenaton I appreciate the response but I have no idea what any of that means?
Deleted.
I'll explain:
go back edit your post
format your code right
How to post code
when you post your code:
in the processing editor hit ctrl-t to auto format
copy it
paste it in the browser
leave 2 empty lines before and after it
mark the code (without the empty lines)
press C in the small command bar.
save post
there is a section librarys where you can read about those - a library brings you new commands. Minim is not in there.
ok, read the examples on FFT for minim:
http://code.compartmental.net/tools/minim/
then in processing, install the lib in the menu Sketch (import lib | add lib) and look at the examples (Menu File|examples|contributed libraries). When you get get audioline input in you can listen to the sound, make FFT forward and use the values to index them for your needs.
show your code again when you are this far.
@Chrisir=== thanks to explain; i am not an "administrator" && not enough time left to...i work..i am a developper so i give guidelines is it well???
@akenaton, it is fine that you helped him, thank you.
I was just explaining a little more since he said he wasn't sure what you meant.
Best, Chrisir :)
here is one of the examples
you need a file named test.mp3 (a song)