Skip to content

Commit

Permalink
Merge branch 'master' of github.com:hackrockcity/domeTransmitter
Browse files Browse the repository at this point in the history
Conflicts:
	domeTransmitter.pde
  • Loading branch information
potatono committed May 19, 2012
2 parents 4fbf5f1 + 844aadc commit 4eeabf2
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 8 deletions.
39 changes: 39 additions & 0 deletions FFT.pde
@@ -0,0 +1,39 @@
class FFTDemo extends Routine {
FFT fft;
Minim minim;
AudioInput audioin;

void setup(PApplet parent) {
super.setup(parent);
minim = new Minim(parent);
audioin = minim.getLineIn(Minim.STEREO, 2048);
fft = new FFT(audioin.bufferSize(), audioin.sampleRate());
}

void draw() {
long frame = frameCount - modeFrameStart;

background(0);
stroke(255);

fft.forward(audioin.mix);

for (int i = 0; i < fft.specSize(); i++)
{
// draw the line for frequency band i, scaling it by 4 so we can see it a bit better
// stroke(0,0,255);
// line(i, HEIGHT, i, HEIGHT - fft.getBand(i)*4);
// //line(i, HEIGHT, i, HEIGHT - fft.getBand(i));
float barHeight = fft.getBand(i)*4;
for (float c = 0; c < barHeight; c++) {
stroke(c/barHeight*255, 0, 255);
point(i, HEIGHT - c);
}
}

if (frame > FRAMERATE*TYPICAL_MODE_TIME) {
newMode();
}
}
}

18 changes: 10 additions & 8 deletions domeTransmitter.pde
Expand Up @@ -3,6 +3,8 @@ import processing.opengl.*;
import java.lang.reflect.Method;
import hypermedia.net.*;
import java.io.*;
import ddf.minim.*;
import ddf.minim.analysis.*;

int WIDTH = 25;
int HEIGHT = 160;
Expand All @@ -23,7 +25,8 @@ Routine[] enabledRoutines = new Routine[] {/*
new TargetScanner(),
new Waterfalls(),
new RGBRoutine(),
new FlashColors(),*/
new FFTDemo(),
new FlashColors(),
new FollowMouse()
};
Expand All @@ -49,10 +52,10 @@ WiiController controller;
void setup() {
// Had to enable OPENGL for some reason new fonts don't work in JAVA2D.
size(WIDTH,HEIGHT);
size(WIDTH, HEIGHT);
frameRate(FRAMERATE);
dacwes = new Dacwes(this, WIDTH, HEIGHT);
dacwes.setAddress(hostname);
dacwes.setAddressingMode(Dacwes.ADDRESSING_VERTICAL_NORMAL);
Expand Down Expand Up @@ -82,7 +85,7 @@ void setMode(int newMode) {
mode = newMode;
modeFrameStart = frameCount;
println("New mode " + currentRoutine.getClass().getName());
currentRoutine.reset();
}
Expand All @@ -99,7 +102,7 @@ void newMode() {
}
setMode(newMode);
// dacwes.sendMode(enabledModes[newMode]);
// dacwes.sendMode(enabledModes[newMode]);
}
void draw() {
Expand Down Expand Up @@ -129,8 +132,7 @@ void draw() {
currentRoutine.isDone = false;
newMode();
}
// println(frameRate);
dacwes.sendData();
// println(frameRate);
dacwes.sendData();
}

0 comments on commit 4eeabf2

Please sign in to comment.