IAT265 Music Balls Example.docx

3 Pages
99 Views
Unlock Document

Department
Interactive Arts & Tech
Course
IAT 265
Professor
Matt Lockyer
Semester
Winter

Description
Music Balls Main import ddf.minim.*; import ddf.minim.signals.*; import ddf.minim.analysis.*; import ddf.minim.effects.*; //Ball [] balls; int NUM_BALLS = 5; ArrayList balls; Minim minim; AudioPlayer song; FFT fft; void setup(){ size(400, 400); smooth(); // sound processing minim = new Minim(this); song = minim.loadFile("filename.mp3", 2048); song.loop(); fft = new FFT(song.bufferSize(), song.sampleRate()); // create an array of balls // balls = new Ball[NUM_BALLS]; balls = new ArrayList(); for(int i = 0 ; i < NUM_BALLS; i++){ // balls[i] = new Ball(); balls.add(new MusicBall()); } } void draw(){ background(45, 100, 255); fft.forward(song.mix); for(int i = 0; i < balls.size(); i++){ balls.get(i).checkWalls(); balls.get(i).update(); balls.get(i).scaleObject( fft.getBand(i) /2); balls.get(i).draw(); } } Ball class Ball { // position PVector position; // velocity PVector velocity; // size float ballSize; float mass; float scaleFactor; Ball(){ ballSize
More Less

Related notes for IAT 265

Log In


OR

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


OR

By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.


Submit