Genuary2023_PersianRug

Genuary2023_PersianRug

RugSymbiote : The Rug That Could Never Be

The prompt for Genuary 2023 Day 21 is

Persian Rug

Today's prompt will be coding in Hydra alongside SonicPi and will consist of a Rug Symbiote that could never quite be a Persian Rug. Even after many attempts of transforming, and reworking colour schemes, it just doesn't work out for the symbiote but it never gives up. As the symbiote believes one day, it will become the design it strives to be, no matter the iterations.

Hydra Code

shape(4, 0.5, 2)
    .color(()=> (time % 30 + 1)/30, [0.57,1,0.25,0.75].smooth(), [2,1,0,0.5,1].fit())
    .brightness([0.1, 0.2, 0.23, 0.2, 0.1].smooth())
    .luma([0.85, 0.73, 0.682, 0.7, 0.8, 0.81].smooth())
    .repeat(() => (time % 45 + 1) / 5)
    .kaleid([4, 4.1].smooth()).modulatePixelate(shape(4,0.5,2).colorama(()=> (time % 12 + 1)/9),1)
    .diff(shape(4, 0.5, 2)
        .luma([0.82, 0.73, 0.65, 0.79, 0.82].smooth())
        .scale(0.5)
         .repeat(() => (time % 45 + 1) / 5))
    .kaleid([4,4.6, 4].smooth())
    .blend(shape(4, 0.5, 2)
        .color(0.5,0.3,0.1)
        .luma([0.82, 0.73, 0.65, 0.79, 0.82].smooth())
        .scale([0.25, 0.5, 0.75].smooth()))
    .kaleid([4, 4.1, 4.2, 4.6, 4.2, 4.1, 4].smooth())
.modulateRotate(noise(4,0.5,2).scale(()=> (time % 10 + 2)/2),1)
.modulateKaleid(shape(4,0.5,2).scale(()=> (time % 3  +1)/2).repeat(()=> (time % 12 + 1)/3),1)
    .out();
speed = 0.225;

SonicPi Code

#slowed down by 17%

def sounding(loop1,loop2,sampling,sampling2)

  live_loop loop1 do
    with_fx :ping_pong do
      with_fx :whammy, mix: rrand(0.1,0.7) do
        use_bpm 40
        sample sampling, rate: [0.5,1,2,1,0.5].choose,sustain: dice(10) if spread(7,12).tick
        sleep [5,10].choose
      end
    end
  end


  live_loop loop2 do
    with_fx :ixi_techno do
      with_fx :whammy, mix: rrand(0.1,0.7) do
        use_bpm 40
        sample sampling2 if spread(19,24).tick
        sleep [0.25,0.5,1].choose
      end
    end
  end

end

def pianos(bpm,looping,effects,notes1,notes2,samples)
  use_bpm bpm
  live_loop looping do
    with_fx :rbpf do
      with_fx effects, mix: [0.4,0.5,0.6].choose do
        use_synth :piano
        play notes1 ,delay: dice(3), decay: dice(4)
        play notes2,sustain: dice(3), attack: dice(5)
        sample samples, beat_stretch: 0.625, amp: dice(6)
        sleep [0.125,0.25,0.5,0.75,1,2].choose
      end
    end
  end
end

i = 0

live_loop :transformation do


  #make an array of randomly shuffle numbers that range from 0 to 25
  counter = (0..25).to_a.shuffle()

  if counter[i] < 8
    sounding(:hausing,:hausing2,[:loop_weirdo,:loop_tabla].tick,[:drum_bass_hard,:elec_lo_snare].tick)
    sounding(:hausing3,:hausing4,[:loop_breakbeat,:loop_electric],:perc_snap)
  end

  if counter[i] > 18
    pianos(20,:sound1,[:flanger,:whammy,:vowel].tick,[:A2,:C2,:C3,:E4,:G2].choose,[:A4,:C5,:E2,:E3,:G2].choose,:drum_bass_hard)
    pianos(10,:sound2,[:ixi_techno,:vowel].choose,[:A4,:C2,:E2,:E4,:G1].choose,[:A2,:C2,:C3,:E2,:G1,:C2].choose,:guit_e_slide)
  end

  if counter[i] <= 18 and counter[i] >= 8
    pianos(5,:sound3,[:flanger,:vowel].choose,[:A4,:C5,:E2,:E4,:G2].tick,[:A2,:C2,:C3,:E4,:G1,:C2].tick,:elec_blip)
    sounding(:hausing5,:hausing6,[:loop_safari,:loop_mehackit1],:elec_flip)
  end



  #counter
  if i < 25
    i += 1
  end

  if i >= 25
    i = 0
  end

  puts i
  puts counter[i]

  sleep [0.25,0.5].choose

end