# Genuary2023_GenerativeMusic

### **The prompt for Genuary 2023 Day 10 is**

## Generative Music

Made a sketch using ***Hydra/LiveCodeLab for Visuals*** and ***SonicPi for Audio***

* For the SonicPi portion, I decided to make each "*Arrangement Function"* act as an Orchestra Member
    
* For the **Hydra/LivecodeLab** Visuals, Added the ***Find Edges*** filter in post-production and slowed down the animation
    

<iframe width="560" height="315" src="https://www.youtube.com/embed/QWSXTO3_JLo"></iframe>

***The growth is seen  
Within the boundaries of the screen  
As shown in the scene  
Where the sounds follow a particular stream  
As the edges blur as it if they were steam  
That is looking to burst as the seams***  

```ruby
#Two chord based functions, one runs on a random assortment, while the other one iterates

def chordsChoose(notes,minMaj,minMaj2,timeChord,dc,st)
  play chord(notes.choose, minMaj,decay: dc, sustain: st)
  play_pattern_timed chord(timeChord, minMaj2), [0.25,0.5].choose
  sleep [1,0.5,0.25,0.5,0.25,1].tick
end

def chordsTick(notes,minMaj,minMaj2,timeChord,dc,ak)
  play chord(notes.choose, minMaj,decay: dc, attack: ak)
  play_pattern_timed chord(timeChord, minMaj2), [0.25,0.5].tick
  sleep [1,0.75,0.5, 0.25].choose
end

#function for the arrangement

def arrangement(sound,bpm,preeffect,intensity,intensity2,loop,effect,effect2,effect3,effect4)
  
  use_synth sound
  use_bpm bpm
  
  with_fx preeffect,mix: intensity do
    live_loop loop do
      
      with_fx effect, mix: intensity2 do
        chordsChoose([:c4,:f4],:minor,:major,[:c5,:c5].tick,0,dice(3))
        chordsTick([:d3,:f3],:major,:major,[:f4,:d4].choose,2,1)
      end
      
      with_fx effect2, mix: 0.2 do
        chordsTick([:g3,:a3,:c3],:major,:major,[:g4,:f4].choose,3,dice(3))
        chordsTick([:e4,:a4,:c4],:major,:major,[:g4,:f4].choose,1,2)
      end
      
      with_fx effect3 do
        chordsChoose([:a3,:g3],:minor,:major,[:a4,:a4].tick,0,dice(3))
        chordsTick([:b2,:d2,:f4],:major,:major,[:g4,:f4,:d4].tick,1,dice(2))
      end
      
      with_fx effect4, mix: 0.1 do
        chordsTick([:f3,:b3],:major,:major,[:f4,:d4].choose,0,2)
        chordsTick([:g3,:a3,:c3],:major,:major,[:g4,:f4].choose,3,1)
        chordsTick([:d3,:b3],:major,:major,[:f4,:d4].choose,2,3)
      end
      
    end
  end
end

#treating every arrangement function as if it was a member of an ochestra



arrangement(:piano,60,:hpf,0.2,0.4,:arrangement1,:ixi_techno,:ping_pong,:ixi_techno,:ixi_techno)
arrangement([:fm,:prophet,:pretty_bell].choose,30,:lpf,0.3,0.5,:arrangement2,:ixi_techno,:gverb,:ixi_techno,:krush)
arrangement(:piano,30,:hpf,rrand(0.2,0.3),0.4,:arrangement3,:ixi_techno,:pitch_shift,:ixi_techno,:krush)
arrangement(:piano,15,:ping_pong,rrand(0.1,0.3),0.5,:arrangement4,:ixi_techno,:vowel,:ixi_techno,:ixi_techno)
arrangement([:fm,:prophet,:pretty_bell].choose,15,:ping_pong,rrand(0.1,0.3),0.5,:arrangement5,:ixi_techno,:pitch_shift,:ixi_techno,:ixi_techno)
arrangement(:chipbass,30,:vowel,rrand(0.1,0.3),0.5,:arrangement6,:ixi_techno,:pitch_shift,:ixi_techno,:ixi_techno)
arrangement(:dark_ambience,45,:whammy,rrand(0.2,0.7),0.4,:arrangement7,:ixi_techno,:ping_pong,:ixi_techno,:ixi_techno)
arrangement(:chipbass,15,:vowel,rrand(0.3,0.5),0.5,:arrangement8,:ixi_techno,:pitch_shift,:ixi_techno,:ixi_techno)

```
