Building Audio-Reactive Visuals in Hydra
Learning objectives
- learner can route audio into Hydra and read per-bin FFT amplitudes
- learner can shape reactivity with scale, cutoff and smoothing to avoid strobe and dead zones
- learner can replace any numeric Hydra parameter with an audio/MIDI-driven function and trigger events on the beat
Capstone — one whole task that evidences the objectives
In Hydra, build a live-coded visual whose motion, colour and one discrete flash are all driven by microphone/loopback audio — using FFT bins with tuned scale/cutoff/smoothing for continuous motion and an onBeat callback for the flash — and perform a 60-second reactive sketch.
Prerequisite modules
This module builds toward the bread-and-butter task of the AV live-coder: a Hydra sketch that visibly listens. In a club or algorave set, visuals that pulse with the kick and shift colour with the mix read as intentional; visuals on a fixed clock read as a screensaver. The rig here is a laptop running Hydra in the browser, fed either by the room microphone or — more commonly — a loopback device carrying your DAW or TidalCycles output, which is why knowing that Hydra only hears the default microphone (and how to route around that) gates everything else.
The arc starts supported: get signal in, call up the FFT bin array, and wire a single bin to one oscillator parameter using the “any number can be a function” idiom. The first result will almost certainly strobe or sit dead — which motivates the calibration pass: set the cutoff floor and scale ceiling for your room, then dial in smoothing until motion is fluid rather than flickery. From there the learner layers a second, independent mapping (bass bin to motion, high bin to colour), and finally adds the discrete layer: an onBeat callback that fires a flash when volume crosses threshold.
Every required atom is load-bearing for the capstone — routing, bins, calibration, smoothing and beat callbacks are each named or exercised directly in the 60-second performance. The supporting atoms enrich: raw and previous-frame bins (a.bins/a.prevBins) show how delta-based onset detection works beyond the calibrated 0–1 signal, and the generic amplitude-threshold beat-detection atom explains why Hydra’s volume-based trigger misfires on sustained sounds and how hysteresis or band-limited detection would harden it — useful context but not needed to perform the sketch.
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
modulation-warp
osc(4).modulate(src(o0), 0.6).out(o0)
hydra-0022 · CC0-1.0
s0.initP5(); src(s0).modulate(noize(), 0.3).out()
p5live-0038 · 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
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
grain-glitch
col += (h21(st + fract(u_time)) - 0.5) * 0.15;
glsl-0026 · public-domain
flow-field
let ang = noise(x*0.01, y*0.01) * TWO_PI
p5live-0008 · CC0-1.0
chromatic-aberration
col = vec3(texture2D(u_tex0,st+vec2(.005,0)).r, texture2D(u_tex0,st).g, texture2D(u_tex0,st-vec2(.005,0)).b);
glsl-0036 · public-domain
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) required
- 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 — Lock to the music: sync to a DJ or band required
Unlocks — modules that require this one