# Genuary2024_Screensaver+Hexagon

# SavingScreen

The prompt for **Genuary 2024 Day 6** is **Screensaver**  and **Day 10**  is **Hexagonal**

To bring ***SavingScreen***  to life, I have coded it in **#SonicPi and #Hydra**

**Hydra** provides the animation for the **Screensaver**  and **SonicPi** delivers a saving of the screen type of soundscape through the equations used in regular **Hexagons**

## Poem

```ocaml
Saving Screens
Erasing the monotone
Aspect of Waiting
As the Screen is saving
Not wanting our Eyes to be Alone
To see what goes next in the Scene
```

## Video

<iframe width="560" height="315" src="https://www.youtube.com/embed/uCBaxkpq_Xw?si=EDkUpotkZ7xLP_C9"></iframe>

## Code

### Hydra

```javascript
osc(0.793, 4, 5)
	.scale([0.0125,1,2,0.5,0.2,0.1,0.3]).scrollY(0.5)
	.kaleid(6).invert().luma([0.5,0.3,0.1].smooth()).brightness(0.3).diff(noise(0,1,3).scrollX(0.3,0.1)).repeat(6,6)
	.pixelate([500, 1000, 2000, 5622.713, 2000, 1000, 500])
	.out();
speed = 0.15;
```

### SonicPi

```ruby
#area of regular hexagon
#(3 * Math.sqrt(3) * s**2)/2


def hexagonarea(s)
  puts (3 * Math.sqrt(3) * s**2)/2
  return (3 * Math.sqrt(3) * s**2)/2
end

def hexagonperimeter(sides)
  return sides * 6
end


live_loop :hexasounds do
  use_random_seed (Time.now.to_i)/2
  #looping the area of hexagons which sides are between 1 and 9
  with_fx :distortion, mix: rrand(0.3,0.6) do
    use_synth [:piano,:chipbass].choose
    play hexagonarea([1,2,3,4,5,6,7,8,9].tick), pitch: hexagonperimeter([1,2,3].choose)
  end
  sleep [0.5,0.75,1,2].choose
end


live_loop :hexasounds2 do
  use_random_seed (Time.now.to_i)/3
  #looping the area of hexagons which sides are between 1 and 9
  with_fx :echo, decay: dice(3) do
    use_synth [:piano,:chipbass].choose
    play hexagonarea([1,2,3,4,5,6,7,8,9].choose), pitch: hexagonperimeter([1,2,3].tick)
  end
  sleep (Time.now.to_i % 4 + 1)/1.5
end
```
