From a8ac55dc30b322285d14dc804654b963e83d11b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Thu, 22 Oct 2026 20:12:49 +0000 Subject: [PATCH] fix: data-volume multiplies the volume lane in preview and render (#6068) * fix: data-volume multiplies the volume lane in preview and render * fix: a clip's data-volume plays ahead of its audio effects, in preview and render * feat(studio): the media panel shows a clip's Gain beside its Volume level * fix(audio): cap gain times volume lanes through each ramp * chore(core): account for shared volume envelopes in package budget * fix(core): restore static gain when a playing lane is removed --- docs/reference/audio-effects.mdx | 8 + docs/reference/html-schema.mdx | 2 +- packages/core/src/audio/audioFxAutomation.ts | 4 +- packages/core/src/audioAutomation.test.ts | 58 +++++++ packages/core/src/audioAutomation.ts | 51 ++++++- packages/core/src/audioGain.ts | 10 ++ packages/core/src/runtime/audioFx.ts | 55 +++++-- packages/core/src/runtime/init.ts | 4 +- packages/core/src/runtime/media.test.ts | 39 ++--- packages/core/src/runtime/media.ts | 24 ++- .../src/runtime/webAudioTransport.test.ts | 144 +++++++++++++++--- .../core/src/runtime/webAudioTransport.ts | 85 ++++++----- .../services/audioAutomationRender.test.ts | 62 +++++++- .../engine/src/services/audioFxRender.test.ts | 25 +++ packages/engine/src/services/audioFxRender.ts | 9 ++ .../src/services/audioMixer.grouping.test.ts | 70 +++++++++ .../engine/src/services/audioMixer.test.ts | 65 ++++++++ packages/engine/src/services/audioMixer.ts | 60 +++++--- packages/lint/src/rules/media.test.ts | 2 +- packages/lint/src/rules/media.ts | 2 +- .../propertyPanelFlatMediaSection.test.tsx | 79 +++++++--- .../editor/propertyPanelFlatMediaSection.tsx | 54 ++++--- .../editor/useVolumeAutomation.test.tsx | 10 +- .../components/editor/useVolumeAutomation.ts | 9 +- scripts/package-size-budgets.json | 70 +++++++-- 25 files changed, 797 insertions(+), 204 deletions(-) diff --git a/docs/reference/audio-effects.mdx b/docs/reference/audio-effects.mdx index d2d60decf0..7a2f541c1e 100644 --- a/docs/reference/audio-effects.mdx +++ b/docs/reference/audio-effects.mdx @@ -115,6 +115,14 @@ Preview and render agree on both clocks. which is about `3.981` — the same ceiling `data-volume` uses. A lane that boosts above unity is valid and will play; `1` is unity, not the maximum. +The lane multiplies `data-volume`, the way clip gain offsets volume keyframes in +an editor: `data-volume="0.5"` under a lane at `1` plays at `0.5`. The product +shares the same +12 dB ceiling. This holds on clips and on groups. + +On a clip, `data-volume` is applied **ahead of** its effects, so a compressor or +limiter in its `data-fx-chain` reacts to it; the lane comes after them. A group's +`data-volume` stays after its effects, like a track fader. + A lane holds its first value backwards to the start of its clip and its last value forward to the end. **A bed that begins before the voice therefore needs an explicit "no cut" point at `t: 0`, or it starts out already ducked.** Maximum 512 diff --git a/docs/reference/html-schema.mdx b/docs/reference/html-schema.mdx index 21e43a99a0..d1f5452f95 100644 --- a/docs/reference/html-schema.mdx +++ b/docs/reference/html-schema.mdx @@ -133,7 +133,7 @@ Audio has no visual lifecycle. | --- | --- | --- | | `data-media-start` / `data-playback-start` | Video, audio, nested composition | Offset into the source file, used by trim and split. Two groups of readers disagree, so the right name depends on the element. **Read only `data-media-start`:** the timing compiler, the HTML parser, `hyperframes validate` (which only inspects `