Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Sound movement
import ddf.minim.analysis.*;
import ddf.minim.*;
Minim minim;
AudioPlayer jingle;
FFT fftLin;
PFont font;
void setup()
{
size(600, 200);
minim = new Minim(this);
jingle = minim.loadFile("your song.mp3", 1024);
jingle.loop();
fftLin = new FFT( jingle.bufferSize(), jingle.sampleRate() );
// Set the number of 'sounds' to get from the music, low to high frequency.
fftLin.linAverages( 30 );
rectMode(CENTER);
noStroke();
}
void draw()
{
background(0);
fill(255);
fftLin.forward( jingle.mix );
pushMatrix();
translate(100,100);
scale(fftLin.getAvg(0));
rect(0,0,1,1);
popMatrix();
pushMatrix();
translate(300,100);
rotate(fftLin.getAvg(2)/20);
scale(100);
rect(0,0,1,1);
popMatrix();
pushMatrix();
translate(500,100);
fill(fftLin.getAvg(2)*100);
scale(100);
rect(0,0,1,1);
popMatrix();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment