Created
May 19, 2013 00:14
-
-
Save awhitty/5606184 to your computer and use it in GitHub Desktop.
This file contains 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; | |
AudioInput in; | |
int counter; | |
void setup() | |
{ | |
size(1024, 768, P2D); | |
minim = new Minim(this); | |
// get a line in from Minim, default bit depth is 16 | |
in = minim.getLineIn(Minim.STEREO, 1024); | |
background(0); | |
counter = 0; | |
} | |
void draw() | |
{ | |
stroke(0); | |
noFill(); | |
stroke(255,50); | |
// draw the waveforms | |
beginShape(); | |
for(int i = 0; i < in.bufferSize() - 1; i++) | |
{ | |
curveVertex(i, (counter*2) + in.left.get(i)*100); | |
} | |
endShape(); | |
counter++; | |
} | |
void keyPressed() { | |
// clear the screen and reset the frame count when the user presses the b key. | |
if (key == 'b' || key == 'B') { | |
background(0); | |
counter = 0; | |
} | |
} | |
void stop() | |
{ | |
in.close(); | |
minim.stop(); | |
super.stop(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment