# MinaCoding2023_Green

# GreenFulGreen

Today's MinaCoding Prompt is **Green.** ***GreenfulGreen*** will be coded audiovisually thru **LiveCodeLab, Hydra and SonicPi**.

* The visuals are layered by animations coded in **LiveCodeLab** and **Hydra** in the background.
    
* The sounds are coded in **SonicPi** using a concept of shadow maths and colour shuffling, where in this case the sounds are made through the values of different greens. As well as their shadow/shuffle counterparts to add variance to the soundscape. So when watching,  you are experiencing both green as a colour and a sound.
    

## Video

<iframe width="560" height="315" src="https://www.youtube.com/embed/qRQDQgbGhOA"></iframe>

## Poem

```ocaml
Greenful Greens
Grinning as they move across the screen
Gracing pixel by pixel
Grazing axel by axel
As the screen is now a Greenful Green
```

## Code

### LiveCodeLab

```javascript
noStroke
ambientLight

scale 0.25

if time % 30 > 15
	simpleGradient teal, darkgreen,lightgreen
else
	background black
rotate Math.sqrt(time) + 0.2,Math.hypot(time,sin(time)) + 0.2, Math.cbrt(time) + 0.2

400 times with i
	fill forestgreen
	rotate time * 2 + sin(i)
		move cos(time), Math.sqrt(cos(time)) + 1, sin(Math.cbrt(time % 40)) + 1
			box 1, 0.4, 0.07

200 times with i
	fill color(10,200,75)
	rotate time * 2 + sin(i)
		move 1,1,1
			ball 2, 2, 0.07

100 times with i
	fill color(73,225,10)
	rotate time * 2 + sin(i)
		move sin(time % 20),cos(time),Math.tanh(time)
			box 3, 0.4, 0.07 * wave(0.03)
```

### Hydra

```javascript
osc(4,1,1).color(0,[1,0.75,0.5,0.25],[0.5,0.75,0.35,0.15,1]).kaleid(4)
.scrollX([0.5,-0.5]).scrollY([0.4,0.3,-0.2,-0.1,0.1])
.scale(()=> (time % 22+ 1)/12).rotate(()=> time % 20 + 1).out()

speed = 0.33
```

### SonicPi

```ruby
#Color +Shadows
#RGB Values + XYZ

#Shadeofred [R,G,B, X, Y, Z]



# Teal : 0, 128, 128,11.614, 16.996, 23.089
# ForestGreen : 34, 139, 34, 10.18, 18.92, 4.629
# PaleGreen : 152, 251,152,53.111, 77.934, 41.948

#shadow length equation is Length = height / tan(angle)


#Creating Arrays
Teal = [0, 128, 128,11.614, 16.996, 23.089]
ForestGreen = [34, 139, 34, 10.18, 18.92, 4.629]
PaleGreen = [152, 251,152,53.111, 77.934, 41.948]



with_fx :ixi_techno do
  live_loop :greens do
    i = 0
    
    
    with_fx :whammy, mix: rrand(0.1,0.3) do
      use_synth :pretty_bell
      play (Teal[i] + ForestGreen[i])/5 ,release: 3
      play Teal[i] ,release: 3
    end
    
    
    with_fx :ping_pong, mix: rrand(0.3,0.75) do
      use_synth :chiplead
      play (PaleGreen[i] + ForestGreen[i])/5 ,release: 3, decay: dice(4)
    end
    
    sleep [0.5,1,2].choose
    if i < 7
      i+= 1
    end
  end
end

live_loop :greenshuffle do
  
  TealShuffle = Teal.shuffle()
  ForestGreenShuffle = ForestGreen.shuffle()
  PaleGreenShuffle = PaleGreen.shuffle()
  
  i = 0
  
  
  with_fx [:ixi_techno,:whammy,:flanger].choose , mix: rrand(0.2,0.3) do
    use_synth [:pretty_bell,:piano].choose
    play (TealShuffle[i] + ForestGreenShuffle[i])/4 ,release: 3
    play Math.lgamma(TealShuffle[i]/5 + 2),release: 3
  end
  
  with_fx :gverb, amp: dice(2), mix: rrand(0.2,0.6) do
    with_fx :ping_pong, mix: rrand(0.3,0.75) do
      use_synth [:piano,:chiplead].choose
      play (PaleGreenShuffle[i] + ForestGreenShuffle[i])/5 ,release: 3, decay: dice(4)
    end
  end
  
  
  sleep [0.5,1,2,Math.cbrt(TealShuffle[i] + 2)].choose
  
  if i < 7
    i+= 1
  end
end


#shadow length component
with_fx :ixi_techno do
  live_loop :greensshadow do
    i = 0
    
    with_fx :ping_pong, mix: rrand(0.2,0.9) do
      with_fx :pitch_shift, mix: rrand(0.2,0.3) do
        use_synth :piano
        play (Teal[i]/Math.cbrt(70)).abs + (ForestGreen[i]/Math.hypot(70,10)).abs/30  + 15,release: 3, sustain: 8
        sleep [0.25,0.5,1,2,4].choose
      end
    end
    
    if i < 7
      i+= 1
    end
  end
end
```
