Skip to main content

Module audio

Module audio 

Source
Expand description

φ_audio: perceptual descriptors of the normalized standard-phrase render.

Computed on Hann-windowed frames (2048 samples, 50% hop) of the mono render. Every field is finite by construction (renders are vetted first). Deliberately compact — 15 dims, and every one of them named in AudioFeatures::NAMES rather than counted here, so this line cannot go stale again. The taste model is a mixture of linear experts, and interpretable axes (“bright”, “noisy”, “slow attack”, “long tail”) are the point.

§Why these coordinates and not the obvious ones

The model downstream is linear in φ, so the axis a feature lives on decides what preferences are expressible at all.

  • Frequency features are logarithmic, not linear in Hz. Brightness and pitch perception are octave-based. On a linear-Hz axis normalized by Nyquist, moving a patch from 200 Hz to 400 Hz — a full octave, an enormous audible change — shifts the coordinate by 0.009, while 8 k → 16 k shifts it by 0.36. A linear model in that coordinate cannot represent “I like my basses a shade brighter”: the entire usable range is swallowed by the bright tail of the pool. log_axis puts centroid, rolloff and zero-crossing rate on a shared octaves-above-20 Hz scale, normalized to [0, 1] at Nyquist so the vector stays sample-rate agnostic.
  • Heavy tails are logged. crest spans 1 to 40+ and tail_ratio spans three orders of magnitude; standardizing either raw hands the model a coordinate whose z-score is a near-constant for most of the pool and +4 for a handful of outliers.
  • The attack crossing is interpolated, not floored. Quantizing the 90 %-of-peak crossing to the analysis-window index makes attack_s exactly zero for every patch whose first window is already at peak — i.e. most percussive patches — turning a continuous axis into a zero-inflated spike. A fine hop plus sub-window interpolation keeps it continuous, and ln(attack + 5 ms) keeps the fast end resolved.

Structs§

AudioFeatures
Named perceptual descriptors. to_vec order matches AudioFeatures::NAMES.

Functions§

audio_features
Extract AudioFeatures from a (normalized) render.
log_axis
Map a frequency to octaves above 20 Hz, normalized so Nyquist is 1.0.