# Genuary2023_Gridding

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

## GridInAGridInaGrid

* For this prompt used a mixture of **SonicPi,P5Js & Hydra** to make a GridExpressWay
    
* Used P5js for the Grid and Hydra to add more modulation & pixelation
    
* SonicPi as always as the background music for this journey of Grids
    

***The lines start to intersect  
Parallel and Perpendicular  
Some may be hidden  
Only to be seen with Binoculars  
But still, maintain their rhythm  
as they engage in their intersects***

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

### P5js Code-[**https://editor.p5js.org/illestknock/full/DIJSGMtq-**](https://editor.p5js.org/illestknock/full/DIJSGMtq-)

```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();

src(s0).scale(()=> (time % 20 + 1)/6).pixelate([500,2500,1250],[250,30,100]).out(o0)
src(s0).scale(()=> (time % 20 + 1)/8).luma([0.5,0.4,0.3].smooth()).pixelate([50,250,250],[250,30,75,100]).out(o1)
src(s0).scale(()=> (time % 20 + 1)/10).pixelate([500,2500,1250],[250,30,100,50,1000]).out(o2)
src(s0).scale(()=> (time % 20 + 1)/12).kaleid([3,4,4,3].fast(0.4)).pixelate([500,2500,1250],[250,30,100]).out(o3)

render()

speed = 0.125
```

### **SonicPi Code**

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


pianos(60,:sound1,[:flanger,:whammy,:vowel].tick,[:A2,:C2,:C3,:E4,:G5].choose,[:A4,:C5,:E2,:E4,:G2].choose,:drum_bass_hard)
pianos(30,:sound2,[:ixi_techno,:vowel].choose,[:A4,:C5,:E2,:E4,:G2].choose,[:A2,:C2,:C3,:E4,:G5,:C2].choose,:drum_bass_soft)
pianos(60,:sound3,[:gverb,:ixi_techno,:wobble].choose,[:A2,:C2,:C3,:E4,:G5,:C2,:E4].choose,[:A4,:C5,:E2,:E4,:G2].choose,:tabla_ghe2)
pianos(30,:sound4,[:flanger,:vowel,:ping_pong].choose,[:A4,:C5,:E2,:E4,:G2].choose,[:A2,:C2,:C3,:E4,:G5].choose,:tabla_ghe1)

```
