17 Audio

Leftget0 200 abs ellipse5050diameterdiameter 15

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: d(255,0,0); int diameter = int( int abs(song.left.get(0)) * 200 ); ellipse(50,50,diameter,diameter); } 14 Using Minim to get to the Sound Buffer song.left.get(0) is the first float in the buffer • Since it could be negative we'll use the absolute value function abs() • Then we'll multiply it by 200 and drop the decimals so we'll get a diameter between 0 and 200 for our ellipse void draw() { background(255,0,0); int diameter = int( int abs(song.left.get(0)) * 200 ); abs( ellipse(50,50,diameter,diameter); 15 • Using the largest float in the Sound Buffer • We can make a better visualizer by using the largest float in the Sound Buffer void draw() { background(255,0,0); background(255,0,0); float biggest = 0; float for(int i = 0; i < song.bufferSize(); i++) for(int { if(abs(song.left.get(i)) > biggest) if(abs(song.left.get(i)) {...
View Full Document

This note was uploaded on 01/13/2012 for the course CS 12 taught by Professor Ma during the Spring '08 term at UC Davis.

Ask a homework question - tutors are online