A waveform reduced to buckets min/max pairs, what an oscilloscope or overview strip draws: each bucket covers an equal span of the samples (the last may be shorter), so a peak that lasts one sample still shows, which a plain average would erase.
buckets
import { waveformEnvelope } from '@datamoc/mwg/audio';const view = waveformEnvelope(new Float32Array([0, 1, -1, 0.5]), 2);console.log(view); // [{ min: 0, max: 1 }, { min: -1, max: 0.5 }] Copy
import { waveformEnvelope } from '@datamoc/mwg/audio';const view = waveformEnvelope(new Float32Array([0, 1, -1, 0.5]), 2);console.log(view); // [{ min: 0, max: 1 }, { min: -1, max: 0.5 }]
A waveform reduced to
bucketsmin/max pairs, what an oscilloscope or overview strip draws: each bucket covers an equal span of the samples (the last may be shorter), so a peak that lasts one sample still shows, which a plain average would erase.