Skip to content

Commit 625eee6

Browse files
committed
all code for g jones v1
1 parent 6cca6a9 commit 625eee6

File tree

2 files changed

+72
-15
lines changed

2 files changed

+72
-15
lines changed

music_GAMEOFLIFE.js

Lines changed: 71 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ let colBlack = [0,0,0]
2323
let colYellow = [213, 219, 15]
2424

2525
//let aliveCol = [colGreen,colYellow,colBlack,colCream];
26-
let deadCol = colBlack;
26+
let deadCol = colBlack
2727
let current = 0;
28+
let addSize = 0;
29+
30+
let appleSize = 0.5;
2831

2932

3033

@@ -33,20 +36,25 @@ function draw_one_frame(words, vocal, drum, bass, other,counter) {
3336
ellipseMode(CENTER);
3437
rectMode(CENTER);
3538

39+
let whiteCol = color(255,255,255)
3640
let appleCol = color(240,100,80);
3741
let greenCol = color(80,150,90);
3842
let yellowCol = color(213, 219, 15);
3943
let blackCol = color(0,0,0);
4044
let creamCol = color(255,255,230);
45+
let greyCol = color(150,150,150)
46+
let greyColTwo = color(100,100,100)
4147

42-
let aliveCol = [yellowCol,greenCol,creamCol,blackCol];
48+
//let aliveCol = [yellowCol,greenCol,creamCol,blackCol];
49+
let aliveCol = [whiteCol,greyColTwo,blackCol,greyCol];
4350

4451
let resMap = map(other,0,100,80,10,true); //unused
45-
let colShift = map (drum,0,100,0,0.8,true)
52+
let colShift = map (drum,0,100,0,2,true)
53+
let bassMap = map(vocal,0, 100, 0, 0.5, true);
4654

47-
let shiftedCol = lerpColor(appleCol,aliveCol[current],colShift)
55+
let shiftedCol = lerpColor(whiteCol,aliveCol[current],colShift)
4856

49-
if (counter % 240 == 0 && counter != 0){
57+
if (counter % 130 == 0 && counter != 0){
5058
phaseCheck = true;
5159
resolution += 10;
5260
if (resolution >= 50){
@@ -64,30 +72,65 @@ let aliveCol = [yellowCol,greenCol,creamCol,blackCol];
6472
grid = make2DArray(cols,rows)
6573
for (let i = 0; i < cols; i++){
6674
for (let j = 0; j < rows; j++){
67-
grid [i][j] = Math.floor(random(2));
75+
if (drum > 60){
76+
grid [i][j] = Math.floor (random (2));
77+
}else{
78+
grid [i][j] = Math.floor(random(8)/7);}
6879
}
6980
}
7081
firstRun = false;
7182
phaseCheck = false;
7283
}
73-
let bassFade = map (bass, 0, 100, 100, 0, true)
74-
deadCol.push(bassFade)
84+
//let bassFade = map (bass, 0, 100, 100, 0, true)
85+
//deadCol.push(bassFade)
7586
background(deadCol)
76-
deadCol.pop();
87+
//deadCol.pop();
7788

7889
for (let i = 0; i < cols; i++) {
7990
for (let j = 0; j < rows; j++) {
8091
let x = i * resolution;
8192
let y = j * resolution;
8293
if (grid[i][j] == 1) {
94+
push();
8395
//fill(aliveCol[current]);
8496
fill(shiftedCol)
85-
let appleSize = random(0,1);
97+
if (vocal > 60){
98+
appleSize = random(0.6,1);
99+
} else if (vocal > 50){
100+
appleSize = random(0.5,0.8);
101+
} else if (vocal > 40){
102+
appleSize = 0.5;
103+
} else if (vocal > 20){
104+
appleSize = random(0.3,0.4);
105+
} else {
106+
appleSize = 0.2;
107+
}
86108
//stroke(bass*5);
87-
noStroke();
109+
88110
//strokeWeight(drum/40)
89-
circle(x,y,(resolution+5)* appleSize)
90-
rect(x, y, (resolution - 1)*appleSize);
111+
//circle(x,y,((resolution+5)* appleSize))
112+
rect(x, y, ((resolution - 1)*appleSize*1.1));
113+
stroke(colWhite);
114+
strokeWeight(bassMap*.5)
115+
noFill()
116+
rect(x, y, ((resolution - 1)*2));
117+
118+
strokeWeight(bassMap*.1)
119+
rect(x, y, ((resolution - 1)*3));
120+
if (drum < 65 || bass < 38){
121+
stroke(bass)
122+
strokeWeight(.01*vocal)
123+
line(x-50,y,x+50,y);
124+
line(x,y-50,x,y+50);
125+
if (drum > 55 && drum < 65|| bass > 28 && bass < 38){
126+
strokeWeight(.2*bassMap)
127+
stroke (whiteCol)
128+
rect (x,y,((resolution - 1)*40*bassMap))
129+
}
130+
}
131+
132+
133+
pop();
91134
}
92135
}
93136
}
@@ -103,10 +146,24 @@ let aliveCol = [yellowCol,greenCol,creamCol,blackCol];
103146
let neighbours = countNeighbours(grid, i, j);
104147

105148
if (state == 0 && neighbours == 3) {
149+
stroke(255)
150+
if (bass > 80){
151+
push();
152+
strokeWeight (.1)
153+
noFill();
154+
rect(i*resolution, j*resolution, ((resolution - 1)*4));
155+
pop();
156+
}
157+
line((i*resolution)-20,(j*resolution),(i*resolution)+20,(j*resolution))
158+
line((i*resolution),(j*resolution)-20,(i*resolution),(j*resolution)+20)
106159
next[i][j] = 1;
107160
} else if (state == 1 && (neighbours < 2 || neighbours > 3)) {
161+
//addSize -=1;
162+
108163
next[i][j] = 0;
109164
} else {
165+
//addSize -=1;
166+
110167
next[i][j] = state;
111168
}
112169

@@ -115,7 +172,7 @@ let aliveCol = [yellowCol,greenCol,creamCol,blackCol];
115172
// iterates the GOL based on a rate that is the product of audio activity
116173
if( (drum >= 40 && counter % 5 == 0) ||
117174
(vocal >= 45 && counter % 10 == 0) ||
118-
(bass >= 60 && counter % 20 == 0) ||
175+
(bass >= 60 && counter % 10 == 0) ||
119176
(other >= 65 && counter % 20 == 0)) {
120177
grid = next;
121178
}

system_settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// smoothing is applied to the audio file to smooth the signal
22
// expected values are from 0 (no smoothing) to 100 (lots of smoothing)
3-
const smoothing = 100;
3+
const smoothing = 50;
44
// debugFastRefresh can be set to true to go straight to the song
55
const debugFastRefresh = true;

0 commit comments

Comments
 (0)