Created
December 22, 2018 17:29
-
-
Save saderuuu/6074c17c0d8d8c4c91db578021250925 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ddf.minim.*; | |
Minim minim; | |
AudioPlayer groove; | |
float c = 0; | |
int step = 1; | |
void setup() | |
{ | |
size(1024, 1024); | |
minim = new Minim(this); | |
groove = minim.loadFile("it.mp3", 1024); | |
colorMode(HSB, 100); | |
smooth(); | |
frameRate(60); | |
} | |
void draw() | |
{ | |
background(0); | |
int num = groove.bufferSize(); | |
float angleInc = (2*PI)/(num/step); | |
for(int i = 0; i < groove.bufferSize() - step; i+=step) | |
{ | |
float r = 300 - (groove.left.get(i) * 40); | |
float theta = angleInc*i; | |
float x = r * cos(theta); | |
float y = r * sin(theta); | |
float r2 = 300 + (groove.left.get(i) * 40); | |
float theta2 = angleInc*i; | |
float x2 = r2 * cos(theta2); | |
float y2 = r2 * sin(theta2); | |
strokeWeight(4); | |
stroke(c%100, 50, 100); | |
line(512+x, 512+y, 512+x2, 512+y2); | |
} | |
c+=0.1; | |
} | |
void keyPressed() | |
{ | |
if (key == 'p' || key == 'P') { | |
groove.loop(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment