Skip to content

Instantly share code, notes, and snippets.

@ravicious
Created March 24, 2014 12:35
Show Gist options
  • Save ravicious/9739293 to your computer and use it in GitHub Desktop.
Save ravicious/9739293 to your computer and use it in GitHub Desktop.
import ddf.minim.*;
Minim minim;
AudioPlayer song;
PImage korwin;
float counter;
float rotateValue;
void setup()
{
size(512, 512);
minim = new Minim(this);
// specify 512 for the length of the sample buffers
// the default buffer size is 1024
song = minim.loadFile("song.mp3", 512);
song.play();
korwin = loadImage("korwin.png");
counter = 0;
}
void draw()
{
background(0);
stroke(255);
translate(width/2, height/2);
// the values in the buffers are normalized
// they have values between -1 and 1
rotateValue = song.left.get(0) % PI;
counter = counter + rotateValue;
rotate(counter);
imageMode(CENTER);
image(korwin, 0, 0);
translate(-korwin.width/2, -korwin.height/2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment