int CurAnim, iSymm;\r
int XSym=1,YSym=2,RadSym=3;\r
float zTime , zTheta=0, zSin, zCos, rtime, ttime, transAdd;\r
- DParam pSpeed , pDensity, pRotZ;\r
+ DParam pSpeed , pDensity;\r
Pick pChoose, pSymm;\r
int _ND = 4;\r
NDat N[] = new NDat[_ND];\r
\r
Noise(GLucose glucose) {\r
super(glucose);\r
- pRotZ = addParam("RotZ" , .5 ); pSpeed = addParam("Fast", .55);\r
- pDensity= addParam("Dens" , .5);\r
- pSymm = addPick("Symmetry" , 0, 3, new String[] {"None", "X", "Y", "Radial"} );\r
- pChoose = addPick("Animation", 6, 7, new String[] {"Drip", "Cloud", "Rain", "Fire", "Machine", "Spark","VWave", "Wave"} );\r
+ pSpeed = addParam("Fast" , .55);\r
+ pDensity = addParam("Dens" , .5);\r
+ pSymm = addPick("Symmetry" , 0, 3, new String[] {"None", "X", "Y", "Radial"} );\r
+ pChoose = addPick("Animation", 6, 7, new String[] {"Drip", "Cloud", "Rain", "Fire", "Machine", "Spark","VWave", "Wave"} );\r
for (int i=0; i<_ND; i++) N[i] = new NDat();\r
}\r
\r
void StartPattern() { zTime = random(500); zTheta=0; rtime = 0; ttime = 0; transAdd=0; }\r
void StartRun(double deltaMs) {\r
zTime += deltaMs*(pSpeed.Val()-.5)*.002 ;\r
- zTheta += deltaMs*(pRotZ .Val()-.5)*.01 ;\r
+ zTheta += deltaMs*(pSpin .Val()-.5)*.01 ;\r
rtime += deltaMs;\r
iSymm = pSymm.Cur();\r
transAdd = 1*(1 - constrain(rtime - ttime,0,1000)/1000);\r
\r
if (pChoose.Cur() != CurAnim) {\r
CurAnim = pChoose.Cur(); ttime = rtime;\r
- pRotZ .reset(); zTheta = 0;\r
- pDensity .reset(); pSpeed .reset(); \r
+ pSpin .reset(); zTheta = 0;\r
+ pDensity .reset(); pSpeed .reset();\r
for (int i=0; i<_ND; i++) { N[i].isActive = false; }\r
\r
switch(CurAnim) {\r
\r
int nBeats = 0;\r
DParam pAmp, pRadius, pBounce;\r
- DParam pRotX, pRotY, pRotZ;\r
\r
float t,amp,rad,bnc;\r
\r
float LastBeat=3, LastMeasure=3;\r
int CurRandTempo = 1, CurRandTPat = 1;\r
\r
-\r
- Pick pTimePattern, pTempoMult, pShape, pForm;\r
+ Pick pTimePattern, pTempoMult, pShape;\r
int RandCube;\r
\r
Play(GLucose glucose) {\r
super(glucose);\r
- pRotX = addParam("RotX", .5);\r
- pRotY = addParam("RotY", .5);\r
- pRotZ = addParam("RotZ", .5);\r
pRadius = addParam("Rad" , .1 );\r
pBounce = addParam("Bnc" , .2 );\r
pAmp = addParam("Amp" , .2 );\r
"Pyramid", "Wings", "W2", "Clock",\r
"Triangle", "Quad", "Sphere", "Cone",\r
"Noise", "Wave", "?", "?"} );\r
- pForm = addPick ("Form" , 2 , 2 , new String[] {"Bar", "Volume", "Fade"} );\r
}\r
\r
public class rWave {\r
w.move(deltaMs); if (w.bDone) waves.remove(i); else i++;\r
}\r
\r
- if (t<LastBeat) {\r
- cPrev.set(cRand); cRand.setRand();\r
- a1.set(); a2.set(); a3.set(); a4.set();\r
+ if ((t<LastBeat && !pKey.b) || DG.KeyPressed>-1) {\r
waves.add(new rWave(\r
- random(1), // location\r
+ pKey.b ? map(DG.KeyPressed,0,7,0,1) : random(1), // location\r
bnc*10, // bounciness\r
7, // velocity\r
2*(1-amp))); // dampiness\r
+ DG.KeyPressed=-1;\r
if (waves.size() > 5) waves.remove(0);\r
+ }\r
+ \r
+ if (t<LastBeat) {\r
+ cPrev.set(cRand); cRand.setRand();\r
+ a1.set(); a2.set(); a3.set(); a4.set();\r
} LastBeat = t;\r
\r
switch (nTPat) {\r
default: return color(0,0,0);\r
}\r
\r
- switch (pForm.Cur()) {\r
- case 0: return color(0,0,c1c(1 - V.distance(Pn)/rad > .5?1:0));\r
- case 1: return color(0,0,c1c(Pn.y < V.y ?1:0));\r
- case 2: return color(0,0,c1c(1 - V.distance(Pn)/rad));\r
-\r
- default: return color(0,0,c1c(Pn.y < V.y ?1:0));\r
- }\r
+ return color(0,0,c1c(1 - V.distance(Pn)/rad));\r
}\r
}\r
//----------------------------------------------------------------------------------------------------------------------------------\r
MidiOutput APCOut = null;
MidiInput APCIn = null, OxygenIn = null;
DPat CurPat = null;
+ int KeyPressed = -1;
float Sliders[] = new float [] {1,0,0,0,0,0,0,0};
- String SliderText[] = new String[] {"Level", "SpinHue", "Spark", "Xwave", "Ywave", "Trails", "??", "??", "??"};
+ String SliderText[] = new String[] {"Level", "SpinHue", "Spark", "Xwave", "Ywave", "Trails", "Quant", "??", "??"};
void SetNoteOn (int row, int col, int clr){ if (APCOut != null) APCOut.sendNoteOn (col, row, clr); }
void SetNoteOff (int row, int col, int clr){ if (APCOut != null) APCOut.sendNoteOff (col, row, clr); }
Pick GetPick (int i) { return (Pick) CurPat.picks .get(i); }
DParam GetParam(int i) { return (DParam) CurPat.params.get(i); }
- float _Dim () { return Sliders[0]; }
+ float _Level () { return Sliders[0]; }
float _SpinHue () { return Sliders[1]; }
float _Spark () { return Sliders[2]; }
float _XWave () { return Sliders[3]; }
float _YWave () { return Sliders[4]; }
float _Trails () { return Sliders[5]; }
+ float _Quantize () { return Sliders[6]; }
void Init () {
if (bInit) return; bInit=true;
int row = note.getPitch(), col = note.getChannel();
for (int i=0; i<CurPat.picks.size(); i++) if (GetPick(i).set(row, col)) return;
for (int i=0; i<CurPat.bools.size(); i++) if (GetBool(i).set(row, col, true)) return;
- //println("row: " + row + " col: " + col);
+ if (row == 52) { KeyPressed = col; return; }
+ println("row: " + row + " col: " + col);
}
}
//----------------------------------------------------------------------------------------------------------------------------------
int nPoint , nPoints;
xyz xyzJog = new xyz(), vT1 = new xyz(), vT2 = new xyz();
xyz modmin;
-
+
float NoiseMove = random(10000);
- DParam pSharp, pQuantize, pSaturate;
- DBool pXsym, pYsym, pRsym, pXdup, pXtrip, pJog;
+ DParam pRotX, pRotY, pRotZ, pSpin, pSharp, pSaturate, pTransX, pTransY;
+
+ DBool pXsym, pYsym, pRsym, pXdup, pXtrip, pJog, pKey;
float Dist (xyz a, xyz b) { return dist(a.x,a.y,a.z,b.x,b.y,b.z); }
int c1c (float a) { return round(100*constrain(a,0,1)); }
float interpWv(float i, float[] vals) { return interp(i-floor(i), vals[floor(i)], vals[ceil(i)]); }
super.addParameter(P);
params.add(P); return P;
}
+
Pick addPick(String name, int def, int _max, String[] desc) {
Pick P = new Pick(name, def, _max+1, nMaxRow, desc);
nMaxRow = P.EndRow + 1;
DPat(GLucose glucose) {
super(glucose);
- pSharp = addParam("Shrp", 0 );
- pQuantize = addParam("Qunt", 0 );
- pSaturate = addParam("Sat" , .5);
+
+ pSharp = addParam("Shrp", 0);
+ pSaturate = addParam("Sat" , .5);
+ pTransX = addParam("TrnX", .5);
+ pTransY = addParam("TrnY", .5);
+ pRotX = addParam("RotX", .5);
+ pRotY = addParam("RotY", .5);
+ pRotZ = addParam("RotZ", .5);
+ pSpin = addParam("Spin", .5);
+
nPoints = model.points.size();
pXsym = new DBool("X-SYM", false, 49, 0); bools.add(pXsym );
pYsym = new DBool("Y-SYM", false, 49, 1); bools.add(pYsym );
pRsym = new DBool("R-SYM", false, 49, 2); bools.add(pRsym );
pXdup = new DBool("X-DUP", false, 49, 3); bools.add(pXdup );
pJog = new DBool("JOGGER",false, 49, 4); bools.add(pJog );
+ pKey = new DBool("KBD" ,false, 49, 5); bools.add(pKey );
modmin = new xyz(model.xMin, model.yMin, model.zMin);
mMax = new xyz(model.xMax, model.yMax, model.zMax); mMax.subtract(modmin);
mCtr = new xyz(mMax); mCtr.scale(.5);
StartRun (deltaMs);
zSpinHue += DG._SpinHue ()*deltaMs*.05; zSpinHue = zSpinHue % 5000.;
xyz P = new xyz(), tP = new xyz(), pSave = new xyz();
+ xyz pTrans = new xyz(pTransX.Val()*200-100, pTransY.Val()*100-50,0);
float fSharp = 1/(1.0001-pSharp.Val());
- float fQuant = pQuantize.Val();
+ float fQuant = DG._Quantize ();
float fSaturate = pSaturate.Val();
DG.SetText();
nPoint = 0;
-
+
if (fQuant > 0) {
float tRamp = (lx.tempo.rampf() % (1./pow(2,floor((1-fQuant) * 4))));
float f = LastQuant; LastQuant = tRamp; if (tRamp > f) return;
for (Point p : model.points) { nPoint++;
P.set(p);
P.subtract(modmin);
+ P.subtract(pTrans);
if (sprk > 0) { P.y += sprk*randctr(50); P.x += sprk*randctr(50); P.z += sprk*randctr(50); }
if (yWv > 0) P.y += interpWv(p.x-modmin.x, yWaveNz);
if (xWv > 0) P.x += interpWv(p.y-modmin.y, xWaveNz);
colors[p.index] = color(
(hue(cNew) + zSpinHue) % 360,
saturation(cNew) + 100*(fSaturate*2-1),
- 100 * b * DG._Dim()
+ 100 * b * DG._Level()
);
// colors[p.index] = color(0,0, p.fx >= modmin.x && p.fy >= modmin.y && p.fz >= modmin.z &&