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 amplitudeA,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§
- Audio
Bar - One bar in an
AudioHistogram— a quantized window of audio summarized by its peak + RMS. - Audio
Histogram - A list of
AudioBars with a uniformbucket_duration.
Functions§
- quantize
- Quantize a single
AudioChunkinto uniform-width bars.