Realm

oa::audio::length_mask

Build a per-row 0/1 length mask matching reference’s channel count and sample width: mask[r, n] = 1 when n < lengths[r]. Pair with stack: one length entry per output row marks each clip’s true sample count so masked losses and reductions can ignore padding. The mask is deterministic metadata and is uploaded like the mel filterbank. Errors Returns an error when lengths does not have one entry per channel or any entry exceeds the reference’s sample count.

FnRust public API

Function Documentation

pub fn length_mask( reference: &Audio, lengths: &[usize] ) -> Result<Matrix>
Build a per-row 0/1 length mask matching reference’s channel count and sample width: mask[r, n] = 1 when n < lengths[r]. Pair with stack: one length entry per output row marks each clip’s true sample count so masked losses and reductions can ignore padding. The mask is deterministic metadata and is uploaded like the mel filterbank. Errors Returns an error when lengths does not have one entry per channel or any entry exceeds the reference’s sample count.