# Mathober2024_Critical

# CriticalCubes

For my 22nd sketch of #Mathober2024 coded in **LiveCodeLab & Sonicpi*, CriticalCubes*** will be using the 20th and 27th of #Mathober2024: ***Dodecicosacron & Critical.*** The visuals coded in ***LiveCodeLab*** is an attempt at the Dodecicosacron while the audio in ***SonicPi*** using the critical ratio used in schedule to compose the sound.

## Poem

```ocaml
The concept of pace
Just knowing sometimes the colours or bright
And other times it needs to be dimmed
Needed to be simmed
With the spillover needing to be trimmed
As the Dodecicosacron impacts this place
```

%[https://youtu.be/G9a1UjQQ8mY] 

## Code

### LiveCodeLab

```javascript
v = (frame) % 510

4 times
    rotate 0, wave, sin(time)
    15 times with i
        fill v/2, abs(v - 130)/3, (time % 30) * 7
        ambientLight abs(110 - v), 24, (v + 2), v/25
        if time % 30 > 15
            stroke (time % 30) * 7, v/2, abs(v - 130)/3
        else
            noStroke
        rotate 
            box wave(0.003) + 1 + v/500
```

### SonicPi

```ruby
#"Critical Ratio (CR) = Time remaining before due date/Remaining processing time : The smallest CR goes first"

def sortage (processing,dueDates)
  
  #setting up the array and the variables to get the ratio
  
  count = processing.length
  
  x = 0
  
  crit_ratio = []
  
  #putting the critical ratio in an array
  while x < count
    crit_ratio[x] = dueDates[x].to_f /  processing[x].to_f
    x += 1
  end
  
  #sorting the array as the smallest ratio goes first
  return crit_ratio.sort
  
end

#the deadline
deadlines = [80,90,100,85,120,51]

#arrays of the crit ratios
critRate = sortage([42,50,70,62,17,45],deadlines)
critRate2 = sortage([12,23,24,81,101,40],deadlines)

live_loop :drums1 do
  
  use_random_seed Time.now.to_i
  
  with_fx :ping_pong do
    with_fx :ixi_techno do
      sample :tabla_dhec, beat_stretch: critRate.tick, pitch: critRate2.tick
    end
  end
  
  sleep [0.25,0.5,0.75,1].choose
  
end

live_loop :drums2 do
  
  use_random_seed Time.now.to_i
  
  with_fx :bitcrusher, mix: rrand(0.3,0.7) do
    with_fx :wobble, mix: rrand(0.3,0.6) do
      sample :tabla_dhec, beat_stretch: critRate.tick
    end
  end
  
  sleep [0.25,0.5,0.75,1].choose
  
end



```
