Files
Psychotoxical-psysonic/src/utils/loudnessPreAnalysisSlider.ts
T
cucadmuh 87373edb17 fix(loudness): target sync, effective pre-analysis trim, and queue/settings copy (#333)
* fix(loudness): target sync, -14 pre-analysis ref, queue UI, and reseed

- Front: coalesce loudness refresh by target LUFS; replay-gain IPC dedupe keys
  include norm target and effective pre-attenuation so TGT changes apply.
- Rust: placeholder gain before integrated LUFS uses pivot at -14 LUFS; UI gain
  from effective trim; reseed loudness after delete when waveform cache would skip.
- Pre-analysis: store attenuation relative to -14 LUFS; engine and UI use an
  offset for other targets; migrate legacy absolute values on rehydrate.
- Queue/Settings: Loudness/TGT labels vs value buttons; styles; i18n for help.

* fix(i18n): simplify loudness pre-analysis helper copy

Remove reference-target wording from loudness pre-analysis helper text and keep
only the effective adjustment shown for the current LUFS target in all locales.
2026-04-27 02:54:58 +03:00

22 lines
879 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** Pre-analysis level is defined relative to a 14 LUFS target; engine uses an offset for other targets. */
export const LOUDNESS_PRE_ANALYSIS_REF_TARGET_LUFS = -14 as const;
/**
* dB actually applied by the engine (and placeholder math) for the current target.
* Example: ref 4.5 dB at 14, at 12 → 2.5 dB.
*/
export function effectiveLoudnessPreAnalysisAttenuationDb(
storedDbRelativeToRef: number,
targetLufs: number,
): number {
const stepped = Math.round(storedDbRelativeToRef * 2) / 2;
const effective = stepped + (targetLufs - LOUDNESS_PRE_ANALYSIS_REF_TARGET_LUFS);
return Math.max(-24, Math.min(0, effective));
}
/** Stored [24, 0] dB, meaning “at 14 LUFS target”. */
export function clampStoredLoudnessPreAnalysisAttenuationRefDb(v: number): number {
const n = Math.round(v * 2) / 2;
return Math.max(-24, Math.min(0, n));
}