home/ atoms/ fft-logarithmic-scaling

Logarithmic and 1/3-octave FFT scaling match frequency display to human pitch perception

Raw FFT bins are linearly spaced in Hz, so most bins fall in the high frequencies where hearing is least sensitive; plotting them linearly squashes the bass — where most musical energy lives — into a few bars. Rescaling frequency logarithmically spreads low frequencies across more screen space, matching the perceptual octave scale. The workshop’s 1/3-octave demo makes this concrete: it groups raw bins into bands whose boundaries step by the cube root of two (2^(1/n), n=3), averaging the energy in each band, yielding ~31 bands across the 10 octaves of 20 Hz–20 kHz — the standard used in acoustic measurement. The result is a smooth, perceptually-uniform spectrum where musical changes are visible instead of hidden in the linear high end.

Examples

Linear: x = map(i, 0, totalBins, 0, width). 1/3-octave: nthRootOfTwo = Math.pow(2, 1/3); walk bins high→low, nextBinIndex = round(binIndex/nthRootOfTwo), average spectrum[i] within each band.

Assessment

Explain why a linear FFT display makes bass-heavy music look quiet in the low end; sketch the binning logic that converts linear bins into ~31 1/3-octave bands.

“_Scaling the FFT_”
corpus · visualizing-music-with-p5-js-jason-sigal-audio-reactive-work · chunk 1