# Genuary2023_Plants

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

## Plants

Reworking and Remixing a Genuary2022 prompt entry by

* Adding more branches to the tree structure from the ***p5js*** sketch
    
    * Credits/Code Based from : //https://p5js.org/examples/simulate-recursive-tree.html
        
    * Tweaked parameters to make it more chaotic & indy
        
* Using ***Hydra*** as if the plants are growing in a different realm
    
* Then showing different paths of growth in ***LiveCodingYoutube***
    
* Audio coded in ***SonicPi***  
      
    

WIth the various coding environments in this piece, I decided to name it

**Digitally Fostered Plants**

Digitally Grown  
But now alone  
For it not only seeks to breathe in the ozone  
But also the pixels that it sees in the photos  
For it is organically mentored  
But digitally fostered

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

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

### **Hydra Code**

```javascript
s0.initScreen();
osc()
	.modulateRotate(s0, 0.3)
	.out();
osc([4, 3, 2].fast(0.4), [0.3, 1, 3.502].fast(0.4), 0.3)
	.diff(s0, 3)
	.out(o1);
osc(3, 0.3, 33)
	.modulateKaleid(o3, 4.235)
	.diff(s0)
	.add(o3)
.blend(o1)
	.out(o2);
src(s0, 2.939)
	.mult(s0, 0.406)
	.kaleid([6,4,3,2,3,4,6].smooth())
	.out(o3);
render(o2);

speed = 0.25
```

### LiveCodingYoutube Code

```javascript
create(3,3,"ttRtSUp3dww") 
play(0)
play(all)
speed([1,4,8],-0.5)
speed([2,3,5,6],0.5)
speed([0,7],2)
loopAt(6,3,2) 
loopAt(5,19,4)
loop([1,2],1,4)
jump([0,5,8],10,20)
```

### **P5js Code**

```javascript
//remix of the original recursive tree tutorial
//https://p5js.org/examples/simulate-recursive-tree.html

//Used the base of the other code and added some lines to represent a windy and chaotic type of movement in the tree

let theta;


function setup() {
  createCanvas(windowWidth, windowHeight);
}

function draw() {
  if (second() % 15 > 12)
    {
     background(second%100); 
    }
  else if (second() % 15 < 12 && second() % 15 > 9)
    {
      background(135,206,236)
} else
  {
background(58,36,59)
  }
  
  frameRate(12); // slow it down that it changes
  strokeWeight(4.2)
  stroke(100,200,100);
  // using the mouseX as an interaction, changed to 140
  let a = (mouseX / width) * 140;
  // Convert it to radians
  theta = radians(a);
  // Start the tree from the bottom of the screen
  translate(width/2,height);
  line(0,0,0,-17);
  // must match the above code (-17)
  translate(0,-17);
  // Start the recursive branching! , with branch of 240
  branch(260);
  translate(0,-10);
  branch(100);
  
  push();
  translate(-10,0);
  branch(150);
  branch(300);
  pop();

}

function branch(h) {
  // Each branch will between .66 and .71)
  h *= random(0.45,0.85)


  if (h > 2) {
    push();  
    rotate(random(theta, theta + 0.5));
    if (second() % 6 > 2)
      {
      stroke(100,200,100) //green ish
    line(0, 0, 0, -h);  // Branch
    translate(0, -h);
     }
    
    line(0, 0, 0, -h); 
    translate(0, -h);
    branch(h);       
    pop();   

   
    push();
    rotate(random(theta, theta + 0.5));
     if (second() % 6 > 4)
      {
      stroke(212,175,55) //gold ish
    line(0, 0, 0, -h);  // Draw the branch
    translate(0, -h); // Move to the end of the branch
     }
    line(0, 0, 0, -h);
    translate(0, -h);
    branch(h);
    pop();
  }
}
```

### **SonicPi Code**

Remixed as explained here : [https://blog.illestpreacha.com/sonicpiremix2023-01-08](https://blog.illestpreacha.com/sonicpiremix2023-01-08)

```ruby

live_loop :KP do
  with_fx :rbpf do
    with_fx :flanger, mix: [0.2,0.3,0.4].tick do
      use_synth :piano
      play [:A2,:C2,:C3,:E4,:G5].choose,delay: dice(4), decay: dice(6)
      play [:A4,:C5,:E2,:E4,:G2].choose,sustain: dice(5), attack: dice(7)
      sample :drum_bass_hard, beat_stretch: 0.9, amp: dice(3)
      sleep [0.25,0.5,0.75,1,2,4].choose
    end
  end
end
```
