Hey everyone!
I need some help with this sketch/project I'm doing for class. Right now I am trying to get my lines to respond to sound, I want them to extend outward as the music plays. I am new to processing and would really appreciate the help, thanks.
If you need more info just ask.
Code:
import ddf.minim.*;
Minim minim; AudioPlayer player;
static final int numLines = 63; float z;
void setup() { minim = new Minim(this); player = minim.loadFile("generic song"); player.loop(); background(20); size(800, 800); } void draw() {
background(20); stroke(167); strokeWeight(5);
translate(width/2, height/2); for (int i = 0; i < numLines; i++) { line(x1(z + i), y1(z + i), x2(z + i), y2(z + i)); } z+= 0.05; }
float x1(float z) { return sin(z/10) * 100 + sin(z); }
float y1(float z) { return cos(z/10) * 100; }
float x2(float z) { return sin(z/10) * 200 + sin(z); }
float y2(float z) { return cos(z/10) * 200 + cos(z/12);