Skip to content

Commit 95751d6

Browse files
vanceingallsclaude
andauthored
fix(audio): eleven small correctness fixes across engine, core and the panel (#3173)
* fix(core): dedupe the wet/dry mix math between delayFeedback and chorusLfo Both effect builders set wet.gain to the mix and dry.gain to its complement in identical two-line blocks; fallow kept re-flagging it as a 10-line clone on every unrelated change. Extracted setWetDryMix. * fix(core): remove the build-audio-fx-runtime.ts stray resurrected by a main merge An earlier merge with main brought this deleted file back (git's merge/delete handling on an unchanged-on-one-side file); package.json already points at build-inline-artifact.ts, so it sat unreachable and duplicating that file's config, both of which fallow flagged. * fix(studio): pull TimelineLanes under the 600-line cap TimelineLanes.tsx hit 620 lines. Extracted the three per-clip pointer gestures (resize-start, pointer-down move-arm, click/razor-split) into createClipGestureHandlers — one factory call per rendered clip instead of ~120 lines of inline handler bodies in the render loop. 529 lines now. * fix(studio): split the extracted pointerdown handler under the CRAP threshold Moving the ~120-line gesture logic into timelineClipGestureHandlers.ts concentrated it into two functions fallow flagged (onPointerDown at CRAP 63.6, onResizeStart at 31.6). Split the decision logic (which gesture a pointerdown implies) into a pure resolvePointerDownAction, then split its own intent-blocking check into isIntentBlocked. onResizeStart's guard moved into canStartResize. Every function now scores under 30. * fix(studio): drop the unused DomEditSelection import in PropertyPanelFlat CI caught it on PR #3026 (wa-12-panel-params); a later refactor in the stack removed the last use of the type here without removing the import. * fix(studio): close the typecheck and fallow gaps wa-18b-reschedule opened useAutomationLanes.ts's write() assumed gesture-scoped coalescing and a preview-only commit that useDomEditAttributeCommits.ts never grew — backported that option support from its own later commit so the two sides of the API agree. The paste path and its tests were missing the box selection's v0/v1 bounds a sibling commit added to AutomationSelection. The FX panel's carve controls still edited the six mechanism numbers (maxCutDb, bands, intelligibilityBias) after carveProfile() collapsed authoring to one Strength knob, so those fields no longer existed on HfCarveSettings; UI now edits strength, and analyseCarveBands is called with carveProfile(strength). Also closes fallow's complexity, dead-code and duplication findings on this PR's diff: extracted automationLaneDragMath.ts (pure group/point-move math) and useAutomationRangeDrag.ts (the marquee-select gesture) out of useAutomationLaneGestures.ts, pulled a couple of render-loop ternaries and a resolver into named functions, dropped an export nothing outside its file used, and shared a step-simplifier between audioCarve's two envelope builders. The edge-stretch vs. box-select priority test in TimelineAutomationLane.test was still pinning the pre-box-select rule (edge wins over a point sitting on it) that a sibling commit deliberately reversed — a point inside the box is now selected content, so grabbing it drags the group instead. Updated the test to the shipped rule instead of the old one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(core): cap the via conic's weight so an edge-clamped via point can't NaN A via point pulled out past the segment (viaX: 5, viaY: -3) clamps to (0.999, 0.001) — exactly on the steady region's edge, where edge - viaX is 0. viaConic divided by that zero to get an infinite weight, and shapeVia turned Infinity into NaN a few steps later (Infinity - Infinity in the quadratic coefficient). NaN reaching setValueCurveAtTime silences the automated parameter for the rest of the render. Capped the weight at 1e6 instead of leaving it unbounded — past that point the arc already reads as touching the via point, so nothing visible is lost. Also hardened shapeVia's existing denominator guard (`<= 0`) to `!(> 0)`, since NaN fails the original comparison and fell through it. Review by Miga (PR #3208). * fix(studio-server): fingerprint the proactive waveform cache key too The route already keys the waveform cache on the asset's size and mtime as well as its path, so a rebuilt-in-place file gets fresh peaks instead of stale ones. generateWaveformCache — the proactive path that runs on upload — still called buildWaveformCacheKey with the path alone, so it wrote to a different key than the route reads from (making the pre-generated cache never found) and kept the exact collision bug this fingerprint exists to fix on its own path. Review by Miga (PR #3211). * style(docs): run oxfmt on the /hyperframes-audio skill docs Table column widths had drifted out of alignment with oxfmt's own rules, failing format:check and blocking the Preflight gate every downstream branch inherits. Whitespace only, no content change. * fix(core): stop \b from missing underscore-separated names, guard clipsOverlap's negative duration \b treats `_` as a word character, so \bbed\b never matched bed_01, music_bed_loop, or theme_song, and \bvo\b/\bvox\b/\btts\b had the same gap — an underscore-separated bed classified as "unknown" and could end up offered as its own carve source. Replaced the short hints with a boundary that actually excludes letters and digits on both sides. clipsOverlap computed end = start + duration without guarding sign, so a negative duration put end before start — an interval that does not describe anything, and one specific case showed it silently dropping a real overlap (a shorter, earlier broken end rejected a clip that genuinely contained the point). Duration clamps to zero instead: a clip cannot un-play time, and a zero-length clip at its start is the sane reading of "duration nobody wrote down as positive." Review by Miga (PR #3212). * fix(studio): widen PropertyPanel's resetModules render timeout again The 20s margin (already once widened for the same reason) is timing out in CI's full-monorepo Test run — the resetModules()+fresh-import render this test needs is uncached and competes with every other package's test suite for the same worker pool, and the same test passes in well under 2s standalone. Went to 45s rather than re-tuning to whatever number happens to clear the current CI load, since that number moves every time CI gains a package. * fix(studio): stop the single-candidate auto-apply carve firing twice Two auto-apply effects both fire when sourceOptions.length === 1: the multi-candidate effect only guards length === 0, so a single candidate passes it too, and the single-candidate effect passes its own guard right after — both compute the same sources list and both call setCarve, so the common case (one narrator, one bed) triggered two decodes, two FFT runs, and two concurrent attribute writes for one decision. The multi-candidate effect now defers to its sibling for exactly one candidate, which already has its own detailed handling for that case. Review by Miga (PR #3213). * feat(core): carve against every voice over a bed, always (#3212) * feat(core): carve against every voice over a bed, always dynamically A bed usually runs under a whole sequence — a narrator, an interview answer, a second presenter — and carving against one of them left the others fighting it. `source` becomes `sources`, and `mixCarveSources` sums every voice onto the BED's clock before anything is measured. That is what keeps one analysis sufficient: the chain is fixed, so there is no per-voice filter to switch between, and bands drawn from all the speech there is with envelopes that rise wherever any of it happens answer the actual question — where and when is speech masking this bed. Summed rather than averaged: two people talking at once mask more than either alone. Audio before the bed starts is dropped rather than folded in at zero, since it plays over nothing and shifting it would put a cut where there is no voice. `dynamic` is gone. A fixed depth thins the bed through every pause, and once both have been heard there is no reason to want it, so every carve follows the speech. Two helpers the panel and the headless script now share instead of each carrying a copy — two definitions of "what does this name suggest" drift, and then the two disagree about which track is the voice: - `classifyAudioName` reads a track's kind from its id and filename together. `unknown` is deliberately common: treating an unrecognised name as "not a voice" would hide the one track somebody needs to pick. - `clipsOverlap` keeps out a voice that never plays while the bed does. An unwritten duration counts as unbounded, not zero — refusing a clip whose length the composition leaves to the media would drop the commonest case there is. Files written before this still load: a single `source` reads as a one-voice list, a stored `dynamic` is ignored, and an absent attribute means the defaults whole. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(core): stop \b from missing underscore-separated names, guard clipsOverlap's negative duration \b treats `_` as a word character, so \bbed\b never matched bed_01, music_bed_loop, or theme_song, and \bvo\b/\bvox\b/\btts\b had the same gap — an underscore-separated bed classified as "unknown" and could end up offered as its own carve source. Replaced the short hints with a boundary that actually excludes letters and digits on both sides. clipsOverlap computed end = start + duration without guarding sign, so a negative duration put end before start — an interval that does not describe anything, and one specific case showed it silently dropping a real overlap (a shorter, earlier broken end rejected a clip that genuinely contained the point). Duration clamps to zero instead: a clip cannot un-play time, and a zero-length clip at its start is the sane reading of "duration nobody wrote down as positive." Review by Miga (PR #3212). --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix(studio): port the carve UI off the removed source/dynamic fields #3212 (accidentally squash-merged into this branch instead of main) changed HfCarveSettings from a single `source` + `dynamic` toggle to a `sources` list with dynamic mode removed outright — the multi-voice UI consumer that goes with that shape lands in the very next PR, so this branch was left with a type that no longer matched its own code. Minimal port, not the multi-voice redesign that PR does properly: the "Listen to" picker and analyse() treat sources[0] as the one voice this UI still understands, and every dynamic-mode branch (the automated envelope lanes, the toggle, the checkbox) is gone along with the field — a carve is now always the static value the analysis computes, matching what the type change made permanent. Test suite trimmed the same way: the automation-lane and toggle tests covered behavior that no longer exists. * docs(plans): fix pre-existing oxfmt formatting drift Blocks the regression workflow's required preflight gate. --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent df57ad4 commit 95751d6

19 files changed

Lines changed: 516 additions & 71 deletions

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@
559559
},
560560
"scripts": {
561561
"build": "bun run build:hyperframes-runtime && bun run build:position-edits-render && bun run build:audio-fx-runtime && tsc && tsx scripts/rewrite-esm-extensions.ts",
562-
"test": "bun run check:position-edits-render && vitest run",
562+
"test": "bun run check:position-edits-render && bun run build:audio-fx-runtime && vitest run",
563563
"test:watch": "vitest",
564564
"test:coverage": "vitest run --coverage",
565565
"test:runtime-coverage": "vitest run --coverage src/runtime",

packages/core/src/audio/audioFxGraph.test.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,3 +438,54 @@ describe("automatable parameters", () => {
438438
expect(onePole.automation?.frequency).toBeUndefined();
439439
});
440440
});
441+
442+
describe("phaser automation targets", () => {
443+
/**
444+
* `in_gain` and `out_gain` trim the signal entering and leaving the effect,
445+
* which the builder drives through inTrim/outTrim while pinning wet and dry
446+
* to 1. The automation map used to aim both lanes at wet/dry — so an envelope
447+
* modulated a constant, the trim it was supposed to move stayed frozen, and
448+
* "fade the phaser out" left the dry leg playing at full level.
449+
*
450+
* Asserted by VALUE rather than by node identity: the trims are internal, and
451+
* the only honest question is whether the param a lane would drive is the one
452+
* the knob sets.
453+
*/
454+
it("drives the trims a lane is named for, not the pinned wet/dry pair", () => {
455+
const handle = buildFxNode(ctx() as unknown as BaseAudioContext, "phaser", {
456+
...defaultAudioFxParams("phaser"),
457+
in_gain: 0.25,
458+
out_gain: 0.5,
459+
});
460+
expect(handle.automation?.in_gain?.[0]?.param.value).toBeCloseTo(0.25, 6);
461+
expect(handle.automation?.out_gain?.[0]?.param.value).toBeCloseTo(0.5, 6);
462+
});
463+
});
464+
465+
describe("chain update keeps ids with their effects", () => {
466+
const band = (id: string, frequency: number) => ({
467+
type: "peaking",
468+
id,
469+
enabled: true,
470+
params: { ...defaultAudioFxParams("peaking"), frequency },
471+
});
472+
473+
/**
474+
* Reordering two effects of the same type leaves the shape string identical,
475+
* so the chain updates in place rather than rebuilding — correct for the
476+
* audio, since the params move with the position. The ids have to move too:
477+
* a lane addresses its effect by id, and an id captured at build time names
478+
* whichever effect used to occupy that slot. The scheduler would then drive
479+
* `fx.n2.frequency` into the band that is now n1 — the exact swap that
480+
* HfAudioFxNode.id documents itself as preventing, and the one the voiceover
481+
* carve's all-peaking chains make easy to hit.
482+
*/
483+
it("moves an id with its slot when same-type effects are reordered", () => {
484+
const chain: HfAudioFxChain = { version: 1, nodes: [band("n1", 200), band("n2", 4000)] };
485+
const handle = buildFxChain(ctx() as unknown as BaseAudioContext, chain);
486+
487+
const swapped: HfAudioFxChain = { version: 1, nodes: [band("n2", 4000), band("n1", 200)] };
488+
expect(handle.update(swapped)).toBe(true);
489+
expect(handle.nodes.map((n) => n.id)).toEqual(["n2", "n1"]);
490+
});
491+
});

packages/core/src/audio/audioFxGraph.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,13 @@ const allpassPhaser: Builder = (ctx, p) => {
364364
// frequency at once — not one knob, one param — so they stay unautomated.
365365
automation: {
366366
speed: [{ param: lfo.frequency }],
367-
in_gain: [{ param: dry.gain }],
368-
out_gain: [{ param: wet.gain }],
367+
// The trims, not wet/dry. apply() drives inTrim/outTrim from these knobs
368+
// and pins wet and dry to 1 — so a lane aimed at wet/dry modulated a
369+
// constant and left the trim frozen, and the next values-only edit slammed
370+
// it back over the running envelope. The comment above records that this
371+
// wiring was already moved once; the automation map was missed.
372+
in_gain: [{ param: inTrim.gain }],
373+
out_gain: [{ param: outTrim.gain }],
369374
},
370375
dispose: () => {
371376
try {
@@ -514,7 +519,17 @@ export function buildFxChain(ctx: BaseAudioContext, chain: HfAudioFxChain): FxCh
514519
if (shapeOf(next) !== shape) return false;
515520
const active = next.nodes.filter((node) => node.enabled !== false);
516521
active.forEach((node, i) => {
517-
handles[i]?.handle.update(normalizeAudioFxParams(node.type, node.params));
522+
const held = handles[i];
523+
if (!held) return;
524+
held.handle.update(normalizeAudioFxParams(node.type, node.params));
525+
// The id follows the position, because the params just did. Reordering
526+
// two effects of the same type leaves the shape identical, so the graph
527+
// is updated in place — but a lane addresses its effect BY id, and an id
528+
// captured at build time then names whichever effect used to be here.
529+
// The scheduler would drive `fx.n2.frequency` into the band that is now
530+
// n1: exactly what HfAudioFxNode.id documents itself as preventing.
531+
if (node.id === undefined) delete held.id;
532+
else held.id = node.id;
518533
});
519534
shape = shapeOf(next);
520535
return true;

packages/core/src/runtime/media.test.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,37 @@ describe("syncRuntimeMedia", () => {
365365
expect(only).toBeCloseTo(0.55, 5);
366366
});
367367

368+
/**
369+
* The render bakes the lane at CLIP-LOCAL time: prepareAudioTrack already
370+
* cut the wav with `-ss mediaStart`, so its t=0 is the clip's start, and
371+
* normaliseEnvelope subtracts trackStart. Preview used to sample at MEDIA
372+
* time — mediaStart included, scaled by playbackRate, wrapped on a loop — so
373+
* the same envelope played somewhere else than it rendered.
374+
*/
375+
it("samples the lane at clip-local time, the way the render bakes it", () => {
376+
const trimmed = (t: number) => {
377+
const clip = createMockClip({ start: 0, end: 10, volume: 0.55, mediaStart: 30 });
378+
Object.defineProperty(clip.el, "readyState", { value: 4, writable: true });
379+
clip.el.setAttribute("data-automation", DUCK);
380+
let seen = -1;
381+
syncRuntimeMedia({
382+
clips: [clip],
383+
timeSeconds: t,
384+
playing: true,
385+
playbackRate: 1,
386+
onElementVolume: (_el, v) => {
387+
seen = v;
388+
},
389+
});
390+
return seen;
391+
};
392+
// `data-media-start="30"` on a clip whose lane holds 0.8 until t=2 then
393+
// ducks to 0.1 by t=3. At media time the playhead is already 30 s past the
394+
// last point, so preview held 0.1 from the first frame and never ducked.
395+
expect(trimmed(1)).toBeCloseTo(0.8, 5);
396+
expect(trimmed(5)).toBeCloseTo(0.1, 5);
397+
});
398+
368399
it("supersedes keyframes probed from the timeline", () => {
369400
// Both present: the lane is the explicit one, and `lint` warns about it.
370401
const clip = createMockClip({ start: 0, end: 10, volume: 0.55 });

packages/core/src/runtime/media.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,15 @@ export function syncRuntimeMedia(params: {
274274
// An explicit volume lane owns the fader. It is checked before the probed
275275
// keyframes because the two would otherwise fight, and it is the one the
276276
// author drew — `lint` warns when a track carries both.
277-
const laneGain = elementVolumeLaneGain(el, relTime);
277+
// Clip-local, NOT `relTime`. A lane's `t` is "seconds from the start of
278+
// the clip" (see HfAutomationPoint), and the render honours that: the wav
279+
// is already cut with `-ss mediaStart`, so its t=0 IS the clip's start.
280+
// `relTime` is MEDIA time — it carries mediaStart, scales by playbackRate
281+
// and wraps on a loop — so feeding it here played the envelope at a
282+
// different position than it renders, or ran it off the end entirely on a
283+
// trimmed clip. The FX lanes on this same feature use clip-local elapsed;
284+
// there is one time base, and this is it.
285+
const laneGain = elementVolumeLaneGain(el, params.timeSeconds - clip.start);
278286
if (laneGain !== null) {
279287
authorVolume = clampVolume(laneGain);
280288
} else if (clip.volumeKeyframes && clip.volumeKeyframes.length > 0) {

packages/core/src/runtime/webAudioTransport.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,19 @@ describe("WebAudioTransport", () => {
388388
expect(transport.isActive()).toBe(false);
389389
});
390390

391+
it("disposes the FX graph when a clip ends naturally", async () => {
392+
// stopAll() disposes by walking _activeSources, and the splice above had
393+
// already removed this entry — so the handle, its MutationObserver and any
394+
// running LFO survived the clip for the rest of the session.
395+
const { transport, mock, gen } = setupTransport(100);
396+
await transport.schedulePlayback(mockEl, mockBuffer, 0, 0, 0, 1, gen);
397+
398+
mock.sourceNode._fireEnded();
399+
400+
expect(mock.sourceNode.disconnect).toHaveBeenCalled();
401+
expect(mock.gainNode.disconnect).toHaveBeenCalled();
402+
});
403+
391404
it("registers onended listener on the sourceNode", async () => {
392405
const { transport, mock, gen } = setupTransport(100);
393406

packages/core/src/runtime/webAudioTransport.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,21 @@ export class WebAudioTransport {
264264
if (idx !== -1) {
265265
this._activeSources.splice(idx, 1);
266266
el.muted = priorMuted;
267+
// The graph goes with it. Splicing alone left the FX handle alive and
268+
// then UNREACHABLE — stopAll() disposes by walking this array, which
269+
// the splice just emptied of this entry. Every clip that finished
270+
// naturally leaked its MutationObserver for the session, and each one
271+
// still answered later `data-fx-chain` edits by rebuilding a whole
272+
// graph (impulse response, chorus/phaser oscillators started and never
273+
// stopped) around a dead source. Not disposed when idx is -1: stopAll()
274+
// has already done it, and `stop()` is what fired this event.
275+
try {
276+
sourceNode.disconnect();
277+
fx?.dispose();
278+
gainNode.disconnect();
279+
} catch {
280+
// Already torn down.
281+
}
267282
if (this._activeSources.length === 0) this._paused = true;
268283
}
269284
});

packages/core/stubs/audio-fx-runtime-entry.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ async function render(
8181
const chain: HfAudioFxChain = parseAudioFxChain(chainJson);
8282
const channels = Math.max(1, planes.length);
8383
const frames = planes[0]?.length ?? 0;
84+
// Nothing to process, and `new OfflineAudioContext(ch, 0, rate)` throws — an
85+
// error the render treats as fatal. applyAudioFxChain screens empty tracks
86+
// out before they reach the browser; this is the same guard at the point the
87+
// constructor would actually blow up.
88+
if (frames === 0) return planes;
8489
const parsedAutomation = automationJson
8590
? resolveAutomation(parseAutomation(automationJson), chain)
8691
: null;

packages/engine/src/services/audioFxRender.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,3 +293,25 @@ describe.skipIf(!HAS_BROWSER)("browser render", () => {
293293
expect(readWav(outPath).samples.length).toBeGreaterThan(0);
294294
}, 180_000);
295295
});
296+
297+
/**
298+
* ffmpeg exits 0 and writes a structurally valid but EMPTY wav whenever a
299+
* clip's trim starts past the end of its source (`-ss 10 -t 5` on a 2 s file).
300+
* That track used to reach `new OfflineAudioContext(ch, 0, rate)`, which throws
301+
* — and the error travels past the mixer's per-track failure collector, so one
302+
* mis-set `data-media-start` took the whole render down.
303+
*/
304+
describe("an empty track", () => {
305+
it("is handed back untouched rather than failing the render", async () => {
306+
const input = join(dir, "empty.wav");
307+
writeWav(input, new Float32Array(0), SR);
308+
const output = join(dir, "out.wav");
309+
310+
// Returns the input path, the same contract as a chain with nothing enabled
311+
// — and without paying for a browser to decide it.
312+
await expect(
313+
applyAudioFxChain(input, chainOf("peaking"), output, { trackId: "t" }),
314+
).resolves.toBe(input);
315+
expect(existsSync(output)).toBe(false);
316+
});
317+
});

packages/engine/src/services/audioFxRender.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,18 +205,30 @@ export async function applyAudioFxChain(
205205

206206
const { samples, sampleRate, channels } = readWav(inputWav);
207207
const planes = deinterleave(samples, channels);
208+
// An empty track has nothing to process — and an OfflineAudioContext of zero
209+
// length throws, which is fatal for the WHOLE render rather than this track:
210+
// the error travels past the mixer's per-track failure collector. ffmpeg
211+
// writes an empty but structurally valid WAV whenever a clip's trim starts
212+
// past the end of its source, so one mis-set `data-media-start` used to take
213+
// the render down. Guarded here as well as in the runtime so an empty track
214+
// never costs a browser.
215+
if ((planes[0]?.length ?? 0) === 0) return inputWav;
208216

209-
// Audio processing needs no GPU or special capture mode; a plain sandboxed
210-
// browser is enough, and the lease pool reuses one across tracks.
211-
const lease = await acquireBrowser([
212-
"--no-sandbox",
213-
"--autoplay-policy=no-user-gesture-required",
214-
]);
217+
// Both resources are taken INSIDE the try that releases them. The lease used
218+
// to be acquired above it, with the mkdtemp between — so a failure there
219+
// (a full disk, a read-only tmpdir) leaked a pooled browser, and a pool with
220+
// no leases left hangs every later render rather than failing one.
215221
const hostDir = mkdtempSync(join(tmpdir(), "hf-fx-host-"));
222+
let lease: Awaited<ReturnType<typeof acquireBrowser>> | null = null;
216223
try {
224+
// Audio processing needs no GPU or special capture mode; a plain sandboxed
225+
// browser is enough, and the lease pool reuses one across tracks.
226+
// Checked before the lease, not after: an already-cancelled track has no
227+
// reason to take a browser out of the pool just to hand it straight back.
217228
if (options.signal?.aborted) {
218229
throw new AudioFxRenderError(`Audio FX cancelled for track ${options.trackId}`);
219230
}
231+
lease = await acquireBrowser(["--no-sandbox", "--autoplay-policy=no-user-gesture-required"]);
220232
const page = await lease.browser.newPage();
221233
try {
222234
// AudioWorklet is only exposed in a secure context, and about:blank is
@@ -302,7 +314,7 @@ export async function applyAudioFxChain(
302314
);
303315
} finally {
304316
rmSync(hostDir, { recursive: true, force: true });
305-
await lease.release().catch(() => undefined);
317+
await lease?.release().catch(() => undefined);
306318
}
307319
}
308320

0 commit comments

Comments
 (0)