Skip to content

Commit 0041ad4

Browse files
committed
fix(engine): tighten volume-envelope tolerance for preview/render parity
At 1% linear tolerance the simplified envelope drifted up to ~0.9 dB from the GSAP curve the browser plays in preview (at the loudness JND, in quiet passages where linear tolerance is perceptually loosest). Tighten to 0.5%, which holds the render to ~0.2 dB of preview across the audible range while a full ease-in/out fade still fits in ~25 of the 32-segment budget.
1 parent 8278af0 commit 0041ad4

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

packages/engine/src/services/audioMixer.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,14 @@ function escapeExpressionCommas(expression: string): string {
4343
*/
4444
const MAX_VOLUME_SEGMENTS = 32;
4545

46-
/** Volume delta below which a keyframe is collinear enough to drop (≈1%, imperceptible). */
47-
const VOLUME_SIMPLIFY_EPSILON = 0.01;
46+
/**
47+
* Volume delta below which a keyframe is collinear enough to drop. Kept tight
48+
* (0.5% linear) so the rendered piecewise-linear envelope tracks the GSAP curve
49+
* the browser plays in preview to within ~0.2 dB across the audible range — well
50+
* under the ~1 dB loudness JND, so render stays WYSIWYG with preview. A full
51+
* ease-in/ease-out fade still reduces to ~25 segments, inside MAX_VOLUME_SEGMENTS.
52+
*/
53+
const VOLUME_SIMPLIFY_EPSILON = 0.005;
4854

4955
/**
5056
* Reduce a sorted keyframe list to a perceptually-equivalent piecewise-linear

0 commit comments

Comments
 (0)