# WCCC_PersonalHell

# SonicOverLoad

For this week's Creative Code challenge by @[@sableRaph](@sableRalph) [:](https://hashnode.com/@sableRalph) ***Personal Hell,*** **SonicOverLoad** is coded mainly in ***SonicPi*** with some ***Python***.

## **OverLoad Design**

To Represent the topic, various SonicPi compositions were remixed and layered to represent that muddyness one would expect with the topic. To further follow the theme, a lot of the sounds were sped up to mimic an overload to the ears and the brain. The title and feeling was motivated by the concept of the movie: ***Lucy,*** where there seems to be a lot of pain associated if a brain were to download all information possible.

## Poetry

```ocaml
The Index
The Process
What sounds shall emerge
What sounds shall submerge
From this Process
Of adding an Index
What will this overload do
When the process adds more stress
That gets intense
In depth with the senses
What feelings will no longer impress
And which mentality will start to regress
As it is being suppressed
```

## Audio

<iframe width="100%" height="300" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/1830948993&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) · [SonicOverLoad](https://soundcloud.com/llestreacha/sonicoverload)

## *Code*

### SonicPi (Layered, Remixed, Tempo Changes)

```ruby
#array created from the python script
vars = [[10, 11,  6,  7,  8,  6,  6,  4, 10, 11,  2,  2,  2, 10,  6, 10],
        [ 2, 10,  7, 10,  8,  7, 10,  1,  8,  3, 11,  7,  8,  5, 10,  7],
        [ 9, 10,  6,  9,  8,  0,  8, 11,  3,  6,  4, 10,  5, 11,  8,  2],
        [ 7,  7,  3,  6, 11,  6,  3, 10,  7,  7,  8,  7,  6,  8, 11,  3],
        [ 9, 10, 10,  9, 10, 10, 10,  6,  8,  5, 10,  8, 11,  6,  2, 11],
        [10, 10,  2, 10,  7,  5,  5,  6,  7,  9,  5, 10, 11,  7,  9, 10],
        [ 7, 10, 10, 10,  9, 10,  6, 10,  2, 11,  8,  8,  7, 10,  1,  8],
        [11, 10, 11, 10,  8, 10,  8,  9, 10, 10, 10, 10, 10,  2,  0,  3],
        [10, 11,  7,  8, 10, 11,  7,  4, 11,  8,  2,  2, 10,  1,  1,  4],
        [ 5,  6, 11, 10,  2,  1,  6,  5,  7,  2,  8,  8,  8,  6,  5,  4],
        [10,  8,  4,  3, 10,  7, 11,  6,  8,  5,  5,  8,  9,  7,  7, 10],
        [ 7, 11, 11,  2,  9,  3,  9,  8,  9, 11,  7,  6, 11, 11,  4,  2],
        [ 6, 10,  9, 11,  4, 11,  8,  3,  4,  8, 11,  7, 11,  6,  3,  8],
        [ 9,  8,  4,  4, 11,  8,  8, 10, 11,  9,  3, 10, 11, 10,  7,  6],
        [ 4,  5,  9,  4,  1,  7, 10,  5, 10,  6, 11, 11,  0,  0,  8,  7],
        [ 6, 10, 10, 11, 10,  0, 10,  2,  6,  0,  0,  6, 10,  9,  9,  8]]

#function that uses the array to control alot of variables
def spooks(looping,randomness,array,samples)
  live_loop looping do
    use_random_seed randomness
    
    for i in (0...array.size) #overall size of range
      for j in (0...array[i].length) #overall length of the array
        with_fx :wobble ,amp: [2,1,0.5,0.25,0.15,0.3].tick, mix: [0.5,0.3,0.1].choose do
        sample samples ,beat_stretch: array[i][j] + 1, decay: array.shuffle[i][j], rate: array.shuffle[i][j] + rrand(-0.1,0.1)
      end
    end
    sleep [0.5,1,1.25,2].choose
  end
end
end

#shuffling the array to make the difference before it hits the loop
#using the Time variable to have the randomness unique amongst the functions

spooks(:scope1,Time.now.to_i,vars,:ambi_haunted_hum)
spooks(:scope2,Time.now.to_i/2,vars.shuffle,:ambi_glass_hum)
spooks(:scope3,Time.now.to_i/3,vars.shuffle,:ambi_glass_rub)
spooks(:scope4,Time.now.to_i/5,vars.shuffle,:ambi_lunar_land)
```

```ruby
#5 different battle ship boards with the mine versions

use_random_seed Time.now.to_i


shipyard1 = [[0, 0, 0, 1, 0, 0, 1, 0, 1, 1],
             [1, 0, 0, 0, 0, 1, 1, 0, 0, 0],
             [1, 0, 0, 0, 0, 1, 1, 0, 0, 0],
             [0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
             [1, 2, 0, 0, 0, 0, 0, 0, 0, 0],
             [0, 0, 0, 0, 0, 0, 2, 0, 0, 1],
             [1, 0, 0, 0, 0, 0, 0, 0, 1, 0],
             [0, 0, 0, 1, 0, 0, 0, 0, 1, 0],
             [0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
             [0, 0, 0, 0, 1, 0, 1, 0, 0, 0]]

shipyard2 = [[2, 1, 0, 0, 0, 0, 0, 0, 0, 1],
             [0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
             [0, 0, 1, 0, 0, 1, 0, 0, 0, 0],
             [0, 0, 0, 0, 0, 0, 1, 1, 0, 1],
             [0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
             [2, 0, 0, 1, 0, 0, 0, 0, 0, 0],
             [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
             [0, 1, 0, 0, 0, 1, 0, 1, 0, 0],
             [0, 0, 1, 0, 0, 0, 0, 0, 1, 0],
             [0, 0, 0, 0, 0, 1, 0, 1, 0, 0]]


shipyard3 = [[0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
             [0, 0, 0, 0, 1, 0, 1, 1, 0, 0],
             [0, 1, 0, 1, 1, 0, 0, 0, 1, 0],
             [1, 0, 0, 0, 1, 0, 0, 0, 0, 0],
             [0, 0, 2, 0, 0, 0, 0, 1, 1, 0],
             [0, 0, 1, 0, 0, 2, 0, 1, 0, 0],
             [2, 2, 2, 0, 1, 2, 0, 0, 0, 0],
             [0, 1, 0, 1, 0, 0, 0, 0, 0, 0],
             [0, 1, 0, 0, 0, 1, 2, 0, 1, 0],
             [0, 0, 0, 0, 0, 0, 0, 1, 2, 0]]


shipyard4 = [[1, 0, 1, 0, 0, 0, 0, 0, 2, 0],
             [0, 0, 0, 1, 0, 0, 0, 0, 1, 0],
             [0, 0, 0, 1, 0, 0, 0, 0, 0, 2],
             [2, 0, 2, 0, 0, 0, 0, 0, 0, 0],
             [0, 1, 1, 0, 0, 0, 1, 0, 0, 0],
             [0, 1, 0, 0, 0, 0, 0, 1, 0, 0],
             [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
             [0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
             [0, 0, 0, 0, 0, 0, 2, 0, 0, 0],
             [0, 0, 0, 2, 0, 0, 0, 0, 0, 0]]


shipyard5 = [[2, 0, 0, 0, 1, 0, 0, 0, 1, 2],
             [0, 0, 0, 0, 0, 0, 1, 1, 0, 0],
             [1, 0, 0, 1, 0, 0, 0, 0, 1, 0],
             [1, 0, 0, 2, 1, 1, 0, 0, 0, 0],
             [0, 1, 0, 1, 0, 0, 0, 0, 0, 2],
             [0, 0, 0, 0, 0, 0, 0, 0, 2, 1],
             [0, 0, 0, 0, 0, 0, 1, 0, 0, 2],
             [0, 0, 0, 0, 0, 1, 0, 0, 1, 0],
             [1, 0, 0, 0, 0, 1, 1, 0, 0, 0],
             [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]

def sonification(shipyard,looping,sampling)
  
  live_loop looping do
    
    #iterating the 2d arrays
    for i in (0...shipyard.size) #overall size of range
      for j in (0...shipyard[i].length) #overall length of the arrays
        if shipyard[i][j] == 2   #play every value
          
          with_fx :ixi_techno do
            with_fx :echo, mix: rrand(0.4,0.8) do
              sample [:loop_safari,:tabla_ghe4].choose, amp: 6, beat_stretch: dice(4)
            end
          end
          
        elsif shipyard[i][j] == 1
          with_fx :ping_pong, mix: rrand(0.4,0.8) do
            sample [:elec_blip,:elec_blip2,:elec_bong].choose, amp: 4, decay: 4
          end
        else
          with_fx [:ping_pong,:flanger,:whammy].choose, amp: 1, mix: rrand(0.4,0.8) do
            sample sampling
          end
        end
        sleep [0.75,1,1.5].choose #pause in between each spawn, replicating the different thinking processes
      end
    end
  end
  
end


sample

sonification(shipyard5,:yard5,:ambi_glass_hum)
sonification(shipyard4,:yard4,:ambi_glass_rub)
sonification(shipyard3,:yard3,:ambi_piano)
sonification(shipyard2,:yard2,:ambi_glass_hum)
sonification(shipyard1,:yard1,:ambi_piano)
```

```ruby
#In This Remix, I made sure the variables of Aqua was switched in every computation

#Colors pair 1
Aqua = [0,255,255]
Coral = [255,127,80]

#Colors Pair 2
Lavender = [230, 230, 250]
Gold = [255,215,0]

#Colors Pair 3
MidnightBlue = [25,25,112]
DarkOrange = [255,140,0]

#Colors Pair 4
SlateGray = [112, 128, 144]
Crimson = [220,20,60]


def linear_transform(matrixA,vectorA)
  
  #this is the first row of the matrix
  row1 = matrixA[0]
  #this is the second row of the matrix
  row2 = matrixA[1]
  #this is the third row of the matrix
  row3 = matrixA[2]
  
  #this is the first val of the vector
  vec_x = vectorA[0]
  #this is the second val of the vector
  vec_y = vectorA[1]
  #this is the third val of the vector
  vec_z = vectorA[2]
  
  
  #this is the first value of the new vector
  vec_x_formed = [row1[0]*vec_x + row1[1]*vec_y + row1[2]*vec_z]
  #this is the second value of the new vector
  vec_y_formed= [row2[0]*vec_x + row2[1]*vec_y + row2[2]*vec_z]
  #this is the third value of the new vector
  vec_z_formed = [row3[0]*vec_x + row3[1]*vec_y + row3[2]*vec_z]
  
  #new vector
  vec_change = [vec_x_formed[0],vec_y_formed[0],vec_z_formed[0]]
  
  
end

def color_det2(loop,row1,row2,spread1,spread2)
  
  
  #Cramers Rule with Colors
  
  x1a = row1[0]
  x2a = row1[1]
  b_a = row1[2]
  
  x1b = row2[0]
  x2b = row2[1]
  b_b = row2[2]
  
  #determinant of main matrix [x1a,x2a,x1b,x2b]
  det_a = ((x1a * x2b) - (x2a * x1b)).to_f
  
  #determinant of main matrix but first column replace by b_a & b_B
  det_b = (b_a * x2b) - (x2a * b_b)
  
  #determinant of main matrix but second column replace by b_a & b_B
  det_c = (x1a * b_b) - (b_a * x1b)
  
  #the solving of the above equations
  
  det_1 = det_b/det_a
  det_2 = det_c/det_a
  
  puts det_1
  puts det_2
  
  #a ring of halves (120 60 30 15 7.5) then ticks
  #line does the same with steps, using it for the sleep chase
  bpm_chase = (halves 120, 5)
  sleep_chase = (line 0, 4, steps: 4)
  
  live_loop loop do
    use_bpm bpm_chase.choose
    use_random_seed Time.now.to_i
    with_fx :ping_pong, mix: rrand(0.4,0.65) do
      sample [:ambi_choir,:drum_snare_hard,:drum_tom_mid_soft].choose, rate: det_1,beat_stretch: (det_2).abs, pitch: det_1/det_2 if spread(spread1,spread2).tick
      sleep [(det_1+det_2).abs, (spread1/spread2) + sleep_chase.tick].choose
    end
    
    
    with_fx :echo do
      use_synth [:piano,:chiplead,:dull_bell,:piano].choose
      play det_2/det_1
    end
    
  end
end

def color_det(loop,row1,row2)
  
  
  #Cramers Rule with Colors
  
  x1a = row1[0]
  x2a = row1[1]
  b_a = row1[2]
  
  x1b = row2[0]
  x2b = row2[1]
  b_b = row2[2]
  
  #determinant of main matrix [x1a,x2a,x1b,x2b]
  det_a = ((x1a * x2b) - (x2a * x1b)).to_f
  
  #determinant of main matrix but first column replace by b_a & b_B
  det_b = (b_a * x2b) - (x2a * b_b)
  
  #determinant of main matrix but second column replace by b_a & b_B
  det_c = (x1a * b_b) - (b_a * x1b)
  
  #the solving of the above equations
  
  det_1 = det_b/det_a
  det_2 = det_c/det_a
  
  puts det_1
  puts det_2
  
  sample
  
  live_loop loop do
    use_random_seed Time.now.to_i
    with_fx :ping_pong, mix: rrand(0.4,0.65) do
      
      sample [:ambi_choir,:glitch_perc3,:bass_woodsy_c].choose, rate: [det_1,det_2].choose,beat_stretch: [(det_2).abs,(det_1).abs].tick, pitch: [det_1/det_2,det_2/det_1].choose
      sleep (det_1+det_2).abs
      
      use_synth :piano
      play (det_1/det_2).abs
      
      with_fx :krush do
        use_synth :prophet
        play (det_2/det_1).abs
      end
    end
  end
end


#this mathematical sections turns the combo of Aqua, Lavender, Gold into Cyber Neon Green
#R,G,B(0,250,40)

color_matrix1 = [Aqua, Lavender, Gold]
first_vector = [1,-1,1]

CyberNeonGreen = linear_transform(color_matrix1,first_vector) #not cybergreen no more due to aqua inclusion

#this mathematical sections turns the combo of Aqua, DarkOrange, MidnightBLue into
color_matrix2 = [Aqua, DarkOrange, MidnightBlue]
second_vector = [1,-1,1.75]

SoftPink = linear_transform(color_matrix2,second_vector) #not softpink due to the aqua inclusion

color_matrix3 = [Crimson, Aqua, Coral]
third_vector = [0.5,1,2]

CucumberIce  = linear_transform(color_matrix3,third_vector)
#getting the traces
color_mx1_trace = color_matrix1[0][0] + color_matrix1[1][1] + color_matrix2[2][2]
color_mx2_trace = color_matrix2[0][0] + color_matrix2[1][1] + color_matrix2[2][2]
color_mx3_trace = color_matrix3[0][0] + color_matrix3[1][1] + color_matrix3[2][2]


live_loop :ColorBending do
  use_random_seed Time.now.to_i / 2
  
  with_fx :whammy, mix: 0.25 do
    color_det(:aquaVcoral,Aqua,Coral)
    sleep [0.5,1,4].choose
    color_det(:LavenderVgold, Lavender, Gold)
    sleep [0.5,1,2].choose
    color_det(:MidnightvsOrange,MidnightBlue, DarkOrange)
    sleep 2
    color_det(:GrayvCrimson,SlateGray, Crimson)
    sleep [1,2].choose
  end
  
  with_fx :hpf do
    with_fx [:wobble,:ping_pong].choose, mix: rrand(0.2,0.6) do
      with_fx [:ping_pong,:vowel].choose,  mix: rrand(0.25,0.75) do
        color_det(:aquaVGold,Aqua,Gold)
        sleep [2,4,8].choose
        color_det(:CrimsonVAqua,Crimson,Aqua)
        sleep [2,4,8].choose
        color_det(:AquaVOrange,DarkOrange,Aqua)
        color_det(:GrayvAqua,SlateGray, Aqua)
      end
    end
  end
  
  
  sleep [0.5,1,2,4].choose
end

live_loop :colortwisting do
  with_fx :echo, mix: 0.65 do
    with_fx :ping_pong do
      color_det2(:CybervsSoft,CyberNeonGreen,SoftPink,color_mx1_trace,color_mx2_trace)
      sleep [2,4,8].choose
      color_det2(:IcevsWarmth,SoftPink,CucumberIce,color_mx2_trace,color_mx3_trace)
      sleep [2,4,8].choose
      color_det2(:IcevsCyber,CucumberIce,CyberNeonGreen,color_mx3_trace,color_mx1_trace)
      sleep [3,6,9].choose
    end
  end
  sleep [0.5,1,2].choose
end


#//3 x 3 matrix sound by random numbers between 0  & 30
live_loop :choirflow do
  use_random_seed Time.now.to_i
  
  #using the halves with a random integer
  bpm_chase = (halves 120, rrand_i(4,9))
  use_bpm bpm_chase.reverse.tick
  
  y = rrand(0,30)
  puts y
  
  pos = [y*2,y-21,y,y+3,(y-7).abs,y+5,y/4, y/5+2, y-14]
  
  a = pos[0]
  b = pos[1]
  c = pos[2]
  d = pos[3]
  e = pos[4]
  f = pos[5]
  g = pos[6]
  h = pos[7]
  i = pos[8]
  
  #//recoding into Matrix Coordinates
  
  A11 = a
  A12 = b
  A13 = c
  A21 = d
  A22 = e
  A23 = f
  A31 = g
  A32 = h
  A33 = i
  
  
  #//determinant formula
  det_a = a*(e*i - f*h) - b*(d*i - f*g) + c*(d*h - e*g)
  trace = a + e +  i
  normal = Math.sqrt(a*a + b*b + c*c + d*d + e*e + f*f + g*g + h*h +  i*i)
  
  #//Adjoint Formula
  
  Adj_a = (A22*A33 - A23*A32)
  Adj_b = -1 * (A12 * A33 - A13 * A32)
  Adj_c = A12 * A23 - A13 * A22
  Adj_d = -1 * (A21 * A33 - A23 * A31)
  Adj_e = (A11 * A33 - A13 * A31)
  Adj_f = -1 * (A11 * A23 - A13 * A21)
  Adj_g = (A21 * A32 - A22 * A31)
  Adj_h = -1 *(A11 * A32 - A12 * A31)
  Adj_i = (A11 * A22 - A12 * A21)
  
  #inverse formula
  #*A-1 = (adj A)/(det A)*/
  
  inv_a = Adj_a/det_a
  inv_b = Adj_b/det_a
  inv_c = Adj_c/det_a
  inv_d = Adj_d/det_a
  inv_e = Adj_e/det_a
  inv_f = Adj_f/det_a
  inv_g = Adj_g/det_a
  inv_h = Adj_h/det_a
  inv_i = Adj_i/det_a
  
  
  counter_tick = (line 0, 14, steps: 7)
  
  
  sample :ambi_choir, decay: Adj_a.abs, rate: inv_a if spread(5,12).tick
  sample [:ambi_choir,:loop_breakbeat].choose , decay: Adj_b.abs, rate: inv_b
  sample :ambi_choir , decay: Adj_c.abs, rate: inv_c if spread(19,39).tick
  sleep [1,2,4,8].choose
  sample [:ambi_choir,:tabla_ghe3].tick , decay: Adj_d.abs, rate: inv_d
  sample :ambi_choir , decay: Adj_e.abs, rate: inv_e
  sample [:ambi_choir,:loop_weirdo].choose , decay: Adj_f.abs, rate: inv_f if spread(27 - counter_tick.tick,195).tick
  sleep [4,8,16].choose
  puts inv_i
  
  sleep [0.5,1,2,4].choose
  
end
```

```ruby
live_loop :rollback2 do
  #making true random as it goes with the actual time
  #then using the Math.cbrt to make it a different seed ratio then the above function
  use_random_seed Math.cbrt(Time.now.to_i)
  use_bpm 360
  puts Time.now.to_i
  with_fx [:echo,:whammy,:ixi_techno].choose, mix: rrand(0.1,0.6) do
    with_fx :ping_pong, mix: rrand(0.1,0.9) do
      sample"E:/Creatuve Code Challenges/PersonalHell/Tormented_1.wav",rate: Math.sqrt(dice(25) + 1)/3
      sleep [128,64,96].choose
    end
  end
  sleep [0.5,1,2].choose
end

live_loop:rollback do
  use_bpm 30
  use_random_seed Time.now.to_i
  with_fx :ixi_techno do
    with_fx :echo, mix: rrand(0.4,0.8) do
      sample "E:/Creatuve Code Challenges/PersonalHell/Tormented_1.wav", amp: 6, beat_stretch: dice(4)
    end
  end
  
  with_fx :ping_pong, mix: rrand(0.4,0.8) do
    sample "E:/Creatuve Code Challenges/PersonalHell/Tormented_1.wav", amp: 4, decay: 4
  end
  
  with_fx [:ping_pong,:flanger,:whammy].choose, amp: 1, mix: rrand(0.4,0.8) do
    sample "E:/Creatuve Code Challenges/PersonalHell/Tormented_1.wav"
  end
  
  sleep [0.75,1,1.5].choose #pause in between each spawn, replicating the different thinking processes
end
```

### Python

```python
#battleship is a 10 x 10 board game, for the purpose of this, we will be arranging various new classes of ships

import numpy as np
import seaborn as sns
import matplotlib.pylab as plt

def battle():
    #using the 0 & 1 to represent a ship versus the ocean and having a weighted value of 0.8 for ocean, 0.18 for boats and 0.02 for mines
    boats = [0,1,2,3,4,5,6,7,8,9,10,11]
    prob = [0.025,0.025,0.05,0.05,0.05,0.05,0.1,0.1,0.1,0.1,0.2,0.15]

    #by adding the (10,10) instead of 5, able to make an array with the weighted values
    shipyard2 = np.random.choice(boats, (16,16), p=prob)
    return shipyard2



def plotting(x):
    letters = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P'] #set for the columns
    uniform_data = x
    ax = sns.heatmap(uniform_data, linewidth=0.5,cmap="Reds") #changing it to blue for ocean representation
    ax.set_xticklabels(letters) #setting the ticks of the x axis to letters
    plt.show()
    return x
    
plotting(battle())
```
