Skip to main content

Module histogram

Module histogram 

Source
Expand description

Audio histogram quantization (M-MEDIA.8 / AUT-104).

Turns an AudioChunk (or stream of chunks) into design-friendly rectangle bars for timeline / dope-sheet visualization. Each AudioBar carries start_time + duration (on the media timeline), peak (max |sample| in the bucket), and rms.

§Bucket size

Default range is 20–50 ms — dope-sheet readability sweet spot (≈ 20–50 bars per second of audio). 10 ms is supported for fine-grained tests + scroll-through-zoom views.

§Math

  • peak = max_{samples in bucket}(|s|). Always in [0, 1].
  • rms = sqrt(mean(s²)). Same range. For a pure sine of amplitude A, rms ≈ A / √2 ≈ 0.7071·A.

Multi-channel chunks collapse to a single bar series — every sample in the interleaved buffer counts toward the same bucket. That matches dope-sheet rendering (one row per audio track, not per channel) and keeps the math + tests simple. M-MEDIA.9 (geometry) handles mono vs stereo display modes.

Structs§

AudioBar
One bar in an AudioHistogram — a quantized window of audio summarized by its peak + RMS.
AudioHistogram
A list of AudioBars with a uniform bucket_duration.

Functions§

quantize
Quantize a single AudioChunk into uniform-width bars.