by the live coding cats- >_<
Elora Trotter, Yihan Zhang, Yutong Tang
Hydra Code
We tried to keep the process minimalistic int he whole process of making
//visual script
//!!!visual array
visuals = [
//first visual-> purple sphere
()=>{setFunction({
name: 'sphereShaderglow',
type: 'src',
inputs: [
{ type: 'float', name: 'locX', default: 0.5 },
{ type: 'float', name: 'locY', default: 0.5 },
{ type: 'float', name: 'diameter', default: 0.3 },
{ type: 'float', name: 'r', default: 0.5 },
{ type: 'float', name: 'g', default: 0.4 },
{ type: 'float', name: 'b', default: 0.7 },
{ type: 'float', name: 'm1', default: 0.2 },
{ type: 'float', name: 'm2', default: 0.5 },
{ type: 'float', name: 'm3', default: 0.8 },
],
glsl: `
vec2 uv = _st * resolution;
vec2 center = vec2(locX * resolution.x, locY * resolution.y);
float dist = distance(uv, center);
float radius = (diameter * resolution.x) / 2.0;
vec3 moonColor = vec3(r, g, b);
// --- Glow halo (additive, outside AND inside the sphere) ---
float glowRadius = radius * 1.8; // how far the glow reaches
float glowStrength = 0.9; // peak brightness of halo
float glowFalloff = 3.5; // higher = tighter glow
float glowDist = max(dist - radius, 0.0); // distance beyond sphere edge
float glow = glowStrength * exp(-glowFalloff * glowDist / radius);
vec3 glowColor = moonColor * glow; // glow tinted to moon color
// Outside the sphere: just the glow halo
if (dist > radius) {
return vec4(glowColor, 1.0);
}
// --- Sphere surface shading ---
float normX = (uv.x - center.x) / radius;
float normY = (uv.y - center.y) / radius;
float z = sqrt(max(0.0, 1.0 - normX*normX - normY*normY));
vec3 normal = normalize(vec3(normX, normY, z));
vec3 lightDir = normalize(vec3(m1, m2, m3));
float light = max(dot(normal, lightDir), 0.0);
// Additive rim glow on the lit edge of the sphere
float rimGlow = pow(1.0 - z, 3.0) * light * 0.6;
vec3 color = moonColor * light;
color += moonColor * rimGlow; // add rim highlight
color += glowColor * 0.3; // bleed inner glow into surface
return vec4(color, 1.0);
`
})
// Orbiting moon version
let rotSpeed = 0.5
sphereShaderglow(
0.5,
() => (Math.sin(time * rotSpeed) / 10+0.5),
0.3,
0.5, 0.4, 0.9, // r, g, b — cool blue-white moon color
() => Math.sin(time * rotSpeed),
-0.3,
() => Math.cos(time * rotSpeed),
).out(o3)
//visual 1-> one singular ball
osc(24,0.1,0.5).modulateRotate(noise(2),()=>cc[0]).mask(o3).color(5,4,1).hue(0.5).blend(src(o0),0.9).out(o0)},
//------------------------------------
//visual 2-> spheres with bigger ossilation
()=> {osc(24,0.1,0.5).modulateRotate(noise(2),()=>(cc[0]*5)).mask(o3).color(5,4,1).hue(0.5).blend(src(o0),0.9).out(o0)},
//-----------------------------------------
//visials 3 bigger ossilation sphere with color change
()=> {osc(24,0.1,0.5).modulateRotate(noise(2),()=>(cc[0]*5)).mask(o3).color(2,4,1).hue(()=>cc[1]*2).blend(src(o0),0.9).out(o0)},
//-------------------------------------------
//visuals 4 change ball size
()=>{let rotSpeed = 0.5
sphereShaderglow(
0.5,
() => (Math.sin(time * rotSpeed) / 10+0.5),
()=> cc[3],
0.5, 0.4, 0.9, // r, g, b — cool blue-white moon color
() => Math.sin(time * rotSpeed),
-0.3,
() => Math.cos(time * rotSpeed),
).out(o3)
osc(24,0.1,0.5).modulateRotate(noise(2),()=>(cc[0])).mask(o3).color(2,4,1).hue(()=>cc[1]*2).blend(src(o0),0.9).out(o0)},
//--------------------------------------------------
//visuals 5 add another layer of effects scrollX
()=>{osc(24,0.1,0.5).modulateRotate(noise(2),()=>(cc[0])).mask(o3).color(2,4,1).hue(0.35).blend(src(o0).modulateScrollX(o0),0.9).out(o0)},
//-----------------------------------------------------
//visuals6-> multiple spheres in blender
()=> {osc(24,0.1,0.5).modulateRotate(noise(3),()=>(cc[0])).mask(o3).color(4,2.5,1.5).hue(()=>cc[2]).blend(src(o0),0.5).repeat(2,2).layer(src(o1)).out(o0)},
//------------------------------------------------
//visuals7->falling Stars wihtout planets
()=> { osc(24, 5, .7)
.mask(shape(100, 0.02, 0.01).scale(1, () => window.innerHeight / window.innerWidth))
.repeat(100, 100)
.modulate(noise(1, 0.5), 0.5).colorama(0.25)
.rotate(() => cc[0] * Math.PI, 0.03)
.out(o1)
// osc(24,0.1,.7).mask(shape(10,0.01,0.02).scale(1,()=>window.innerHeight/window.innerWidth)).
// repeat(100,100).modulate(noise(1,0.5,3),0.5).out(o1)
src(o0)
.modulate(voronoi(100,0.1,1.5).modulate(noise(5),1).brightness(0.03)
,0.003).layer(src(o1)).luma(0.2).colorama(0.5).out(o0)},
//---------------------------------------------------
//visuals 8->falling stars with a spheres
()=> {
setFunction({
name: 'sphereShader',
type: 'src',
inputs: [
{
type: 'float',
name: 'locX',
default: 0.5,
},
{
type: 'float',
name: 'locY',
default: 0.5,
},
{
type: 'float',
name: 'diameter',
default: 0.3, // in normalized space, 0.3 = 30% of screen
},
{
type: 'float',
name: 'r',
default: 0.5,
},
{
type: 'float',
name: 'g',
default: 0.4,
},
{
type: 'float',
name: 'b',
default: 0.7,
},
{
type: 'float',
name: 'm1',
default: 0.2, //1st parameter of the 3D vector the direction that the sphere faces
},
{
type: 'float',
name: 'm2',
default: 0.5, //2nd parameter of the 3D vector the direction that the sphere faces
},
{
type: 'float',
name: 'm3',
default: 0.8, //3rd parameter of the 3D vector the direction that the sphere faces
}
],
glsl: `
// current pixel in screen space
vec2 uv = _st * resolution;
// mouse in screen space
vec2 center = vec2(locX * resolution.x, locY * resolution.y);
// distance from center
float dist = distance(uv, center);
// convert diameter to screen space radius
float radius = (diameter * resolution.x) / 2.0;
// outside the circle = black
if (dist > radius) {
return vec4(0.0, 0.0, 0.0, 1.0);
}
// sphere surface math
float normX = (uv.x - center.x) / radius; // -1 to 1
float normY = (uv.y - center.y) / radius; // -1 to 1
float z = sqrt(1.0 - normX*normX - normY*normY); // depth
// surface normal
vec3 normal = normalize(vec3(normX, normY, z));
// light direction
vec3 lightDir = normalize(vec3(m1, m2, m3));
// how much does surface face the light
float light = max(dot(normal, lightDir), 0.0);
// color
vec3 color = vec3(r, g, b);
return vec4(color * light, 1.0);
`
})
let rotSpeed = 0.5 // how fast it rotates
// m1 and m3 trace a circle over time = light orbits the sphere!
sphereShader(
0.5,
//() => (Math.sin(time * rotSpeed)/15+0.5),
0.5,
0.4,
0.5,
0.4,
0.9,
//0.2,
() => Math.sin(time * rotSpeed)*2, // m1 — light X orbits
//() => Math.sin(time * rotSpeed)*0.5,// m2 — light Y stays fixed
0.8,
() => Math.cos(time * rotSpeed)*2, // m3 — light Z orbits
).out(o3)
osc(24, 5, .7)
.mask(shape(100, 0.02, 0.01).scale(1, () => window.innerHeight / window.innerWidth))
.repeat(100, 100)
.modulate(noise(1, 0.5), 0.5).colorama(0.25)
.rotate(() => cc[0] * Math.PI, 0.03)
.out(o1)
// osc(24,0.1,.7).mask(shape(10,0.01,0.02).scale(1,()=>window.innerHeight/window.innerWidth)).
// repeat(100,100).modulate(noise(1,0.5,3),0.5).out(o0)
src(o0)
.modulate(voronoi(100,0.1,1.5).modulate(noise(5),1).brightness(0.03)
,0.003).layer(src(o1)).luma(0.2).colorama(0.5).out(o2)
src(o3).layer(o2).luma(0.02).brightness(0.02).hue(0.8).out(o0)},
//-----------------------------------------------
//visual 9 falling start in moon
()=> {
let rotSpeed = 0.5 // how fast it rotates
// m1 and m3 trace a circle over time = light orbits the sphere!
sphereShader(
() => (Math.sin(time * rotSpeed)/15+0.5),
() => (Math.sin(time * rotSpeed)/15+0.5),
0.35, //diameter
0.4, //r
0.5, //g
0.4,//b
0.9,
//0.2,
() => Math.sin(time * rotSpeed)*2, // m1 — light X orbits
() => Math.sin(time * rotSpeed)*0.5,// m2 — light Y stays fixed
//0.8,
() => Math.cos(time * rotSpeed)*2, // m3 — light Z orbits
).out(o3)
osc(24, 5, .7)
.mask(shape(100, 0.02, 0.01).scale(1, () => window.innerHeight / window.innerWidth))
.repeat(100, 100)
.modulate(noise(1, 0.5), 0.5).colorama(0.25)
.rotate(() => cc[0] * Math.PI, 0.03)
.out(o1)
// osc(24,0.1,.7).mask(shape(10,0.01,0.02).scale(1,()=>window.innerHeight/window.innerWidth)).
// repeat(100,100).modulate(noise(1,0.5,3),0.5).out(o0)
src(o0)
.modulate(voronoi(100,0.1,1.5).modulate(noise(5),1).brightness(0.03)
,0.003).layer(src(o1)).luma(0.2).colorama(0.5).out(o2)
src(o3).layer(o2).luma(0.02).brightness(0.02).hue(0.8).out(o0)},
//-------------------------------------
//visual 10 pulsing purple sphere with fixed color
()=>{
// Orbiting moon version
let rotSpeed = 0.5
sphereShaderglow(
0.5,
() => (Math.sin(time * rotSpeed) / 10+0.5),
0.5,
0.5, 0.4, 0.9, // r, g, b — cool blue-white moon color
() => Math.sin(time * rotSpeed),
-0.3,
() => Math.cos(time * rotSpeed),
).out(o3)
// //1 one singular ball
osc(24,0.1,0.5).modulateRotate(noise(2),()=>cc[0]).mask(o3).color(5,4,1).hue(0.5).blend(src(o0),0.9).out(o0)},
//-----------------------------------------------------
//visual 11 multiple sphers in blender with a filter
()=> {osc(24,0.1,0.5).modulateRotate(noise(3),()=>(cc[0])).mask(o3).color(4,2.5,1.5).hue(()=>cc[2]).blend(src(o0),0.9).repeat(6,6).layer(src(o1)).out(o0)},
//visua//visuals6-> multi
]
whichVisual = 0
visuals[8]()
visuals[whichVisual]()
// can use update and switch case with midi:
update = () =>{
if (ccActual[5]==24){
visuals[8]()
}
// very important! only change source once, when necessary
if (whichVisual != ccActual[1]){
whichVisual = ccActual[1];
visuals[whichVisual]()
},
}
hush()
Tidal Code
- -- Final --
--melody1--floating ball--
do
d1 $ qtrigger $ slow 4
$ note "[e5 ~ g5 b4] [c5 ~ e5 g4] [a4 c5 ~ e5] [b4 ~ g4 e4]"
# s "supervibe"
# lpf (range 160 480 (slow 4 sine))
# detune 0.16
# room 0.6 --small oscillations--
# sz 0.95
# gain 1.1
# sustain 0.32
d12 $ qtrigger $ slow 4 $ struct "[t ~ t t] [t ~ t t] [t t ~ t] [t ~ t t]" $ ccv ((segment 128 (range 127 0 saw))) # ccn "0" # s "midi"
d13 $ ccv "0" # ccn 1 # s "midi"
-- add bass-- add bigger oscillations here--
do
d2 $ qtrigger $ slow 4
$ note "[c2 ~ c2 g1] [a1 ~ a1 e1] [f1 ~ g1 a1] [e1 ~ g1 b1]"
# s "supervibe"
# lpf 180
# detune 0.08
# room 0.25
# sz 0.7
# gain 1.2
# sustain 0.85
d12 $ qtrigger $ slow 4 $ struct "[t ~ t t] [t ~ t t] [t t ~ t] [t ~ t t]" $ ccv ((segment 128 (range 127 0 saw))) # ccn "0" # s "midi"
d13 $ ccv "1" # ccn 1 # s "midi"
--add percussion--change color--
do
d3 $ slow 2 $ stack [
s "808:1 ~ 808:1 ~" # gain 0.9 # speed 0.65,
s "808:1(3,8)" # gain 0.7 # speed 0.9 # nudge 0.02,
s "808:1(5,16)" # gain 0.7 # speed 0.8 # pan (slow 4 sine),
s "~ 808:1 ~ 808:1" # gain 1.1 # speed 0.45 # room 0.3 ]
d14 $ qtrigger $ slow 4 $ struct "t(3,8)" $ ccv ((segment 128 (range 127 0 saw))) # ccn "1" # s "midi" --for color ccn 1
d13 $ ccv "2" # ccn 1 # s "midi" --for # of visuals
--add beat 1--change ball size-- tone down oscillator--
do
d4 $ s "909 909 909 <909, 808:1>" # gain 1 # size 0.4
d13 $ ccv "3" # ccn 1 # s "midi" --for # of visuals
d15 $ struct "t t t <t, t>" $ ccv ((segment 128 (range 30 20 rand))) # ccn "3" # s "midi" --pulsing
--only beat 2--- combine with another texture, remove color -- let's stay with this color thenn
do
d3 silence
d2 silence
d5 $ s "808:3*4" # gain 0.7 # krush 2
d13 $ ccv "4" # ccn 1 # s "midi" --for # of visuals
--add the percussion back in--
d3 $ stack [
s "808:1 ~ 808:1 ~" # gain 1.8 # speed 0.65,
s "808:1(3,8)" # gain 1 # speed 0.9 # nudge 0.02,
s "808:1(5,16)" # gain 1.6 # speed 1.3
# pan (slow 4 sine),
s "~ 808:1 ~ 808:1" # gain 0.8 # speed 0.45 # room 0.3 ]
--add bass back --
do
d2 $ qtrigger $ slow 4
$ note "[c2 ~ c2 g1] [a1 ~ a1 e1] [f1 ~ g1 a1] [e1 ~ g1 b1]"
# s "supervibe"
# lpf 180
# detune 0.08
# room 0.25
# sz 0.7
# gain 1.3
# sustain 0.85
--add stars-- pixelated moon--
do
d5 $ qtrigger $ slow 2
$ note "[~ g6 ~ b6] [c7 ~ b6 g6] [~ a6 c7 ~] [c6 ~ e7 ~]"
# s "supersaw"
# lpf (range 900 2000 (slow 8 sine))
# hpf 900
# detune 0.32
# room 0.75
# sz 0.98
# gain 0.6
# sustain 0.25
--d14 $ ccv "24" # ccn 5 # s "midi" --the if value to trigger one time effect
d13 $ ccv "7" # ccn 1 # s "midi" --star rotationnn
-- everything drops except for stars-- watch pixelated moon-- heree?
do
d1 silence
d2 silence
d3 silence
d4 silence
-- bass2 comes in--keep rotating planet--
d6 $ qtrigger $ slow 4
$ note "c3 ~ ~ ~ a2 ~ ~ ~ f2 ~ ~ ~ g2 ~ ~ ~"
# s "supersaw"
# lpf (range 90 260 (slow 8 sine))
# detune 0.06
# room 0.4
# sz 0.8
# gain (range 1 1.6 saw )
# sustain 2.1
--melody comes back in--keep rotating planet--
d1 $ qtrigger $ slow 4
$ note "[e5 ~ g5 b4] [c5 ~ e5 g4] [a4 c5 ~ e5] [b4 ~ g4 e4]"
# s "supervibe"
# lpf (range 160 480 (slow 4 sine))
# detune 0.16
# room 0.6
# sz 0.95
# gain 1.4
# sustain 0.32
--beat drops in -- return to normal pulsing ball--
do
d4 $ s "909 909 909 909" # gain 1.1 # size 0.4
d13 $ ccv "3" # ccn 1 # s "midi" --for # of visuals
d15 $ struct "t t t t" $ ccv ((segment 128 (range 30 20 rand))) # ccn "3" # s "midi"
--highhats-- normal pulsing ball
do
d7 $ s "hh*8" # gain 1.4
d13 $ ccv "5" # ccn 1 # s "midi" --for # of visuals
--add kids sample--keep same--
do
d8 $ jux rev $ slow 16
$ striateBy 128 (1/6)
$ s "kids"
# room 0.95
# size 0.98
# lpf 1800
# hpf 500
# gain 0.8
--stars2--shudder ball! --
do
d9 $ qtrigger $ slow 2
$ note "[e6 ~ g6 ~] [~ b6 d7 ~] [c7 ~ a6 e6] [~ g6 b6 ~]"
# s "supersaw"
# lpf (range 2000 5200 (slow 8 sine))
# hpf 1200
# detune 0.42
# room 0.9
# sz 0.98
# gain (range 0.4 1 (slow 16 sine))
# sustain 0.22
d13 $ ccv "4" # ccn 1 # s "midi"
--drop away to create tension-- pulsing purple spheres!!!
do
d9 silence
d8 silence
d6 silence
d1 silence
d13 $ ccv "9" # ccn 1 # s "midi"
d15 $ struct "t*8" $ ccv ((segment 128 (range 45 20 rand))) # ccn "3" # s "midi" --pulsing
--for # of visuals
-- buildup2-- pulsing purple spheres--
do
d7 $ slow 2
$ note "[~ e6 g6 b6] [c7 e7 d7 b6] [a6 c7 e7 g7] [e7 d7 c7 b6]"
# s "supersaw"
# lpf (range 1400 6200 (slow 8 sine))
# hpf 700
# detune 0.34
# room 0.78
# sz 0.95
# gain 0.8
# sustain 0.28
d8 $ slow 2
$ note "[c5 e5 g5 c6] [e5 g5 b5 e6] [a5 c6 e6 a6] [g5 b5 d6 g6]"
# s "supersaw"
# lpf (range 900 4800 (slow 8 sine))
# hpf 300
# detune 0.22
# room 0.7
# sz 0.9
# gain 0.65
# sustain 0.55
d9 $ slow 4
$ note "[c6 ~ e6 g6] [b6 c7 e7 ~] [a6 c7 e7 g7] [~ e7 d7 c7]"
# s "supervibe"
# lpf (range 1800 7600 (slow 6 sine))
# hpf 1200
# detune 0.18
# room 0.9
# sz 0.98
# pan (slow 4 sine)
# gain (range 0.35 0.85 (slow 8 sine))
# sustain 0.22
d13 $ ccv "5" # ccn 1 # s "midi" --for # of visuals
-- add kid sample2--
d10 $ slow 4 $ s "kids:1 ~ ~ ~ ~" # gain 1.4
# room 1 # size 0.98 # lpf 1800 # sustain 0.5
# legato 2
--add drum beat--faster pulsing purple spheres--
do
d4 $ s "909*8" # gain 1.1 # size 0.4 # krush 2 # room 0.2
d13 $ ccv "10" # ccn 1 # s "midi" --for # of visuals
--resolution--stars falling like snow
do
d10 silence
d4 silence
d7 $ slow 4
$ note "[c6 ~ e6 ~] [g5 ~ e6 c6] [a5 ~ c6 ~] [g5 ~ e5 c5]"
# s "supervibe"
# lpf (range 260 900 (slow 12 sine))
# hpf 120
# detune 0.12
# room 0.9
# sz 0.98
# gain (range 0.95 0.18 (slow 16 sine))
# sustain 0.9
d8 $ slow 4
$ note "[c4 ~ g4 ~] [e4 ~ c4 ~] [a3 ~ e4 ~] [f3 ~ c4 ~]"
# s "supervibe"
# lpf (range 180 620 (slow 16 sine))
# detune 0.08
# room 0.85
# sz 0.96
# gain (range 0.8 0.12 (slow 16 sine))
# sustain 1.6
d9 $ slow 8
$ note "[~ c6 ~ e6] [g5 ~ c6 ~] [~ a5 c6 ~] [g5 ~ e5 ~]"
# s "supervibe"
# lpf (range 320 1200 (slow 12 sine))
# hpf 400
# detune 0.18
# room 0.95
# sz 0.98
# pan (slow 6 sine)
# gain (range 0.55 0.05 (slow 16 sine))
# sustain 1.1
d13 $ ccv "8" # ccn 1 # s "midi"
--end on laugh--
do
d11 $ jux rev $ slow 16
$ striateBy 128 (1/6)
$ s "kids"
# room 0.95
# size 0.98
# lpf 1800
# hpf 500
# gain 0.8
d13 $ ccv "6" # ccn 1 # s "midi"
hush