D3+D4: export stage PCM16/24 + TPDF dither + noise shaping, resample 44.1/48/96k, normalize -1dBTP/-14LUFS, mono side/mid check; Export modal mastering options + /plugins/render options (test 9 case, 23 passed)
This commit is contained in:
@@ -78,6 +78,20 @@ def integrated_lufs(audio: np.ndarray, sr: float) -> float:
|
||||
return float(-0.691 + 10.0 * np.log10(np.mean(gated)))
|
||||
|
||||
|
||||
def mono_side_ratio(audio: np.ndarray) -> float:
|
||||
"""Side/Mid RMS ratio (D3 mono-compat). 0 = mono-safe (L==R); >1 = side
|
||||
louder than mid — mono sum mất nhiều âm thanh."""
|
||||
audio = np.asarray(audio, dtype=np.float64)
|
||||
if audio.ndim == 1:
|
||||
audio = audio[np.newaxis, :]
|
||||
if audio.shape[0] < 2 or audio.shape[1] == 0:
|
||||
return 0.0
|
||||
mid = (audio[0] + audio[1]) * 0.5
|
||||
side = (audio[0] - audio[1]) * 0.5
|
||||
m = float(np.sqrt(np.mean(mid ** 2))) + 1e-12
|
||||
return float(np.sqrt(np.mean(side ** 2))) / m
|
||||
|
||||
|
||||
def true_peak_db(audio: np.ndarray, sr: float, oversample: int = 4) -> float:
|
||||
"""True peak in dBTP (4x oversample). -inf for digital silence."""
|
||||
audio = np.asarray(audio, dtype=np.float64)
|
||||
|
||||
Reference in New Issue
Block a user