Hydra feedback, external sources, and networked streams
Learning objectives
- learner can route output buffers back as feedback to grow emergent and fractal structure
- learner can bring in webcam, screen/window, and video-file sources and process them like any signal
- learner can drive Hydra reactively from audio FFT and extend it with external libraries and networked WebRTC peers
Capstone — one whole task that evidences the objectives
Perform an audio-reactive Hydra set that feeds output buffers back into themselves for emergent feedback texture, mixes a live webcam/window-capture source, and loads the rtc-patch-bay library via loadScript() to pull in a second browser peer over WebRTC — all reacting to an FFT band.
Prerequisite modules
This module takes Hydra from a self-contained pattern generator to the instrument it was actually built to be: a patchable video synthesizer that eats the world — your face, your screen, your collaborator’s browser — and reacts to the music in the room. In a club or algorave setting this is the difference between a screensaver and a set: feedback gives visuals a living, analog-video-art texture; a camera puts the performer inside the image; a networked peer turns solo visuals into a duo.
The arc starts supported and narrow. First, drill the core feedback move — routing output into a named buffer and reading that buffer back — until src(o0).modulate(...) is muscle memory, then use the shape-blend-and-repeat recipe to watch tiling compound into fractal self-similarity. Second, swap generated sources for external ones: initialize a webcam into s0 and process it inside src(), then graduate to capturing another browser window. Third, wire an FFT bin from the a object into a feedback or blend parameter so the whole patch breathes with the bass. Only then assemble the network layer: use loadScript() to pull in the rtc-patch-bay module, and lean on the patch-bay model of WebRTC streams to subscribe to a second performer’s canvas.
Every required atom is load-bearing for the capstone — you cannot perform it without buffer feedback, camera and window sources, FFT wiring, script loading, and peer streaming. The supporting atoms deepen rather than gate: the camera-at-screen recursion story and Crutchfield’s differential-equation framing explain why feedback behaves the way it does, while envelope following and p5.sound situate Hydra’s audio analysis in the wider audio-reactive toolbox.
Walkthrough
Feedback is the move that gives Hydra its living, analog-video-art texture — you route a buffer’s output back into itself so each frame is built on the last. Open the Hydra editor (Ctrl-Shift-Enter). Each step is a complete, runnable patch; we build a feedback tunnel one transform at a time. (Camera and networked-peer sources need hardware/a second browser — they’re in “now make it yours” below.)
1 — a seed in a buffer. .out(o0) renders to buffer o0 (also the default screen). This kaleidoscoped oscillator is the source we’ll feed back into itself ([[hydra-feedback-buffer]]).
osc(4, 0.1, 1.2).kaleid(4).out(o0)
2 — read the buffer back (trails). src(o0) reads what’s on o0; blending the live source with it means each frame is 40% new, 60% the previous frame — motion-blur trails, the essence of feedback ([[hydra-video-feedback]]).
osc(4, 0.1, 1.2).kaleid(4)
.blend(src(o0), 0.6)
.out(o0)
3 — zoom the feedback (a tunnel). Scale the fed-back copy up slightly (.scale(1.04)) before blending, and every frame pushes the last one outward — an infinite zoom tunnel emerges from one line.
osc(4, 0.1, 1.2).kaleid(4)
.blend(src(o0).scale(1.04), 0.6)
.out(o0)
4 — rotate it (a spiral). Add a small .rotate(0.03) to the fed-back copy and the tunnel twists into a spiral. Tiny per-frame transforms compound into big emergent structure ([[hydra-shape-feedback-fractal]]).
osc(4, 0.1, 1.2).kaleid(4)
.blend(src(o0).scale(1.04).rotate(0.03), 0.6)
.out(o0)
5 — modulate the feedback (organic warp). Warp the fed-back copy with slow noise and the clean spiral turns liquid and turbulent — one coherent noise source keeps it organic rather than chaotic.
osc(4, 0.1, 1.2).kaleid(4)
.blend(src(o0).scale(1.04).rotate(0.03).modulate(noise(2), 0.02), 0.6)
.out(o0)
6 — make the feedback breathe with the bass (the capstone). Drive the feedback zoom with an FFT bin so the tunnel pumps on the kick: .scale(() => 1.02 + a.fft[0] * 0.1). Continuous feedback texture + audio reactivity — the full living patch ([[hydra-audio-reactivity]] — enable audio input first):
a.setSmooth(0.9)
osc(4, 0.1, 1.2).kaleid(4)
.blend(
src(o0).scale(() => 1.02 + a.fft[0] * 0.1).rotate(0.03).modulate(noise(2), 0.02),
0.62
)
.out(o0)
What good looks like. Feedback that evolves but doesn’t blow up: the trails should build depth and motion without either freezing (blend too low — the source overwrites everything) or whiting out / smearing to mush (blend too high or scale too aggressive — the loop runs away). Keep the live source visible enough that there’s always fresh structure entering the loop. On the beat, the zoom should pulse, not strobe. (Skill map: live-visualist Domain B4 — depth and texture via feedback.)
Now make it yours. Change .scale(1.04) to 0.98 and the tunnel zooms inward. Add .color(1.01, 1.0, 0.99) to the feedback for a hue drift over time. Bring in your webcam as a source: s0.initCam(); src(s0).blend(src(o0).scale(1.02), 0.5).out(o0) — you inside the feedback. Capture a window with s0.initScreen(). For a networked duo, loadScript("https://cdn.jsdelivr.net/npm/rtc-patch-bay") and pull a second performer’s canvas as a source.
Runnable examples
Generated from the context/ instrument corpus by concept (redistributable idioms only). Do not edit — regenerate with gen-module-examples.mjs.
audio-reactive-map
updateAudio(); scale(1 + amp * 0.01)
p5live-0044 · CC0-1.0
voronoi(() => 4 + a.fft[0] * 10).out()
hydra-0035 · CC0-1.0
feedback-trail
osc(4).modulate(src(o0), 0.6).out(o0)
hydra-0022 · CC0-1.0
function draw(){ fill(0, 20); rect(0, 0, width, height); circle(mouseX, mouseY, 40) }
p5live-0003 · CC0-1.0
tiling-repeat
osc(10).repeat(3, 3).out()
hydra-0008 · CC0-1.0
tile [4,4] (circle 0 0.3) >> add
punctual-0020 · CC0-1.0
radial-symmetry
osc(10).kaleid(5).out()
hydra-0010 · CC0-1.0
// sandbox
osc(10, 0.05, 1.3).kaleid(8).out()
// sandbox
p5live-0037 · CC0-1.0
scale-pulse
uv *= 1.0 + 0.3 * sin(u_time * 2.0);
glsl-0030 · public-domain
updateAudio(); scale(1 + amp * 0.01)
p5live-0044 · CC0-1.0
raymarch-sdf
vec3 nrm(vec3 p){vec2 e=vec2(.001,0);return normalize(vec3(map(p+e.xyy)-map(p-e.xyy),map(p+e.yxy)-map(p-e.yxy),map(p+e.yyx)-map(p-e.yyx)));}
glsl-0033 · public-domain
boolean-sdf
float u = min(a, b); float s = max(a, -b);
glsl-0006 · public-domain
visual-pulse
zoom (1 ~~ 2 $ osc 0.25) (circle 0 0.3) >> add
punctual-0022 · CC0-1.0
Atoms in this module
Required — these gate the capstone
Supporting — enrichment, not gating
Part of curricula
- Audio-Visual Performer — integrated, synced live AV — Make the image listen (audio-reactive show) optional
- Live Visualist — zero to performing live-coded & generative visuals — Reactive & procedural — make it listen, and go to the GPU required
- VJ — visual performance with projection, light & video — Generate & compose: build your own look recommended
Unlocks — modules that require this one