Difference between revisions of "Adios Chancellor! - Ben Brickley"
From Robert-Depot
Bbrickley34 (talk | contribs) (→Visualization) |
Bbrickley34 (talk | contribs) (→Visualization) |
||
| Line 14: | Line 14: | ||
[[Image:fox2.jpg]] | [[Image:fox2.jpg]] | ||
| + | |||
| + | == Source Code == | ||
| + | |||
| + | |||
| + | |||
| + | import ddf.minim.*; | ||
| + | |||
| + | import ddf.minim.analysis.*; | ||
| + | |||
| + | import ddf.minim.signals.*; | ||
| + | |||
| + | |||
| + | Minim minim; | ||
| + | |||
| + | AudioInput in; | ||
| + | |||
| + | FFT fft; | ||
| + | |||
| + | float loudestFreqAmp = 5; | ||
| + | |||
| + | float loudestFreq = 5; | ||
| + | |||
| + | int timerCounter = 5; | ||
| + | |||
| + | void setup() | ||
| + | { | ||
| + | size(550, 770); | ||
| + | frameRate(30); | ||
| + | |||
| + | minim = new Minim(this); | ||
| + | minim.debugOn(); | ||
| + | background(loadImage("mfox.jpg")); | ||
| + | noStroke(); | ||
| + | in = minim.getLineIn(Minim.STEREO, 1024); | ||
| + | fft = new FFT(in.bufferSize(), in.sampleRate()); | ||
| + | |||
| + | } | ||
| + | |||
| + | |||
| + | void draw() | ||
| + | { | ||
| + | fft.window(FFT.HAMMING); | ||
| + | for(int i = 0; i < fft.specSize(); i++) | ||
| + | { | ||
| + | if (fft.getBand(i) > loudestFreqAmp && fft.getBand(i) > 10) | ||
| + | { | ||
| + | loudestFreqAmp = fft.getBand(i); | ||
| + | loudestFreq = i * 4; | ||
| + | fill(loudestFreq * 10, 255 - loudestFreq, loudestFreq * 20, 128 ); | ||
| + | if(loudestFreq < 25) | ||
| + | { | ||
| + | stroke(0,0,0,250); | ||
| + | strokeWeight(7); | ||
| + | ellipse(mouseX,mouseY,5,5); | ||
| + | } | ||
| + | timerCounter = 0; | ||
| + | } | ||
| + | } | ||
| + | loudestFreqAmp = 0; | ||
| + | fft.forward(in.mix); | ||
| + | timerCounter++; | ||
| + | |||
| + | |||
| + | if (keyPressed){ | ||
| + | setup(); | ||
| + | } | ||
| + | |||
| + | } | ||
| + | |||
| + | void stop() | ||
| + | { | ||
| + | |||
| + | in.close(); | ||
| + | minim.stop(); | ||
| + | |||
| + | super.stop(); | ||
| + | } | ||
Latest revision as of 17:24, 3 June 2010
Concept
The idea for this piece is to create a simple, interactive way to doodle on the face of our wonderful Chancellor, Ms. Marye Anne Fox. It will be a cartoonized picture of our beloved leader with a simple black background. When the user blows into the microphone, ink will appear wherever the mouse is.
Motivation
-All the shitty things that she has put myself and my classmates through in the past four years
-The fact that this is the last project that I will ever do under her domain
Visualization
Source Code
import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.signals.*;
Minim minim;
AudioInput in;
FFT fft;
float loudestFreqAmp = 5;
float loudestFreq = 5;
int timerCounter = 5;
void setup() {
size(550, 770);
frameRate(30);
minim = new Minim(this);
minim.debugOn();
background(loadImage("mfox.jpg"));
noStroke();
in = minim.getLineIn(Minim.STEREO, 1024);
fft = new FFT(in.bufferSize(), in.sampleRate());
}
void draw()
{
fft.window(FFT.HAMMING);
for(int i = 0; i < fft.specSize(); i++)
{
if (fft.getBand(i) > loudestFreqAmp && fft.getBand(i) > 10)
{
loudestFreqAmp = fft.getBand(i);
loudestFreq = i * 4;
fill(loudestFreq * 10, 255 - loudestFreq, loudestFreq * 20, 128 );
if(loudestFreq < 25)
{
stroke(0,0,0,250);
strokeWeight(7);
ellipse(mouseX,mouseY,5,5);
}
timerCounter = 0;
}
}
loudestFreqAmp = 0;
fft.forward(in.mix);
timerCounter++;
if (keyPressed){
setup();
}
}
void stop() {
in.close(); minim.stop(); super.stop();
}

