Skip to content

Commit

Permalink
Add DomeEQ pattern
Browse files Browse the repository at this point in the history
`DomeEQ` turns the dome into an equalizer for the input which should encourage
people inside to make noise!

Also add debug output and make the audio belts blurrier.
  • Loading branch information
l8on committed Jul 29, 2017
1 parent f9529b4 commit 7746164
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 16 deletions.
66 changes: 62 additions & 4 deletions L8on.pde
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public class HeartsBeat extends LEDomePattern {
public void resetHeartSaturation(int i) {
this.heartSaturations[i].setPeriod(getRate());
this.heartSaturations[i].setBasis(random(0.02, 0.15));
this.heartSaturations[i].start(); //<>// //<>//
this.heartSaturations[i].start(); //<>//
}

public void run(double deltaMs) {
Expand Down Expand Up @@ -521,8 +521,8 @@ public class Explosions extends LEDomePattern {
private BoundedParameter brightnessParameter = new BoundedParameter("BRGT", 50, 10, 80);

private LEDomeAudioParameterFull rateParameter = new LEDomeAudioParameterFull("RATE", 8000.0, 8000.0, 750.0);

private BoundedParameter blurParameter = new BoundedParameter("BLUR", 0.69);

private BlurLayer blurLayer = new BlurLayer(lx, this, blurParameter);

private LEDomeAudioBeatGate beatGate = new LEDomeAudioBeatGate("XBEAT", lx);
Expand Down Expand Up @@ -1859,7 +1859,7 @@ public class AudioBelts extends LEDomePattern {
private float midBeltY = 23.26;
private float trebleBeltY = model.yMax - (1.25 * FEET);

private BoundedParameter blurParameter = new BoundedParameter("BLUR", 0.4);
private BoundedParameter blurParameter = new BoundedParameter("BLUR", 0.5);
private BlurLayer blurLayer = new BlurLayer(lx, this, blurParameter);

private BoundedParameter maxBrightnessParameter = new BoundedParameter("BRIG", 70, 0, 100);
Expand Down Expand Up @@ -1923,5 +1923,63 @@ public class AudioBelts extends LEDomePattern {
setColor(p.index, 0);
}
}
}
}
}

public class DomeEQ extends LEDomePattern {
private GraphicMeter meter;
private BandGate bandGate = new BandGate(lx);
private final int ORIGIN_POINT_INDEX = 8;
private final int MAX_POINT_INDEX = 544;
private double originAzimuth = model.points[ORIGIN_POINT_INDEX].azimuth;
private double projectedMaxAzimuth;

private BoundedParameter brightnessParam = new BoundedParameter("BRIG", 60, 10, 100);

private BoundedParameter blurParameter = new BoundedParameter("BLUR", 0.69);
private BlurLayer blurLayer = new BlurLayer(lx, this, blurParameter);
private LXModulator huePeriod = new SinLFO(10000, 20000, 60000);
private LXModulator hueModulator = new SinLFO(0, 360, huePeriod);

private final double GAIN = 6;

public DomeEQ(LX lx) {
super(lx);
this.meter = bandGate.meter;
this.originAzimuth = model.points[ORIGIN_POINT_INDEX].azimuth;
this.projectedMaxAzimuth = this.projectAzimuth(model.points[MAX_POINT_INDEX].azimuth);

addParameter(brightnessParam);

addParameter(blurParameter);
addLayer(blurLayer);

addModulator(huePeriod).start();
addModulator(hueModulator).start();

bandGate.gain.setValue(GAIN);
addModulator(bandGate).start();
}

public void run(double deltaMs) {
for (LXPoint p : model.points) {
if (p.yn <= this.bandGate.getBand(this.getBandIndex(p))) {
float hue = (hueModulator.getValuef() + (p.yn * 360.0)) % 360.0;
setColor(p.index, LX.hsb(hue, 100, brightnessParam.getValuef()));
} else {
setColor(p.index, 0);
}
}
}

private int getBandIndex(LXPoint p) {
double projectedAzimuth = this.projectAzimuth(p.azimuth);
double normalizedPosition = LXUtils.constrain(projectedAzimuth / projectedMaxAzimuth, 0.0, 1);
double bandIndex = LXUtils.constrain(normalizedPosition * this.meter.numBands, 0.0, this.meter.numBands - 1);
return (int)bandIndex;
}

private double projectAzimuth(double azimuth) {
return (azimuth - originAzimuth + LX.TWO_PI) % LX.TWO_PI;
}
}
2 changes: 1 addition & 1 deletion L8onUtil.pde
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public class SnakeLayer extends LXLayer {
float distToTravel = dist(firstHeadPoint.x, firstHeadPoint.y, firstHeadPoint.z, secondHeadPoint.x, secondHeadPoint.y, secondHeadPoint.z);
return max(distToTravel / (snakeSpeed.getValuef() / SECONDS), 0.0);
}
} //<>// //<>//
} //<>//

/*
* A container to keep state of the different 3d waves in the color remix.
Expand Down
38 changes: 31 additions & 7 deletions TestPatterns.pde
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ public class HueTestPattern extends LXPattern {
}
}

public class FaceIteratorTest extends LEDomePattern {
public class FaceIteratorTest extends LEDomePattern implements LXParameterListener {
private final SawLFO currIndex = new SawLFO(0, ((LEDome)model).faces.size(), ((LEDome)model).faces.size() * 300);
private final BoundedParameter selectedFace = new BoundedParameter("SEL", 0, 0, ((LEDome)model).faces.size() - 1);

public FaceIteratorTest(LX lx) {
super(lx);

addParameter(selectedFace);
addModulator(currIndex).start();
addParameter(selectedFace);
addModulator(currIndex).start();
}

public void run(double deltaMs) {
Expand All @@ -40,9 +40,7 @@ public class FaceIteratorTest extends LEDomePattern {

for(int i = 0; i < model.faces.size(); i++) {
LEDomeFace face = model.faces.get(i);
if(!face.hasLights()) {
continue;
}
if(!face.hasLights()) { continue; }

float bv = (i == index || i == selectedIndex) ? 100.0 : 0.0;

Expand All @@ -51,6 +49,32 @@ public class FaceIteratorTest extends LEDomePattern {
}
}
}

public void onParameterChanged(LXParameter parameter) {
if (parameter != this.selectedFace) { return; }

int selectedIndex = (int) selectedFace.getValuef();
LEDomeFace face = model.faces.get(selectedIndex);
if(!face.hasLights()) { return; }

println("Face stats for " + selectedIndex);
println("Center x: " + face.xf());
println("Center y: " + face.yf());
println("Center z: " + face.zf());

for(LXPoint p: face.points) {
println("Point index: " + p.index);
println(" x: " + p.x);
println(" y: " + p.y);
println(" z: " + p.z);
println(" theta: " + p.theta);
println(" azimuth: " + p.azimuth);
}

println();
}


}

class EdgeIteratorTest extends LEDomePattern {
Expand Down
9 changes: 5 additions & 4 deletions dome.pde
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ LEDome model;
LXStudio lx;

LXPattern[] patterns(P3LX lx) {
return new LXPattern[] {
return new LXPattern[] {
// Create New Pattern Instances Below HERE
new ShadyWaffle(lx),

Expand All @@ -80,6 +80,7 @@ LXPattern[] patterns(P3LX lx) {
new SpotLights(lx),
new JumpRopes(lx),
new Explosions(lx),
new DomeEQ(lx),
new SnakeApple(lx),
new Snakes(lx),
new HeartsBeat(lx),
Expand All @@ -91,14 +92,14 @@ LXPattern[] patterns(P3LX lx) {
new Stargaze(lx),

// Kristján
new Disco(lx),
new Disco(lx),

// pld
new Spiral(lx),

// rohan
new Sunshine(lx),
new SunshineHalf(lx),
//new Sunshine(lx),
//new SunshineHalf(lx),

// Test Patterns
new LayerDemoPattern(lx),
Expand Down

0 comments on commit 7746164

Please sign in to comment.