# MinaCoding2024_Bed

# AltAlarmClock

For the 23rd day of **MinaCoding2024 : *"Coding in Bed",* AltAlarmClock** with the aid of **SonicPi** attempts to be an annoying alarm clock while being coded in bed.

## Poem

```ocaml
Time to Awake
for the Head to Elevate

What shall we visualize
For this morning?
For this time?
What is it that you were thinking,
Once the sun rises
And you open the lid on your eyes
And they began to start blinking?
```

## Audio

%[https://soundcloud.com/llestreacha/altalarmclock] 

## SonicPI Code

```ruby
live_loop :breakline do
  with_fx :ping_pong do
    use_random_seed Time.now.to_i
    n = [75,65,55,45].tick
    use_bpm 120 + [-Math.cbrt(n),+Math.sqrt(n)].choose
    sample :ambi_glass_hum,beat_stretch: 4
    sleep [1,2].choose
  end
end


live_loop :breakline1, sync: :breakline do
  with_fx :whammy do
    use_random_seed Time.now.to_i * 0.5
    n = [12,35,57].choose
    with_fx :ixi_techno, mix: rrand_i(0.1,1) do
      use_bpm 120 + [-Math.cbrt(n),+Math.sqrt(n)].choose
      sample :ambi_choir,beat_stretch: [2,4,6].tick
      sleep [1,2].choose
    end
  end
end


live_loop :breakline2, sync: :breakline do
  use_random_seed Time.now.to_i * 1.5
  n = rrand(60,90)
  use_bpm 120 + [-Math.cbrt(n),+Math.sqrt(n)].choose
  sample :elec_blup,beat_stretch: 2
  sleep [2,4].choose
end

live_loop :breakline3, sync: :breakline do
  use_random_seed Time.now.to_i * 2
  n = 45
  with_fx :whammy,mix: 0.7, transpose: rrand_i(12,16) do
    use_bpm 120 + [-Math.cbrt(n),+Math.sqrt(n)].choose
    sample :loop_breakbeat,beat_stretch: dice(4) + 2
    sleep [1,2,0.5,0.75].choose
  end
end
```
