# Mathober2024_Potential

# ArrayRankFul

For the 14th piece of **Mathober2024**: ***ArrayRankful*** takes the rankings of various arrays and shows the **Potential (4th prompt of this year Mathober)** of these rankings to make sound while coded in ***SonicPi.*** Then remixed for further potential sounds.

## Poetry

```ocaml
The Array and its List
Wants to Be Seen, Wants to Be Heard
They don’t mind to be Absurd
As The Power That Their Voices
When combined can live as rejoices 
Will it Be Able to Move Mountains Or At Least a Tree
That is the Wish From the Array List and the sounds they breathe
```

## Audio

<iframe width="100%" height="300" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/1935927758&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true"></iframe>

[IllestPreacha](https://soundcloud.com/llestreacha) · [ArrayRankFul](https://soundcloud.com/llestreacha/arrayrankful)

## SonicPi Code

```ruby
def ranking(arr)
  
  #sort the array
  sorted = arr.sort.uniq
  
  ranks = Hash.new
  
  count = 0
  
  #this goes through the array and makes a hash for the array to be called upon late
  while count < sorted.length
    ranks[sorted[count]] = count + 1
    
    count += 1
    
  end
  
  rankings = []
  
  count2 = 0
  #going through the array to get the proper number in the ranking
  while count2 < arr.length
    
    rankings.push(ranks[arr[count2]])
    
    count2 += 1
  end
  
  #returns the ranking of the original array
  return rankings
  
end

#the audio part takes the ranking and then turns it into audio

live_loop :potential do
  
  use_random_seed Time.now.to_i
  
  rank = ranking([dice(201),dice(200),dice(205),dice(190),dice(195)])
  
  use_bpm rank[2] *40
  
  
  sample :loop_electric  ,beat_stretch: rank.tick
  
  sleep [0.5,1,2,4].choose
end


live_loop :potential2 do
  use_random_seed Time.now.to_i / 2
  
  rank1 = ranking([dice(201),dice(200),dice(205),dice(190),dice(195), dice(192), dice(207)])
  use_bpm rank1[4] *10
  
  sample :drum_bass_soft  ,pitch: rank1.tick
  sleep [0.5,1,2,4].choose
end

live_loop :potential3 do
  use_random_seed Time.now.to_i / 3
  
  ranks = ranking([dice(201),dice(200),dice(205),dice(190),dice(195)]).tick
  use_bpm 90
  
  sample [:ambi_glass_rub,:ambi_piano].choose  ,rate: ranks, pitch: ranks
  sleep [0.5,1,2,4].choose
end
```
