Skip to main content

quantize

Function quantize 

Source
pub fn quantize(
    chunk: &AudioChunk,
    bucket_duration: MediaDuration,
) -> AudioHistogram
Expand description

Quantize a single AudioChunk into uniform-width bars.

The chunk’s pts is the start of the first bar. Each bar covers bucket_duration of audio. The final bar may be shorter if the chunk doesn’t divide evenly — it carries the actual remainder duration (not bucket_duration) so the timeline math stays exact.

§Panics

Panics if bucket_duration is zero or negative.