Linear amplitude → dB — the exact inverse of dbToLinearGain, and the reason this
one exists: without it the inverse direction was hand-rolled at every call site, which is
how three different silence conventions (1e-12, 1e-7, -60) grew up elsewhere in the
tree for what is nominally the same conversion.
Silence and any non-positive amplitude read -Infinity, not NaN: Math.log10 of a
negative is NaN, and an amplitude below zero is a phase-inverted sample's magnitude
mistake, not a level. Note this is the LEVEL conversion — an analyser floors its own
spectrum at a chosen epsilon instead, deliberately, and should keep doing so.
Linear amplitude → dB — the exact inverse of dbToLinearGain, and the reason this one exists: without it the inverse direction was hand-rolled at every call site, which is how three different silence conventions (
1e-12,1e-7,-60) grew up elsewhere in the tree for what is nominally the same conversion.Silence and any non-positive amplitude read
-Infinity, not NaN:Math.log10of a negative is NaN, and an amplitude below zero is a phase-inverted sample's magnitude mistake, not a level. Note this is the LEVEL conversion — an analyser floors its own spectrum at a chosen epsilon instead, deliberately, and should keep doing so.