# Genuary2023_Remix

### **The prompt for Genuary2023 Day 31 is**

## "Remix a Piece or Break a piece"

For Today's prompt, the piece is named ***GriddingMishap***

* I decided for the remixing a piece, I will be remixing the code from the **Hydra** code from [Textile Mishaps](https://blog.illestpreacha.com/genuary2023textile) and **P5JS** code from [GridExpressWay](https://blog.illestpreacha.com/genuary2023gridding) By adding some **LivecodeLab** code
    
* For the Audio, I will be remixing the **SonicPi** Code from [OverSketching](https://blog.illestpreacha.com/genuary2023Maximalism)
    

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

### Poem

***For this is the end  
During the month, energy has been spent  
Codes have been bent  
But codes have also had time to blend  
To merge, emerge and remerge***

### **LIveCodeLab Code**

```javascript
ballDetail 4
animationStyle motionBlur
rotate time / 7, sin(time % 12), cos(sin(wave(0.003)))
simpleGradient black, white,grey
ambientLight 100 + sin(time % 50) * 4,200 + time % 50 ,abs(150 - ((time % 30) * 6))
fill white
noStroke

scale 0.5 + sin(wave(0.04))

time % 33 + 1 times
	rotate wave(0.003), 1, time / 5
	move 0.2, 0, sin(time % 19)
	25 times
		rotate 1
		ball -1
		box 2,4

```

### **P5Js Code**

```javascript
function setup() {
	createCanvas(displayWidth, displayHeight);
}

function draw() {
  frameRate(15)
	background('black');
  if (second() % 10 > 5)
    {
    grid(80,10,color('red'));
    grid(40,40,color('blue'));
    }
   if (second()% 12 < 7)
     {
      grid(80,10,color('purple'));
      grid(40,40,color('orange'));  
     }
  
  grid(40,20,color('yellow'));

}

function grid(spacing,spacing2,colorStroke)
{
  	for (var x = 0; x < width; x += width / spacing) {
		for (var y = 0; y < height; y += height / spacing2) {
			stroke(colorStroke);
			strokeWeight(random(1,5));
			line(x + second() % 3, 0, x, height - 45 * (second() % 20));
			line(0, y - sin(second() % 15), width - 45 * (second() % 20), y);
		}
	}
}
```

### **Hydra Code**

```javascript
 
s0.initScreen() //s0 is p5js
s1.initScreen() //s1 is Livecodelab
s2.initScreen() //s2 is hydra

src(s0).repeat(()=> (time % 25 + 1)/5).blend(src(s1).scale(2)).layer(o1).modulateScale(o2).out(o0)
src(s1).pixelate(10000,1000).out(o2)
src(s2).scale(0.33).scroll(()=> Math.sin(time % 25)/10).out(o1)
```

### SonicPi Code

```ruby
#Audio is 34% slowed down

#Color +Shadows
#RGB Values
#shadow length equation is Length = height / tan(angle)



#Due to High Pitches, will divide the numbers by 3

def color(hue,loop,synth,effect)
  with_fx effect do
    live_loop loop do
      i = 0 #counter to iterate between the 3 values
      use_synth synth
      play hue[i]/3 ,release: 2
      sleep [0.5,1,2].choose
      if i < 4
        i+= 1
      end
    end
  end
end

#shadow length component
#adding a decay to the shadow portion

def shadowColor(hue,loop,synth,effect)
  with_fx effect do
    live_loop loop do
      i = 0 #counter to iterate between the 3 values
      use_synth synth
      play (hue[i]/Math.tan(70)) / 3 #,attack: dice(2)
      play ((hue[i]/Math.tan(40)).abs)/3 #,#decay: dice(2)
      sleep [0.25,0.5,1,2].choose
      if i < 4
        i+= 1
      end
    end
  end
end

#taking in the hue,loop name and attached synth, effect
def colorpalette1
  
  
  
  #colorpalette1
  stromboli =  [44 + dice(20),70,66]
  hampton = [230,209,169]
  teak = [180,150,109]
  
  
  color(stromboli, :stromboli,:chipbass,:ixi_techno)
  shadowColor(stromboli,:strombolishadow,:chipbass,:whammy)
  
  color(hampton,:hampton,:chipbass,:whammy)
  shadowColor(hampton,:hamptonshadow,:chipbass,:flanger)
  
  color(teak,:teak,:chipbass,:flanger)
  shadowColor(teak,:teakshadow,:chipbass,:ixi_techno)
end

def colorpalette2
  
  #colorpalette2
  summerGreen = [144,180,172]
  muleFawn = [143,63,43]
  sorrellBrown = [197,168,131 - dice(20)]
  
  color(summerGreen,:summerGreen,:piano,:vowel)
  shadowColor(summerGreen,:summerGreenshadow,:piano,:flanger)
  
  color(muleFawn,:muleFawn,:piano,:pingpong)
  shadowColor(muleFawn,:muleFawnshadow,:piano,:pingpong)
  
  color(sorrellBrown,:sorrellBrown,:piano,:pingpong)
  shadowColor(sorrellBrown,:sorrellBrownshadow,:piano,:pingpong)
end

def colorpalette3
  
  
  #colorpalette3
  ecruWhite = [243,242,226]
  paleOyster = [149,144,129]
  capePalliser = [147,113,73]
  
  
  color(ecruWhite,:ecruWhite,:hollow,:vowel)
  shadowColor(ecruWhite,:ecruWhiteshadow,:hollow,:flanger)
  
  color(paleOyster ,:paleOyster,:hollow,:pingpong)
  shadowColor(paleOyster ,:paleOystershadow,:hollow,:pingpong)
  
  color(capePalliser,:capePalliser,:piano,:pingpong)
  shadowColor(capePalliser,:capePallisershadow,:hollow,:pingpong)
end

live_loop :coloring do
  
  counter = (0..25).to_a.shuffle()
  
  if counter[dice(25)] % 3 == 0 #if the number is divisible by 3
    colorpalette1()
  elsif counter[dice(25)] % 2 == 0   #if the number is divisible by 2
    colorpalette2()
  else
    colorpalette3()
  end
  
  
  sleep [1,2,4,8].choose
end


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
      
      counter = (0..25).to_a.shuffle()
      
      if counter[dice(25)] % 3 == 0
        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
      elsif counter[dice(25)] % 2 == 0   #if the number is divisible by 2
        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
      else
        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
      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

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(:dark_ambience,45,: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,60,:vowel,rrand(0.3,0.5),0.5,:arrangement8,:ixi_techno,:pitch_shift,:ixi_techno,:ixi_techno)




```
