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
kis assigned to the target (1.0) when the target reference has at least as much magnitude there as the other reference, else0.0.