Hydra's `a` object exposes real-time FFT bins so any parameter can be driven by an audio frequency band
Hydra performs real-time FFT (Fourier transform) analysis of the incoming audio through the global audio object a (powered by the Meyda library). a.fft[i] (also a.bins[i]) returns a normalized 0-1 value for frequency bin i, where low indices are low frequencies — a.fft[0] is the bass band. Because any Hydra parameter can accept a function returning a number, an FFT bin wires directly to a parameter: passing () => a.fft[0] * scale makes that parameter track bass energy. Supporting controls: a.setBins(n) sets the number of frequency bands; a.show() displays the spectrum on screen for monitoring; a.setCutoff() and a.setScale() calibrate the range; and a.setSmooth(x) applies temporal smoothing (a lowpass on the values, 0 = no smoothing/most responsive, near 1 = heavily smoothed/frozen). Multiplying a bin value scales sensitivity; smoothing trades responsiveness for stability — it tames jittery, twitchy reactions at the cost of added latency on transients.
Examples
a.show()
a.setBins(6)
osc(10, 0, () => a.fft[0]*4).out() // color offset tracks bass
shape(4, () => a.fft[0]).out() // square pulses with bass
osc(16, .15, .5).rotate(Math.PI/3)
.pixelate(() => a.fft[0] * 10, 20).out()
a.setSmooth(.95); a.setBins(2) // pixelation reacts to bass, smoothed to avoid jitter
Assessment
Configure the FFT bins, verify with a.show(), then map bin 0 to an oscillator’s frequency and another bin to rotation speed. Given a sketch jittering wildly to audio, name the a method (and a value) that reduces jitter, and explain what smoothing does and how to make the response less twitchy without killing reactivity.