# WCCChallenge_Genuary2024Mashup

# Gen-Chaos

For this week's Creative Code Challenge by @sableraph: **"Genuary2024",**

This sketch has every prompt from Genuary2024 within it. By using a mixture previous Genuary2024 sketches & compositions which can be seen here: [https://blog.illestpreacha.com/series/genuary2024](https://blog.illestpreacha.com/series/genuary2024) as well as newly coded snippets to bring this into one sketch.

Gen-Chaos is coded in uses **LiveCodingYoutube, Hydra & SonicPi**

## Poem

```ocaml
Brewing all the Code in a Pot
Might Seem Like A lot
Results May Vary
Colors may seem heavy
Sound could be heard a little Messy
But what if, this is the PLOT??
```

## Video

<iframe width="560" height="315" src="https://www.youtube.com/embed/L9nMFomKhEQ?si=UpmjPw-7eTAooOHg"></iframe>

## Code (Not Featured in Other Genuary2024 Sketches)

### **Hydra**

```javascript
s0.initScreen();
src(s0)
	.colorama(() => (time % 24 + 1) / 12)
	.kaleid(6)
	.diff(src(s0)
		.scroll([0.5, 0.25, -0.5])
		.scale(4)
		.rotate(() => time / 10)
		.color(1, [0,1].smooth(), [0.15,0.75].smooth())).colorama(()=> (time % 15 + 3)/24)
	.modulateKaleid(src(s0)
		.scrollX(.10)
		.rotate(() => (time % 50))
		.repeat([100,16].smooth(), [100,16].smooth()))
	.modulateRepeat(src(s0)
		.scrollY([0.15, 0.30, 0.5, -0.3, -0.15].smooth())
		.rotate(() => Math.sin(time))
		.color(1, 0, [1, 0.75, 0.25, 0.15, 0.1].smooth()))
	.layer(src(s0)
		.scrollX(.20)
		.rotate(() => Math.hypot(time % 15,Math.cos(time)))
         .scrollY([0.5,0.3,0.1].smooth())
          .colorama(()=> (time % 15 + 2)/24))
	.diff(src(s0)
		.pixelate([5000, 3000, 1600, 3000, 5000].smooth())
		.rotate(() => time / 50)
		.scale(() => (time % 20 + 4) / 4))
	.modulateScale(shape([6, 10, 14, 3, 7].smooth(), 2.5, 1.5)
		.rotate(() => Math.hypot(time / 10, time % 4)), () => Math.sin(time / 3) * .2 + .2)
	.scale([1.6, 0.6, 1,0.1,0.3,2,0.05,0.001,1,2,3,1.5,1,0.000001].smooth())
	.out();
speed = 0.458;
```

### LiveCodingYoutube

```javascript
Particles = "fauyrhHIBgE"
ASCII = "u4Z_EL3bOjY"
Shaders_Recreation = "mYKucYwaJL8"
VeraMolnar = "1BeaxiktTeY"
Progress_1kb = "WDXpAg-rD_I"
LavaLamp = "gmiVeta_snw"
Physics = "RNghK9tSp4I"
Anni_Bauhaus = "D4YkpeZEnmw"
Typography = "yqztYMuibv4"
NewLibrary = "pBJjnD747ik"
Skeuomorphism = "pNguM9U5uNI"
ReCreation = "blkdF1faRUE"

create(3,4, Particles)

cue(0, Typography)
cue(1, Physics)
cue(2, Anni_Bauhaus)
cue(4, Skeuomorphism)
cue(5, ASCII)
cue(6, Progress_1kb)
cue(7, ReCreation)
cue(8, LavaLamp)
cue(9, NewLibrary)
cue(10, VeraMolnar)
cue(11, Shaders_Recreation)

speed([0,3,5,7],1.3)
speed([11,10,2,1],0.75)
speed([4,8,9],-1)

mute(all)
play(all)

jump([0,1,2,3],4,4)
jump([9,10,11,8],5,3)
jump([5,6,7,8],4,4)
jump([2,4,6,8,10],6,6)
jump([1,3,5,7,9,11],-4,-4)

```

### SonicPi - Internal Area of Shapes

```ruby



def circles1(radius,loop)
  
  circumference = 2 * Math::PI * radius
  area = Math::PI * (radius ** 2)
  
  live_loop loop do
    use_random_seed Math.cbrt(Time.now.to_i)
    with_fx :ping_pong,mix: 0.75 do
      with_fx :gverb, damp: 0.5 do
        use_synth :piano
        play [circumference,circumference/2], decay: rrand(1,4)
        sample [:ambi_drone,:elec_beep,:perc_snap,:perc_swoosh].choose, beat_stretch: area / 80,amp: dice(2)
      end
    end
    sleep [0.25,0.5,1,2,4,8].choose
  end
  
end


def triangle(height,base,side1,side2,loop)
  
  perimeter = base + side1 + side2
  area = (height * base) /2
  
  live_loop loop do
    use_random_seed Time.now.to_i
    with_fx :ixi_techno,mix: 0.75 do
      with_fx :vowel, voice: dice(3) + 1 do
        use_synth [:chipbass,:chipnoise].choose
        play [perimeter/2,perimeter/3,perimeter].choose, sustain: dice(3)
        sample [:loop_perc1,:elec_blip2,:tabla_ghe2,:elec_wood,:drum_bass_soft].choose, rate: area / 5 + 0.2
      end
    end
    sleep [0.25,0.5,1,2,4,8].choose
  end
  
end



def square1(side,loop)
  
  perimeter = 4 * side
  area = side ** 2
  
  live_loop loop do
    use_random_seed Time.now.to_i
    with_fx :ixi_techno,mix: 0.75 do
      with_fx [:ping_pong,:flanger].choose, mix: 0.65 do
        sample [:guit_em9,:tabla_ghe2,:elec_pong,:drum_bass_hard].choose, rate: area / 100, attack: dice(5), amp: dice(2)
      end
    end
    sleep [side,perimeter,side/3,Math.cbrt(perimeter)].choose
  end
  
end


circles1(1,:cir1)
triangle(10,5,4,3,:tri1)
square1(13,:sq1)
circles1(4,:cir2)
triangle(14,33,10,9,:tri2)
square1(16,:square2)
```

### SonicPi - Square SDF

```ruby
#getting the sign distance function for squares
#Formula = function square(x,y,size) {
#dx = abs(x) - size;  d1 = max(dx,0);
#dy = abs(y) - size;  d2 = max(dy,0);
#	return min(max(dx, dy), 0.0) + hypot(d1,d2);}
#which can be written as Math.hypot(x,y)



#x,y coordinates and the r for radius
def SDF_squares(x, y, size)
  dx = (x).abs - size
  dy = (y).abs - size
  d1 = [dx,0].max #finding the max
  d2 = [dy,0].max
  [[dx,dy].max,0.0].min + Math.hypot(d1,d2) #finding the min
end


r = 15

live_loop :soundOfSDF do
  
  #random seed based on time
  use_random_seed Time.now.to_i
  
  
  #point between - 30 & 30
  
  point = rrand_i(-30,30)
  
  
  
  x = point
  y = point
  
  dist_sdf = SDF_hexagon(x,y,r)
  
  use_bpm (dist_sdf).abs * 10 + 2
  
  #if the sign distance value is negative, it plays the disance in prophet
  #if the sign distance value is positive, it plays the distance in piano
  
  if (dist_sdf < 1)
    with_fx [:ping_pong,:flanger].choose, mix: rrand(0.4,0.7) do
      use_synth :prophet
      play (dist_sdf).abs
      sample [:bass_dnb_f,:perc_snap,:perc_swoosh].tick, rate: (r/dist_sdf) if spread(7,12).tick
    end
    
  else
    with_fx [:ixi_techno,:whammy].choose, mix: rrand(0.1,0.9) do
      use_synth :piano
      play (dist_sdf)
      sample [:drum_bass_hard,:tabla_ghe1].choose, beat_stretch: (r/dist_sdf).abs if spread(5,12).tick
    end
    
  end
  sleep 0.5
end
```
