Skip to main content

Module mask

Module mask 

Source
Expand description

Classical spectral masking for source separation. Given a mixture magnitude spectrum and a per-bin soft mask (each element in [0, 1]), the separated stem magnitude is the element-wise product stem = mixture ⊙ mask. This is the algorithmic core of ideal-ratio / Wiener-style masking; it invents nothing — it only re-weights energy the mixture already contains. Learned mask estimation (a demucs/openunmix network) is a separate, NeedsWeights concern (see learned.rs).

Zero-heap: the caller supplies both the mask and the output buffer.

Functions§

apply_soft_mask
Apply a per-bin soft mask to a mixture magnitude spectrum: out[k] = mixture_mag[k] * mask[k].
binary_mask_from_ratio
Derive a binary mask from two reference magnitude spectra (the “ideal binary mask” when the references are the true stems): bin k is assigned to the target (1.0) when the target reference has at least as much magnitude there as the other reference, else 0.0.