Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions docs/reference/audio-effects.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,13 @@ the others down.
- `data-volume`, a `volume` lane, fades and a group fader each scale only their
own track or group. Doubling a voice moves the voice +6 dB; how much the whole
mix moves depends on what else is playing at that moment.
- Nothing limits the sum. Loud tracks that overlap can pass 0 dBFS and clip in
the exported AAC. Leave headroom, or put a `limiter` or `truepeak` on the
[master bus](#the-master-bus-data-fx-chain-on-the-composition-root).
- Nothing limits the sum. Loud tracks that overlap can pass 0 dBFS. Leave headroom,
or put a `truepeak` on the
[master bus](#the-master-bus-data-fx-chain-on-the-composition-root); a `limiter`
can let fast peaks through.
- Export keeps the delivered file under -1 dBTP. If a peak passes that, it lowers
the **whole mix** by one flat amount, quiet passages included, and the CLI prints
an `audio_lowered` warning.
- The render's master gain, `PRODUCER_AUDIO_GAIN` (default `1`), multiplies the
finished sum once, before the master bus chain.
- To check a level, compare the export against its source scaled by the
Expand Down
23 changes: 23 additions & 0 deletions packages/cli/src/commands/render.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,29 @@ describe("renderLocal browser GPU config", () => {
expect(cpuSamplerState.samplers.map((s) => s.stopped)).toEqual([true, true]);
});

it("warns that the whole mix was lowered, and the render still completes", async () => {
const warn = vi.spyOn(console, "warn").mockImplementation(() => {});
producerState.executeImpl = async (job: { audioLoweredDb?: number }) => {
job.audioLoweredDb = 7.3;
};

const result = await renderLocal(PROJECT_DIR, "/tmp/out.mp4", {
fps: { num: 30, den: 1 },
quality: "standard",
format: "mp4",
gpu: false,
browserGpuMode: "software",
hdrMode: "auto",
quiet: true,
throwOnError: true,
});

expect(warn).toHaveBeenCalledWith(expect.stringContaining("[audio_lowered] Audio lowered 7.3"));
expect(result?.outcome).toBe("completed");
expect(result?.warnings?.map((warning) => warning.code)).toEqual(["audio_lowered"]);
warn.mockRestore();
});

it("cleans orphaned browser trees before starting a local render", async () => {
orphanCleanupState.killed = 1;

Expand Down
8 changes: 7 additions & 1 deletion packages/cli/src/commands/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ import { macosOldChromeCrashRemediation } from "../browser/macosOldChromeCrash.j
import { windowsChromeCrashRemediation } from "../browser/windowsCrash.js";
import { killOrphanedProcessesForRender } from "../utils/orphanCleanup.js";
import { createRenderCancellationScope } from "../utils/renderCancellation.js";
import { audioLoweredWarning } from "../utils/audioLoweredWarning.js";
import {
markRenderSucceeded,
runPostRenderStep,
Expand Down Expand Up @@ -1254,6 +1255,8 @@ async function executeLocalRender(
console.warn(c.warn(` [${warning.code}] ${warning.message}`));
}
}
const audioLowered = audioLoweredWarning(job.audioLoweredDb);
if (audioLowered) console.warn(c.warn(` [${audioLowered.code}] ${audioLowered.message}`));
runPostRenderStep("trackRenderMetrics", () =>
trackRenderMetrics(job, elapsed, options, false, cpuUsage),
);
Expand Down Expand Up @@ -1290,7 +1293,10 @@ async function executeLocalRender(
renderTimeMs: elapsed,
durationMs,
outcome,
warnings: job.warnings.map((warning) => ({ code: warning.code, message: warning.message })),
warnings: [
...job.warnings.map((warning) => ({ code: warning.code, message: warning.message })),
...(audioLowered ? [audioLowered] : []),
],
};
}

Expand Down
15 changes: 15 additions & 0 deletions packages/cli/src/utils/audioLoweredWarning.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { describe, expect, it } from "vitest";
import { audioLoweredWarning } from "./audioLoweredWarning";

describe("audioLoweredWarning", () => {
it("names the cut and the fix", () => {
const warning = audioLoweredWarning(7.3);
expect(warning?.code).toBe("audio_lowered");
expect(warning?.message).toContain("7.3 dB across the whole mix");
expect(warning?.message).toContain("truepeak");
});

it("says nothing when the mix was not lowered", () => {
expect(audioLoweredWarning(undefined)).toBeNull();
});
});
12 changes: 12 additions & 0 deletions packages/cli/src/utils/audioLoweredWarning.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/** The delivery step's flat cut to the whole mix, in words: it changes every quiet passage, so it is not a log line. */
export function audioLoweredWarning(
audioLoweredDb: number | undefined,
): { code: string; message: string } | null {
if (audioLoweredDb === undefined) return null;
return {
code: "audio_lowered",
message:
`Audio lowered ${audioLoweredDb.toFixed(1)} dB across the whole mix, because a peak passed the delivery ceiling. ` +
"To keep the level, put a truepeak limiter with its ceiling at -3 on the mix; a limiter node can let fast peaks through.",
};
}
Loading