p5.js/Hydra code:

let p5 = new P5()
s0.init({src: p5.canvas})
p5.hide();

let particles = [];
let numParticles = 50;
let mode = 2;

for (let i = 0; i < numParticles; i++) {
  particles.push({
    x: p5.random(p5.width),
    y: p5.random(p5.height),
    size: p5.random(5, 20),
    speedX: p5.random(-2, 2),
    speedY: p5.random(-2, 2),
    color: p5.color(p5.random(255), p5.random(255), p5.random(255))
  });
}

p5.draw = () => {
  p5.background(0); 

  if (ccActual[0] < 20) {
    mode = 0; // Particles mode
  } else if (ccActual[0] < 40) {
    mode = 1; // Spiral mode
  } else if (ccActual[0] < 60) {
    mode = 2; // Grid mode
  } else if (ccActual[0] < 80) {
    mode = 3; // Starburst mode
  } else if (ccActual[0] < 110) {
    mode = 4; // Waveform mode
  } else {
    mode = 5; // Fractal mode
  }

  // Draw based on current mode
  switch(mode) {
    case 0: // Particles
      drawParticles();
      break;
    case 1: // Spiral
      drawSpiral();
      break;
    case 2: // Grid
      drawGrid();
      break;
    case 3: // Starburst
      drawStarburst();
      break;
    case 4: // Waveform
      drawWaveform();
      break;
    case 5: // Fractal
      drawFractal();
      break;
  }
}

function drawParticles() {
  p5.noStroke();
  for (let i = 0; i < particles.length; i++) {
    let p = particles[i];
    p5.fill(p.color);
    p5.ellipse(p.x, p.y, p.size, p.size);

    p.x += p.speedX;
    p.y += p.speedY;

    if (p.x < 0 || p.x > p5.width) p.speedX *= -1;
    if (p.y < 0 || p.y > p5.height) p.speedY *= -1;
  }
}

function drawSpiral() {
  p5.stroke(255, 0, 100);
  p5.strokeWeight(3);
  p5.noFill();
  p5.translate(p5.width/2, p5.height/2);

  for (let i = 0; i < 200; i++) {
    let r = i * 0.5;
    let angle = i * 0.1 + time * 0.2;
    let x = r * p5.cos(angle);
    let y = r * p5.sin(angle);
    p5.point(x, y);
    if (i > 0) {
      let prevX = (i-1) * 0.5 * p5.cos((i-1) * 0.1 + time * 0.2);
      let prevY = (i-1) * 0.5 * p5.sin((i-1) * 0.1 + time * 0.2);
      p5.line(prevX, prevY, x, y);
    }
  }
}

function drawGrid() {
  p5.stroke(0, 255, 255);
  p5.strokeWeight(2);
  let cellSize = 50;

  for (let x = 0; x < p5.width; x += cellSize) {
    for (let y = 0; y < p5.height; y += cellSize) {
      let distFromCenter = p5.dist(x, y, p5.width/2, p5.height/2);
      let size = p5.map(p5.sin(distFromCenter * 0.01 + time), -1, 1, 10, cellSize-5);
      p5.rect(x, y, size, size);
    }
  }
}

function drawStarburst() {
  p5.stroke(255, 255, 0);
  p5.strokeWeight(2);
  p5.translate(p5.width/2, p5.height/2);

  for (let i = 0; i < 36; i++) {
    let angle = i * p5.TWO_PI / 36;
    let x1 = 100 * p5.cos(angle);
    let y1 = 100 * p5.sin(angle);
    let x2 = 300 * p5.cos(angle + time * 0.5);
    let y2 = 300 * p5.sin(angle + time * 0.5);
    p5.line(x1, y1, x2, y2);
  }
}

function drawWaveform() {
  p5.stroke(0, 255, 0);
  p5.strokeWeight(3);
  p5.noFill();
  p5.beginShape();

  for (let x = 0; x < p5.width; x += 10) {
    let y = p5.height/2 + p5.sin(x * 0.02 + time) * 100 +
            p5.cos(x * 0.01 - time * 0.5) * 50;
    p5.vertex(x, y);
  }

  p5.endShape();
}

function drawFractal() {
  p5.stroke(255);
  p5.noFill();
  p5.translate(p5.width/2, p5.height/2);
  drawBranch(100, 0, 8);
}

function drawBranch(len, angle, depth) {
  if (depth <= 0) return;

  p5.strokeWeight(depth);
  p5.stroke(255 - depth * 30, depth * 30, 150);

  p5.push();
  p5.rotate(angle);
  p5.line(0, 0, 0, -len);
  p5.translate(0, -len);

  let t = time * 0.5;
  drawBranch(len * 0.7, angle + p5.sin(t) * 0.5, depth - 1);
  drawBranch(len * 0.7, angle - p5.cos(t) * 0.5, depth - 1);
  p5.pop();
}
src(s0).modulate(noise(5,0.1),0.1).blend(osc(15,0.2,()=>ccActual[0]/127).hue(()=>ccActual[0]/20),0.3).out()

TidalCycles code:


d1 $ ccv (slow 4 "0 25 50 75 100 127")
  # ccn "0"
  # s "midi"

d2 $ stack [
  n (arp "<up down diverge>" (slow 4 $ "a'min7 c'maj7 e'min7 g'maj7"))
    # s "arpy"
    # gain (slow 4 $ range 0.5 0.9 $ "0 25 50 75 100 127" / 127)
    # room 0.3 # size 0.5,
  n (slow 4 $ "a2 c3 e3 g3 c4 e4")
    # s "jvbass"
    # lpf (slow 4 $ range 300 2000 $ "0 25 50 75 100 127")
    # gain 0.8,
    
  every 3 (fast 2) $ n (slow 2 $ scramble 8 $ run 8)
    # s "east"
    # gain 0.7
    # pan (slow 8 $ sine)
]

d3 $ slow 8 $ s "padlong"
    # gain 0.6
    # lpf (slow 4 $ range 500 5000 $ "0 25 50 75 100 127")
    # hpf 300

d4 $ every 4 (jux rev) $ whenmod 8 6 (fast 2) $
    n (slow 2 $ "0 [~ 1] 2 [3 4]")
    # s "feel"
    # gain 0.75
    # room 0.2
    # orbit 1

d5 $ every 2 (# gain 1.5) $
    s "glitch:5*8"
    # gain (slow 2 $ range 0 0.8 $ "0 25 50 75 100 127" / 127)
    # speed (range 0.5 1.5 $ slow 16 sine)
    # pan (slow 3 $ rand)
    # cut 1

d2 silence 
d3 silence
d5 silence
hush

Link to demo video (apologies for the keystrokes, my supercollider/pulsar has been very laggy and buggy and I was not able to record from supercollider so I had to rely on Quicktime recording)

Thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>