home/ atoms/ hydra-raw-and-previous-bins

a.bins gives Hydra's un-normalised FFT values and a.prevBins gives the previous frame's, enabling delta-based reactivity

Alongside the 0–1-mapped a.fft array, Hydra exposes the raw per-bin amplitudes via a.bins, without the scaling/cutoff mapping to 0–1. It also keeps the previous frame’s values in a.prevBins. Raw values are useful when you need absolute magnitudes rather than a calibrated 0–1 signal, and comparing a.bins against a.prevBins lets you compute a per-bin change (a delta) between frames — the basis for reacting to onsets or rate-of-change rather than to absolute level. Because a.prevBins is exactly one frame behind, a large positive a.bins[i] - a.prevBins[i] signals a rising transient in that band.

Examples

a.setBins(4)
// flash on a rising low-band transient
osc(30,0.1)
  .luma(()=> (a.bins[0]-a.prevBins[0])>0.1 ? 0 : 0.5)
  .out()

Assessment

Explain the difference between a.fft[0] and a.bins[0], and write an expression using a.bins and a.prevBins that is large only when the low band is rising.

“If you want the raw values from each bin without the mapping from 0 to 1, you can access them via `a.bins`. You can also use `a.prevBins` to get the bins from the previous frame.”
corpus · hydra-audio-reactivity-guide-a-fft-a-setbins-a-show · chunk 1