WCCC_Patterns

WCCC_Patterns

Patterns & Code

PatternOverload

For this week's Creative Code challenge by @sableRaph:"Patterns”, PatternOverload is coded in TixyLand, SonicPi & Hydra.

Pattern Designs

CIrcular and Overlaid patterns can be found in the TixyLand equations as the same equation is repeated through six iterations with various additions to it

The Hydra code allows the circular patterns to move and be expressive, while the SonicPi composition uses time as a seed pattern and various tempos to show how one sound can change its form when speed is used in such a way

Poem

Aerial displays
Circular Relays
As we are glancing above
Inching closer to the direction
That the sun is deflecting those rays
That finds refuge in this place
Which decision shall we embark on today?
Should they be flying aimlessly like a pigeon?
Or shall be embraced by the rhythm 
What is wished upon this space?

Code

TixyLand

//Pattern 1
tan(~i^~hypot(t,i))*sin(x)/y

//Pattern 2
tan(~i^~hypot(t,i))*sin(x)/y  - tan(~y/8+i^t) / (sin(~t)*y/x^i)

//Pattern 3
 tan(~i^~hypot(t,i))*sin(x)/y  - (tan(~y/8+i^t) / (sin(~t)*y/x^i)) / (Math.hypot(~(i|t)%256&(i^~t)%30,i%t))

//Pattern 4
 tan(~i^~hypot(t,i))*sin(x)/y  / ~ (tan(~y/8+i^t) / (sin(~t)*y/x^i)) / (Math.hypot(~(i|t)%256&(i^~t)%30,i%t))

//Pattern 5
tan(~i^~hypot(t,i))*sin(x)/y  %  ~ (tan(~y/8+i^t) / (sin(~t)*y/x^i)) / (Math.hypot(~(i|t)%256&(i^~t)%30,i%t))

//Pattern 6
tan(~i^~hypot(t,i))*sin(x)/y  & ~ (tan(~y/8+i^t) / (sin(~t)*y/x^i)) % (Math.hypot(~(i|t)%256&(i^~t)%30,i%t))

Hydra

s0.initScreen()

src(s0).modulateScale(osc(1,1,1),1.27).modulateScale(osc(1,1,1).kaleid([1,2,3,4,3,2,1].smooth()),1.15).out()

speed = 0.5

SonicPi

use_random_seed Time.now.to_i

#array made from a python script

shipyard1 = [[ 7,  2,  8,  6,  4, 11,  6,  7, 11,  7, 10, 10, 10,  5, 11,  7],
             [ 5,  5, 10,  8,  1,  4, 10, 11, 10, 11,  6, 10, 11, 10,  2,  4],
             [11,  1,  8,  9, 10,  7, 10, 10,  5, 10,  9,  6,  6,  1,  9, 11],
             [10,  8, 10,  6, 11,  1,  5,  9,  6,  1, 10,  4, 10,  7, 10,  7],
             [10,  8, 10, 10,  7,  4,  1,  9, 11,  9, 10,  2,  7, 10,  8,  5],
             [10,  8, 10,  9, 10,  8,  8,  9, 10, 11,  8,  3, 10,  5, 10,  8],
             [ 2,  3,  5, 10,  7,  9, 11,  6,  6,  6,  3, 10,  7,  6, 10,  3],
             [ 9, 11,  9,  9, 10, 11, 11, 10, 11,  7, 10, 10,  7,  6,  8,  6],
             [11,  4,  6,  7, 11, 10,  5,  6,  6, 11,  0,  9,  8, 10, 11,  9],
             [ 4,  7, 11,  6,  7,  9, 11,  9,  1,  9,  8, 11,  3,  9,  6,  8],
             [ 3, 11,  3, 10,  7,  9, 10,  4,  0,  7,  6, 11,  2,  8, 10, 11],
             [ 7,  6, 10,  1, 11,  2,  3, 10,  6,  8,  4, 11,  3,  8,  8,  6],
             [ 4,  2,  1, 11,  1, 11, 11,  8,  6, 10,  8, 10,  1, 10,  4, 10],
             [ 8,  6,  8,  3,  5, 10,  9,  2, 10, 11,  7,  6, 10, 11, 11,  9],
             [ 8,  7, 11, 10,  1, 10,  8, 10,  4,  9, 10,  3,  7, 11,  7,  4],
             [ 8,  8, 10,  5,  9,  0,  2, 10,  9,  5,  0, 10,  6,  0, 10, 11]]

shipyard2 = [[ 8, 10,  7,  6,  4,  7, 10,  1,  5,  8, 10,  9,  6,  9, 10,  5],
             [11,  3,  8, 10,  8, 10,  4,  7, 10,  7, 10,  7, 10, 10, 10, 10],
             [ 7,  5,  7, 10,  7,  7,  8, 10, 10,  3,  6, 10, 11,  6,  6,  9],
             [10, 11,  6, 10,  9, 11, 11,  2,  4,  9,  9,  2,  8,  1, 11,  1],
             [11,  9, 10, 11,  9,  9,  7,  2,  6,  9, 10, 11,  9,  9,  0, 11],
             [ 8,  6,  9,  9, 10,  4,  6, 10,  7,  4,  9, 11,  4,  8,  6,  7],
             [11,  6,  6,  4, 10,  2,  6,  4,  7,  2,  7,  9, 10, 10, 10,  9],
             [ 8,  0, 11,  8,  1, 11,  5,  7, 10,  7,  7,  5, 11,  0, 10,  1],
             [10,  8,  1,  5, 10,  7,  8,  7, 11,  4,  2,  4,  2, 10,  8, 10],
             [ 1, 11,  2,  5,  7, 11, 11,  2,  7,  3,  6, 10,  8,  8, 10,  4],
             [ 6, 10,  6,  6, 10,  2,  9,  5,  8,  6,  8, 10,  1, 11, 10,  6],
             [ 9,  7,  9,  4,  1,  6,  6,  7,  8,  9, 10, 11,  6,  6, 10,  8],
             [ 9,  3, 10,  7,  0, 11, 10,  5, 11, 11,  9,  7,  8, 10, 10,  0],
             [ 2, 11,  6, 10,  9,  7,  1, 10,  7,  0,  0,  9,  7,  8,  3,  8],
             [ 3,  9,  5, 10,  2,  7,  4,  6,  2,  1,  4,  5,  6,  3, 10,  7],
             [ 4, 10,  6,  9,  7, 10,  6,  4, 11,  5,  4,  3,  8, 10,  9,  6]]


shipyard3 = [[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]]


shipyard4 = [[10, 10,  6,  8,  9,  7,  6,  9, 11,  4,  6,  3,  3,  2,  6, 10],
             [ 1, 11, 11,  9,  5,  6,  8,  1, 10,  7,  3,  3, 10, 11, 10,  5],
             [ 3, 10,  4, 10, 10,  7,  6,  8,  7,  1, 11,  2,  7, 10,  4, 10],
             [ 3, 10,  6,  7,  8,  6,  1,  7,  8,  7,  6,  8,  4,  7,  6, 11],
             [ 9, 10,  9, 11, 10,  8,  7,  4,  5, 11, 11,  3,  9,  7, 10,  7],
             [ 3,  8,  7,  8, 10, 10,  3,  5,  9,  8,  8,  6,  7,  7, 10, 10],
             [ 3,  8,  1,  2,  7,  4,  9,  7,  2, 10,  3,  6,  0,  1, 10,  7],
             [10,  5, 11,  3,  5,  6, 10,  6,  8,  8,  6,  8,  7,  3,  4,  7],
             [ 7,  8,  2,  9,  6, 11,  7,  8,  1,  7, 11, 11, 10,  7, 11, 11],
             [ 5, 11,  0, 11,  6, 10,  5,  9,  9,  6, 10, 10,  8,  1,  9, 11],
             [ 6,  0, 10, 10, 11,  3,  5,  7,  6,  9, 11,  6,  6, 11, 10, 10],
             [ 2,  6, 10,  5, 10,  8,  1,  8, 11,  8,  4,  8, 11,  9, 10, 10],
             [ 6, 11, 11,  6,  7,  8,  2,  8,  8,  6, 10,  8, 10,  7,  2,  3],
             [10,  2, 10,  7,  6,  6, 11, 10,  1,  6, 10, 10, 11,  7, 11, 10],
             [ 8, 11,  9,  8, 10,  9, 10, 10,  3, 11,  5, 11, 10,  7, 11,  3],
             [10,  6, 10,  9, 10,  2,  1,  7,  9,  7,  7,  6,  5,  7,  8, 10]]


shipyard5 = [[11,  7,  6,  9, 10,  2, 10,  5,  8,  3,  6, 10,  6,  0,  9,  3],
             [ 9, 11,  2, 10,  8,  2,  9,  4, 11, 10,  3,  0,  9, 10,  2,  7],
             [10,  6, 11,  6, 11,  9,  0,  7,  9, 11, 11,  5,  7, 11,  8, 11],
             [ 9,  3,  1,  9, 11,  9,  6,  2, 10,  2, 10,  6,  5,  6,  9,  9],
             [10,  5,  6,  3,  9,  5,  5, 11,  6,  3,  6, 10,  3,  4, 10,  3],
             [ 4, 10,  5,  2, 10,  6,  4, 11,  7,  3,  9,  7, 10,  6,  7, 11],
             [11, 10,  9, 10, 10, 11, 10,  0, 11, 11,  7,  9,  2, 11,  6,  8],
             [10, 10,  3,  2, 10,  4,  8,  4, 10,  9,  8,  4,  9,  9,  1,  4],
             [ 7,  7, 11, 11,  4, 11,  6, 10,  6,  9,  9, 11,  6,  0,  4,  7],
             [ 8,  7,  7,  9,  8,  8, 11,  9,  4, 11,  7,  8,  1, 11,  7,  9],
             [10,  4,  2,  4,  6,  6, 11,  7,  5,  6,  7,  7,  6, 11, 10,  7],
             [ 9, 10,  6,  1, 10,  9,  8, 10, 11,  9,  3,  9, 10, 10,  2, 10],
             [ 7, 10,  9, 10,  2, 10,  9, 10,  4, 10, 11,  9, 10, 10,  6,  4],
             [ 6, 10,  3,  7,  2, 10,  6,  9,  6,  9,  8, 10, 11, 11,  9,  3],
             [10,  6, 11, 10,  5,  3, 11,  9,  9,  6,  5,  6,  7,  8,  4,  2],
             [ 1,  2, 10, 10,  4,  9,  4,  1,  9, 10, 11,  8,  4,  9,  7,  2]]

def sonification(shipyard,looping,sampling,seedling)

  use_random_seed Time.now.to_i / seedling + 5

  live_loop looping do

    use_random_seed Time.now.to_i / seedling + 4


    #choosing bpms
    bpm_selection = [40,100, 250, 10, 500,12]

    use_bpm = bpm_selection.choose


    #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

        #these variables will be the main event trigger for each scenario, through different uses

        x = shipyard[i][j]
        y = Math.sqrt(shipyard[i][j])
        case x #using case & when as a switch while using

        when 1..3
          with_fx :ping_pong, mix: 0.65 do
            with_fx :ixi_techno, mix: 0.75 do
              with_fx [:echo,:whammy].choose, mix: rrand(0.4,0.8) do
                sample [:loop_safari,:tabla_ghe4].choose, amp: 6, rate: x * rrand_i(-2,2) + 0.01, beat_stretch: y
              end
            end
          end

        when 4..6
          with_fx [:ping_pong,:vowel].choose, mix: rrand(0.4,0.8) do
            sample [:elec_blip,:elec_blip2,:elec_bong].choose, beat_stretch: y + 1, amp: x - 1, decay: x + 1
          end

        when 7..9
          if x % 2 == 0
            use_synth :piano
            n = ring(:b3,:c4,:c5,:d6,:e7,x*9,x*12)
          else
            use_synth [:prophet,:chipbass,:chiplead].choose
            n = ring(:c5,:a4,:b1,x*7)
          end

          with_fx :wobble do
            play n.tick, on: spread(x+6,24).look, release: (x/24), pan: -0.5
          end

        else
          with_fx [:ping_pong,:flanger,:whammy].choose, amp: 1, mix: rrand(0.4,0.8) do
            sample sampling, attack: x, beat_stretch: (x-3).abs
          end
        end

        sleep [0.5,0.75,1,1.5,2].choose #pause in between each spawn, replicating the different thinking processes
      end
    end
  end

end


#following a tick format

live_loop :ticking do

  use_random_seed Time.now.to_i / 3

  sonification(shipyard5,:yard5,:ambi_glass_hum,5)
  sonification(shipyard4,:yard4,:ambi_glass_rub,6)
  sonification(shipyard3,:yard3,:ambi_piano,7)
  sonification(shipyard2,:yard2,:ambi_glass_hum,8)
  sonification(shipyard1,:yard1,:ambi_piano,9)

  sleep [2,4,8].choose
end



#following a shuffle format

live_loop :shuffling do

  use_random_seed Time.now.to_i / 4

  sonification(shipyard1.shuffle,:yard1mix,:ambi_choir,11)
  sonification(shipyard3.shuffle,:yard3mix,:ambi_lunar_land,12)
  sonification(shipyard5.shuffle,:yard5mix,:ambi_soft_buzz,13)

  sleep [2,4,8].choose
end

#following a reverse format




live_loop :reversing do

  use_random_seed Time.now.to_i / 5

  selection =  [:elec_plip,:ambi_choir,:tabla_ghe2,:ambi_lunar_land,:ambi_soft_buzz]

  with_fx :vowel do
    sonification(shipyard2.reverse,:yard1rev,selection[dice(5) -1],1)
    sonification(shipyard4.reverse,:yard3rev,selection.shuffle[dice(5) -1],2)
  end

  sonification(shipyard5.reverse,:yard5rev,selection.reverse[dice(5) -1],3)

  sleep [2,4,8].choose
end