The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Split soundtrack: a Clean up dialogue task with the level under the speech, the cloud cleaners, and a mixer preset at −18 dB
Clauded2b77aeff637
diff --git a/src/components/audio-tools/clean-dialogue-panel.tsx b/src/components/audio-tools/clean-dialogue-panel.tsxnew file mode 100644index 00000000..7e6c7d22--- /dev/null+++ b/src/components/audio-tools/clean-dialogue-panel.tsx@@ -0,0 +1,252 @@+"use client";++import { AudioLines, Cloud, Cpu, Library, Loader2, SlidersVertical, Sparkles } from "lucide-react";+import Link from "next/link";+import { useId, useMemo, useState } from "react";+import { toast } from "sonner";+import { Button } from "@/components/ui/button";+import { Switch } from "@/components/ui/switch";+import { Segmented } from "@/components/faceless/controls";+import { Panel } from "@/components/av/tool-shell";+import { useGeneration } from "@/components/av/use-generation";+import {+ BED_LEVELS,+ CLEANERS,+ CLOUD_NOTE,+ cleanerOf,+ DEFAULT_BED,+ DEFAULT_CLEANER,+ OPEN_NOTE,+ RELATION_NOTE,+ type BedLevel,+ type Cleaner,+} from "@/lib/av/clean-dialogue";+import { durationWords, openToolPrice, QUALITY_LABELS, type SplitQuality } from "@/lib/av/split";+import type { Engine } from "@/lib/catalog/types";+import { toastError } from "@/lib/refusals";+import { cn } from "@/lib/utils";+import { useAudioToolPreview, useAudioToolRun, useSettled, type AudioToolBody } from "./hooks";++/**+ * Split soundtrack → Clean up dialogue (DBS D5): one run that leaves the speech clear. On your GPU, DBS takes the music+ * and effects out from under the dialogue (or keeps them quietly, at a level picked here) in one job (graph C), and a+ * video gets its soundtrack back with the picture copied. In the cloud, a hosted speech cleaner under its own name. The+ * panel also says how this relates to Clean up voice, which repairs the voice itself.+ */++export interface CleanSource {+ ref: string;+ kind: "audio" | "video";+ name: string;+ duration?: number;+ channels?: number;+}++const bedText = (b: BedLevel) => (b === "off" ? "Off" : `${b} dB`.replace("-", "−"));+const onDevice = (device?: string) => (device === "cuda" ? "on your GPU" : device ? "on your CPU" : "on a CPU");+const price = (p: { costUsd: number | null; demo: boolean } | undefined) =>+ !p ? "…" : p.demo ? "Placeholder · free" : p.costUsd === null ? "Price unknown" : p.costUsd < 0.01 ? "under $0.01" : `≈ $${p.costUsd.toFixed(2)}`;++export function CleanDialoguePanel({+ source,+ engine,+ visitor,+ blocker,+ onMixer,+}: {+ /** The soundtrack, once it's uploaded. */+ source: CleanSource | null;+ /** The header's engine switch: your GPU (DBS) or the cloud (a hosted cleaner). */+ engine: Engine;+ visitor: boolean;+ /** Why nothing can run yet (no file, uploading, a visitor), in words. */+ blocker: string | null;+ /** Switch to Split into stems (the mixer opens on the Clean dialogue preset). */+ onMixer: () => void;+}) {+ const [bed, setBed] = useState<BedLevel>(DEFAULT_BED);+ const [quality, setQuality] = useState<SplitQuality | null>(null);+ const [stereo, setStereo] = useState(false);+ const [cleaner, setCleaner] = useState<Cleaner>(DEFAULT_CLEANER);+ const [remux, setRemux] = useState(true);+ const [resultId, setResultId] = useState<string | null>(null);+ const run = useAudioToolRun();+ const result = useGeneration(resultId);+ const stereoId = useId();+ const remuxId = useId();++ const body: AudioToolBody | null = useMemo(+ () =>+ source+ ? {+ tool: "clean-dialogue",+ engine,+ media: source.ref,+ kind: source.kind,+ name: source.name,+ ...(engine === "open" ? { bed, ...(quality && { quality }), ...(stereo && { stereo }) } : { cleaner }),+ ...(source.kind === "video" && !remux && { remux: false }),+ ...(source.channels && { channels: source.channels }),+ ...(source.duration && { sourceDuration: source.duration }),+ }+ : null,+ [source, engine, bed, quality, stereo, cleaner, remux],+ );+ const settled = useSettled(visitor ? null : body);+ const preview = useAudioToolPreview(settled);+ // While a change settles, the last answer is for other settings: say "Checking…" rather than its price.+ const p = settled === body ? preview.data : undefined;+ const error = preview.error ? (preview.error as Error).message : null;+ const picked: SplitQuality = quality ?? p?.hostPick ?? "fast";+ const g = result.data;+ const busy = run.isPending || g?.status === "queued" || g?.status === "running";+ const out = g?.status === "succeeded" ? g.outputs.find((o) => o.kind === "video") ?? g.outputs.find((o) => o.kind === "audio") : undefined;+ const cleanVoiceHref = source ? `/audio/clean?${source.kind}=${encodeURIComponent(source.ref)}` : "/audio/clean";++ const go = () => {+ if (blocker) return void toast(blocker);+ if (error) return void toast.error(error);+ if (!body) return;+ run.mutate(body, {+ onSuccess: (r) => {+ setResultId(r.result.id);+ toast.success("Cleaning the dialogue…");+ },+ onError: (e) => toastError(e),+ });+ };++ return (+ <div className="space-y-3">+ <Panel title="Clean up dialogue">+ <div className="space-y-3">+ {engine === "open" ? (+ <>+ <div className="flex flex-wrap items-center gap-2">+ <span className="w-16 shrink-0 text-[13px]">Under it</span>+ <Segmented label="Music and effects under the dialogue" value={bed} onChange={setBed} options={BED_LEVELS.map((b) => ({ value: b, label: bedText(b), hint: b === "off" ? "The dialogue alone" : `Music and effects kept ${Math.abs(b)} dB down` }))} />+ </div>+ <p className="text-[12px] text-muted-foreground sm:pl-[4.5rem]">{bed === "off" ? "Just the dialogue: music and sound effects removed." : `The dialogue clear, with the music and effects kept quietly ${Math.abs(bed)} dB under it.`}</p>+ <div className="flex flex-wrap items-center gap-2">+ <span className="w-16 shrink-0 text-[13px]">Model</span>+ <Segmented label="Model" value={picked} onChange={(v) => setQuality(v)} options={(["fast", "best"] as const).map((q) => ({ value: q, label: `${QUALITY_LABELS[q]}${p?.installed && !p.installed.includes(q) ? " · not installed" : ""}` }))} />+ </div>+ {source?.channels !== 1 && !(source?.channels && source.channels > 2) && (+ <div className="flex items-center gap-2">+ <Switch id={stereoId} checked={stereo} onCheckedChange={setStereo} />+ <label htmlFor={stereoId} className="text-[13px]">+ Keep it stereo <span className="text-muted-foreground">(takes about twice as long)</span>+ </label>+ </div>+ )}+ <p className="flex gap-2 text-[13px] text-muted-foreground">+ <Cpu className="mt-0.5 size-3.5 shrink-0" /> {OPEN_NOTE}+ </p>+ </>+ ) : (+ <>+ <div className="flex flex-wrap items-center gap-2">+ <span className="w-16 shrink-0 text-[13px]">Cleaner</span>+ <Segmented label="Cleaner" value={cleaner} onChange={setCleaner} options={CLEANERS.map((c) => ({ value: c.id, label: c.label, hint: c.hint }))} />+ </div>+ <p className="text-[12px] text-muted-foreground sm:pl-[4.5rem]">{cleanerOf(cleaner).hint}</p>+ <p className="flex gap-2 text-[13px] text-muted-foreground">+ <Cloud className="mt-0.5 size-3.5 shrink-0" /> {CLOUD_NOTE}+ </p>+ </>+ )}+ {source?.kind === "video" && (+ <div className="flex items-center gap-2">+ <Switch id={remuxId} checked={remux} onCheckedChange={setRemux} />+ <label htmlFor={remuxId} className="text-[13px]">+ Put it back on the video {engine === "open" && <span className="text-muted-foreground">(picture copied as it is)</span>}+ </label>+ </div>+ )}+ <p className="flex flex-wrap items-center gap-x-2 gap-y-1 border-t border-border pt-3 text-[12px] text-muted-foreground">+ <span>{RELATION_NOTE}</span>+ <Link href={cleanVoiceHref} className="inline-flex items-center gap-1 font-medium text-foreground underline-offset-4 hover:underline">+ <AudioLines className="size-3.5" /> Clean up voice+ </Link>+ </p>+ </div>+ </Panel>++ <div className="space-y-2">+ {!blocker && !error && p && (+ <div className="space-y-1 text-[13px] text-muted-foreground" aria-live="polite">+ <p>{p.summary}</p>+ </div>+ )}+ <div className="flex flex-wrap items-center gap-3">+ <p className={cn("min-w-0 flex-1 text-[13px]", error && !blocker ? "text-destructive" : "text-muted-foreground")} aria-live="polite">+ {visitor ? (+ <span className="font-mono text-foreground">{openToolPrice(p, true)}</span>+ ) : blocker ? (+ blocker+ ) : error ? (+ error+ ) : !p ? (+ "Checking…"+ ) : engine === "open" ? (+ <>+ <span className="font-mono text-foreground">{openToolPrice(p)}</span>+ {p.estimate && !p.demo ? ` · ${durationWords(p.estimate)} ${onDevice(p.device)}` : ""}+ </>+ ) : (+ <span className="font-mono text-foreground">{price(p)}</span>+ )}+ </p>+ <Button size="lg" className={cn("rounded-full", (blocker || error) && "bg-muted text-subtle-foreground hover:bg-muted")} onClick={go} disabled={visitor || busy}>+ {busy ? <Loader2 className="size-4 animate-spin" /> : <Sparkles className="size-4" />} Clean it+ </Button>+ </div>+ </div>++ {g && (g.status === "queued" || g.status === "running") && (+ <Panel>+ <p className="inline-flex items-center gap-2 text-[13px] text-muted-foreground" role="status">+ <Loader2 className="size-3.5 animate-spin" /> {g.message ?? "Cleaning"}…{g.progress ? ` ${Math.round(g.progress * 100)}%` : ""}+ </p>+ </Panel>+ )}+ {g?.status === "failed" && (+ <p className="text-[13px] text-destructive" role="alert">+ {g.error ?? "The clean failed"}+ </p>+ )}+ {out && (+ <Panel title="Clean dialogue" aside={<span className="rounded-full bg-success/15 px-2 py-0.5 text-[12px] font-medium text-success">In your Library</span>}>+ <div className="space-y-3">+ {out.kind === "video" ? (+ <video src={out.url} controls playsInline preload="metadata" className="max-h-[40vh] w-full rounded-xl bg-media object-contain" />+ ) : (+ <audio src={out.url} controls preload="metadata" className="h-9 w-full min-w-0" aria-label="Play the clean dialogue" />+ )}+ <div className="flex flex-wrap gap-2">+ <Button variant="outline" size="sm" className="rounded-full" asChild>+ <Link href="/library">+ <Library className="size-3.5" /> Open Library+ </Link>+ </Button>+ {engine === "open" && (+ <Button variant="ghost" size="sm" className="rounded-full" onClick={onMixer}>+ <SlidersVertical className="size-3.5" /> Fine-tune in the mixer+ </Button>+ )}+ </div>+ </div>+ </Panel>+ )}+ {!out && engine === "open" && (+ <p className="text-[12px] text-muted-foreground">+ Want to set each level yourself?{" "}+ <button type="button" className="font-medium text-foreground underline-offset-4 hover:underline" onClick={onMixer}>+ Split it into stems+ </button>{" "}+ and the mixer opens on Clean dialogue.+ </p>+ )}+ </div>+ );+}diff --git a/src/components/audio-tools/hooks.ts b/src/components/audio-tools/hooks.tsindex 19f62783..ae69de21 100644--- a/src/components/audio-tools/hooks.ts+++ b/src/components/audio-tools/hooks.ts@@ -22,6 +22,21 @@ export type AudioToolBody =channels?: number;sourceDuration?: number;}+ | {+ tool: "clean-dialogue";+ engine: Engine;+ media: string;+ kind: "audio" | "video";+ name?: string;+ bed?: "off" | number;+ quality?: "fast" | "best";+ stereo?: boolean;+ cleaner?: "veed" | "deepfilternet" | "isolation";+ strength?: number;+ remux?: boolean;+ channels?: number;+ sourceDuration?: number;+ }| {tool: "clean";engine: Engine;diff --git a/src/components/audio-tools/split-tool.tsx b/src/components/audio-tools/split-tool.tsxindex df6b7e0c..9820c649 100644--- a/src/components/audio-tools/split-tool.tsx+++ b/src/components/audio-tools/split-tool.tsx@@ -40,6 +40,7 @@ import {partFrames,presetOf,PRESETS,+ presetMix,QUALITY_LABELS,REMUX_FEATURE,setLevel,@@ -58,6 +59,8 @@ import { probeUrl } from "@/lib/media-probe";import { cn } from "@/lib/utils";import { responseError, toastError } from "@/lib/refusals";import { useAudioToolPreview, useAudioToolRun, useSettled, type AudioToolBody } from "./hooks";+import { CleanDialoguePanel } from "./clean-dialogue-panel";+import { CLEAN_DIALOGUE_PRESET } from "@/lib/av/clean-dialogue";/*** Audio → Split soundtrack (DBS D1). Drop a song, podcast, film clip or video; DBS splits it into Dialogue, Music,@@ -72,10 +75,15 @@ type Stem = { id: StemId; url: string; name: string };const baseName = (s: { name?: string }) => (s.name ?? "Soundtrack").replace(/\.[a-z0-9]{2,4}$/i, "");-/** ?audio= / ?video= from a result's "Split soundtrack", read once after hydration. */-function useHandoff(take: (s: Source) => void) {+/**+ * ?audio= / ?video= from a result's "Split soundtrack" (or "Clean up dialogue": ?preset=clean-dialogue), read once after+ * hydration.+ */+function useHandoff(take: (s: Source) => void, preset?: (id: string) => void) {useEffect(() => {const q = new URLSearchParams(window.location.search);+ const p = q.get("preset");+ if (p && preset) preset(p);for (const kind of ["video", "audio"] as const) {const url = q.get(kind);if (url?.startsWith("/api/files/")) return take({ ref: url, preview: url, kind, id: nanoid(8), name: decodeURIComponent(url.split("/").pop() ?? "") });@@ -524,9 +532,9 @@ async function exportWav(stems: Stem[], buffers: Partial<Record<StemId, AudioBuf}}-function Mixer({ stems, source, engine }: { stems: Stem[]; source: Source; engine: Engine }) {+function Mixer({ stems, source, engine, initial = ORIGINAL_MIX }: { stems: Stem[]; source: Source; engine: Engine; initial?: Mix }) {const player = useStemPlayer(stems);- const [mix, setMixState] = useState<Mix>(ORIGINAL_MIX);+ const [mix, setMixState] = useState<Mix>(initial);const [busy, setBusy] = useState<null | "export" | "remux">(null);const exported = useRef<{ key: string; url: string } | null>(null);const remux = useAudioToolRun();@@ -691,11 +699,23 @@ export function SplitSoundtrackTool({ tabs }: { tabs?: React.ReactNode }) {const [resultId, setResultId] = useState<string | null>(null);const result = useGeneration(resultId);const stereoId = useId();+ // Split into stems, or Clean up dialogue (D5: one run, or the mixer opened on its preset).+ const [goal, setGoal] = useState<"split" | "clean">("split");+ const [mixPreset, setMixPreset] = useState<string | null>(null);const take = useCallback((s: Source) => {setSource(s);setResultId(null);}, []);- useHandoff(take);+ const arrive = useCallback((id: string) => {+ if (id !== CLEAN_DIALOGUE_PRESET) return;+ setGoal("clean");+ setMixPreset(CLEAN_DIALOGUE_PRESET);+ }, []);+ useHandoff(take, arrive);+ const pickGoal = (next: "split" | "clean") => {+ setGoal(next);+ if (next === "clean") setMixPreset(CLEAN_DIALOGUE_PRESET);+ };const ready = source && !source.uploading && source.ref ? source : null;const readyRef = ready?.ref;const body: AudioToolBody | null = useMemo(@@ -715,7 +735,7 @@ export function SplitSoundtrackTool({ tabs }: { tabs?: React.ReactNode }) {: null,[ready, engine, quality, stereo],);- const preview = useAudioToolPreview(useSettled(engine === "open" ? body : null));+ const preview = useAudioToolPreview(useSettled(engine === "open" && goal === "split" ? body : null));const p = preview.data;// A file whose header the server couldn't read (Ogg and the like): the browser counts the channels, if it's small.const headerKnown = p?.channels !== undefined;@@ -752,13 +772,24 @@ export function SplitSoundtrackTool({ tabs }: { tabs?: React.ReactNode }) {<ToolShell title="Audio" tabs={tabs} selfHostedOnly>{!source && (<ToolHero- title="Split any soundtrack"- subtitle="Dialogue, music and effects from a song, podcast, film clip or video, with a free live mixer."+ title={goal === "clean" ? "Clean up dialogue" : "Split any soundtrack"}+ subtitle={goal === "clean" ? "Clear speech from a noisy or musical recording or video: the music and effects out from under it, or kept quietly." : "Dialogue, music and effects from a song, podcast, film clip or video, with a free live mixer."}>{visitor && <SelfHostNote className="mt-3 max-w-xl">{SELF_HOSTED}.</SelfHostNote>}</ToolHero>)}<div className={cn("mx-auto max-w-[860px] space-y-3", source ? "pt-4" : "mt-8")}>+ <div className="flex min-w-0 flex-wrap items-center gap-2">+ <Segmented+ label="What to do"+ value={goal}+ onChange={pickGoal}+ options={[+ { value: "split", label: "Split into stems", hint: "Dialogue, music and effects, with a live mixer" },+ { value: "clean", label: "Clean up dialogue", hint: "The speech made clear, in one run" },+ ]}+ />+ </div>{!source ? (<AddMedia onPick={take} onUpdate={setSource} disabled={visitor} />) : (@@ -771,7 +802,16 @@ export function SplitSoundtrackTool({ tabs }: { tabs?: React.ReactNode }) {}}/>)}- {source && engine === "cloud" && (+ {goal === "clean" && (+ <CleanDialoguePanel+ source={ready ? { ref: ready.ref, kind: ready.kind, name: baseName(ready), duration: ready.duration, channels: ready.channels } : null}+ engine={engine}+ visitor={visitor}+ blocker={visitor ? SELF_HOSTED : !source ? "Add a soundtrack to clean" : source.uploading ? "Uploading…" : null}+ onMixer={() => pickGoal("split")}+ />+ )}+ {goal === "split" && source && engine === "cloud" && (<Panel><div className="flex flex-col gap-2 sm:flex-row sm:items-center"><p className="min-w-0 flex-1 text-[13px] text-muted-foreground">@@ -786,7 +826,7 @@ export function SplitSoundtrackTool({ tabs }: { tabs?: React.ReactNode }) {</div></Panel>)}- {source && engine === "open" && (+ {goal === "split" && source && engine === "open" && (<Panel title="Options"><div className="space-y-3"><div className="flex flex-wrap items-center gap-2">@@ -813,7 +853,7 @@ export function SplitSoundtrackTool({ tabs }: { tabs?: React.ReactNode }) {</div></Panel>)}- {source && (+ {goal === "split" && source && (<div className="space-y-2">{!blocker && !error && p && (<div className="space-y-1 text-[13px] text-muted-foreground" aria-live="polite">@@ -856,19 +896,19 @@ export function SplitSoundtrackTool({ tabs }: { tabs?: React.ReactNode }) {</div></div>)}- {g && (g.status === "queued" || g.status === "running") && (+ {goal === "split" && g && (g.status === "queued" || g.status === "running") && (<Panel><p className="inline-flex items-center gap-2 text-[13px] text-muted-foreground" role="status"><Loader2 className="size-3.5 animate-spin" /> {g.message ?? "Splitting"}…{g.progress ? ` ${Math.round(g.progress * 100)}%` : ""}</p></Panel>)}- {g?.status === "failed" && (+ {goal === "split" && g?.status === "failed" && (<p className="text-[13px] text-destructive" role="alert">{g.error ?? "The split failed"}</p>)}- {source && stems.length > 0 && <Mixer key={g!.id} stems={stems} source={source} engine={engine} />}+ {goal === "split" && source && stems.length > 0 && <Mixer key={`${g!.id}:${mixPreset ?? ""}`} stems={stems} source={source} engine={engine} initial={presetMix(mixPreset)} />}</div><Resultsopen={resultId}diff --git a/src/lib/av/clean-dialogue.ts b/src/lib/av/clean-dialogue.tsindex 99c2fc6e..2b512f07 100644--- a/src/lib/av/clean-dialogue.ts+++ b/src/lib/av/clean-dialogue.ts@@ -37,7 +37,7 @@ export const BED_LEVELS: BedLevel[] = ["off", -24, -18, -12];export const DEFAULT_BED: BedLevel = -18;/** What "off" sends: AudioAdjustVolume's floor, 1e-5, under a 16-bit FLAC's smallest step. */export const OFF_DB = -100;-export const bedLabel = (b: BedLevel): string => (b === "off" ? "Dialogue only" : `Music & effects ${b} dB`);+export const bedLabel = (b: BedLevel): string => (b === "off" ? "Dialogue only" : `Music & effects −${Math.abs(b)} dB`);/** A bed level from what a request or the page sent: a whole number from −40 to 0, or off. */export function bedOf(v: unknown): BedLevel {if (v === "off" || v === null || v === false) return "off";@@ -149,7 +149,7 @@ export function planCleanDialogue(i: CleanDialogueInput): CleanDialoguePlan {title: remux ? `${title} · soundtrack` : title,inputs,params: { extra, ...timed },- step: { label: bed === "off" ? "Dialogue only" : `Dialogue, music & effects at ${bed} dB`, index: 0, of },+ step: { label: bed === "off" ? "Dialogue only" : `Dialogue, music & effects at −${Math.abs(bed)} dB`, index: 0, of },},});if (remux) {@@ -168,7 +168,7 @@ export function planCleanDialogue(i: CleanDialogueInput): CleanDialoguePlan {cleaner: null,mode,remux,- summary: `Takes the music and sound effects ${bed === "off" ? "out" : `down to ${bed} dB under the dialogue`}${mode === "each channel" ? `, every channel on its own (${separationPasses(mode, i.channels)} passes)` : ""}${remux ? ", then puts it back on the picture (copied as it is)" : ""}.`,+ summary: `Takes the music and sound effects ${bed === "off" ? "out" : `down to −${Math.abs(bed)} dB under the dialogue`}${mode === "each channel" ? `, every channel on its own (${separationPasses(mode, i.channels)} passes)` : ""}${remux ? ", then puts it back on the picture (copied as it is)" : ""}.`,notes: [OPEN_NOTE,...(mode === "mono" && i.channels !== 1 && !surround ? ["The result is mono. Turn on Stereo to keep it stereo."] : []),diff --git a/src/lib/av/split.ts b/src/lib/av/split.tsindex 9eed410f..2f70ae7f 100644--- a/src/lib/av/split.ts+++ b/src/lib/av/split.ts@@ -340,7 +340,15 @@ export const PRESETS: { id: string; label: string; mix: Mix }[] = [label: "Music under dialogue (−12 dB)",mix: { voice: on(), music: off(), effects: off(), background: on(-12) },},+ // Clean up dialogue (D5): the dialogue clear, the music and effects kept quietly under it.+ {+ id: "clean-dialogue",+ label: "Clean dialogue (−18 dB)",+ mix: { voice: on(), music: off(), effects: off(), background: on(-18) },+ },];+/** The mix a preset id names, or the original. */+export const presetMix = (id: string | null | undefined): Mix => PRESETS.find((p) => p.id === id)?.mix ?? ORIGINAL_MIX;/** The preset a mix is, if any (levels within 0.5 dB, solo off). */export function presetOf(mix: Mix): string | null {diff --git a/tests/e2e/clean-dialogue.mjs b/tests/e2e/clean-dialogue.mjsnew file mode 100644index 00000000..cefcf3a1--- /dev/null+++ b/tests/e2e/clean-dialogue.mjs@@ -0,0 +1,118 @@+// Browser check of Split soundtrack → Clean up dialogue (DBS D5).+// Usage: node tests/e2e/clean-dialogue.mjs [appUrl] [outDir] (the app in demo mode: no keys, no ComfyUI)+// Checks, at 1440 px and 390 px in light and dark: /audio/split?preset=clean-dialogue opens on Clean up dialogue; with a+// clip in, the open engine offers the level under the dialogue (−18 dB picked), says what it removes and how it relates+// to Clean up voice, and prices it Free; the cloud engine offers VEED, DeepFilterNet 3 and ElevenLabs with a price and+// says it gives the voice alone; no sideways scroll and no console errors. Then one demo run on the open engine gives a+// result, "Fine-tune in the mixer" switches to Split into stems, and a split's mixer opens on the Clean dialogue preset;+// last, a result's actions menu in the Library offers "Clean up dialogue". Screenshots go to outDir.+import { spawnSync } from "node:child_process";+import fs from "node:fs";+import path from "node:path";+import { DESKTOP, PHONE, launch, openRoute } from "./_browser.mjs";++const args = process.argv.slice(2).filter((a) => !a.startsWith("--"));+const app = args[0] ?? "http://localhost:3000";+const out = args[1] ?? fs.mkdtempSync("/tmp/fuobe-clean-dialogue-");+fs.mkdirSync(out, { recursive: true });++const wav = path.join(out, "clean-source.wav");+const r = spawnSync("ffmpeg", ["-hide_banner", "-loglevel", "error", "-y", "-f", "lavfi", "-i", "aevalsrc=0.2*sin(2*PI*330*t)|0.2*sin(2*PI*440*t):s=44100:d=6", wav]);+if (r.status !== 0) throw new Error(`ffmpeg failed: ${r.stderr}`);++const failures = [];+const check = (ok, what) => {+ console.log(`${ok ? "✓" : "✗"} ${what}`);+ if (!ok) failures.push(what);+};+async function noSideScroll(page, label) {+ const over = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);+ check(over <= 0, `${label}: no horizontal scroll (${over}px)`);+}+async function setup(browser, device, theme, engine) {+ const ctx = await browser.newContext({ ...device, colorScheme: theme });+ await ctx.addInitScript(([e]) => localStorage.setItem("fuobe.engine", e), [engine]);+ return ctx;+}+function watchConsole(page, label) {+ page.on("console", (m) => m.type() === "error" && check(false, `${label}: console error: ${m.text().slice(0, 200)}`));+ page.on("pageerror", (e) => check(false, `${label}: page error: ${e.message.slice(0, 200)}`));+}++const browser = await launch();+try {+ for (const [dname, device] of [+ ["1440", DESKTOP],+ ["390", PHONE],+ ]) {+ for (const theme of ["light", "dark"]) {+ const label = `${dname} ${theme}`;+ const ctx = await setup(browser, device, theme, "open");+ const page = await ctx.newPage();+ watchConsole(page, label);+ await openRoute(page, `${app}/audio/split?preset=clean-dialogue`);+ const opened = await page.getByRole("heading", { name: "Clean up dialogue" }).first().waitFor({ timeout: 30_000 }).then(() => true, () => false);+ check(opened, `${label}: the preset opens on Clean up dialogue`);+ check((await page.getByRole("radio", { checked: true, name: "Clean up dialogue" }).count()) === 1, `${label}: Clean up dialogue is the picked task`);+ await noSideScroll(page, `${label} empty`);+ await page.locator('input[type="file"]').setInputFiles(wav);+ await page.getByText(/^Free$|Placeholder · free/).first().waitFor({ timeout: 60_000 });+ check(await page.getByRole("radio", { checked: true, name: "−18 dB" }).isVisible(), `${label}: the music and effects stay at −18 dB by default`);+ check(await page.getByText("Removes music and sound effects. For hiss and hum, use Clean up voice or a cloud cleaner.").isVisible(), `${label}: says what the open route removes`);+ check(await page.getByRole("link", { name: "Clean up voice" }).first().isVisible(), `${label}: points to Clean up voice and says how they relate`);+ await page.screenshot({ path: path.join(out, `clean-open-${dname}-${theme}.png`), fullPage: true });+ await noSideScroll(page, `${label} open engine`);+ // The cloud engine: the header's switch.+ await page.getByRole("radiogroup", { name: "Engine" }).getByRole("radio", { name: "Cloud" }).click();+ await page.getByRole("radio", { name: "Clean (VEED)" }).waitFor({ timeout: 60_000 });+ for (const n of ["Denoise (DeepFilterNet 3)", "Voice only (ElevenLabs)"]) check(await page.getByRole("radio", { name: n }).isVisible(), `${label}: offers ${n}`);+ check(await page.getByText("The cloud gives the clean voice on its own, with no music or effects under it.").isVisible(), `${label}: says the cloud gives the voice alone`);+ await page.getByText("Removes background noise and levels the voice. Keeps quiet and distant words.").nth(1).waitFor({ timeout: 60_000 });+ check(!(await page.getByText(/^Takes the music/).count()), `${label}: the cloud's summary is the cleaner's, not the open engine's`);+ await page.getByText(/≈ \$|under \$0\.01|Placeholder · free/).first().waitFor({ timeout: 60_000 });+ check(true, `${label}: the cloud cleaner is priced: ${(await page.getByText(/≈ \$|under \$0\.01|Placeholder · free/).first().innerText()).trim()}`);+ await page.screenshot({ path: path.join(out, `clean-cloud-${dname}-${theme}.png`), fullPage: true });+ await noSideScroll(page, `${label} cloud engine`);+ await ctx.close();+ }+ }++ // ---- One demo run on the open engine, then the mixer on its preset.+ const ctx = await setup(browser, DESKTOP, "light", "open");+ const page = await ctx.newPage();+ watchConsole(page, "run");+ await openRoute(page, `${app}/audio/split?preset=clean-dialogue`);+ await page.locator('input[type="file"]').setInputFiles(wav);+ await page.getByText(/^Free$|Placeholder · free/).first().waitFor({ timeout: 60_000 });+ await page.getByRole("button", { name: "Clean it" }).click();+ await page.getByRole("button", { name: "Fine-tune in the mixer" }).waitFor({ timeout: 40_000 });+ check(await page.getByLabel("Play the clean dialogue").isVisible(), "run: the clean dialogue plays on the page");+ await page.screenshot({ path: path.join(out, "clean-result.png"), fullPage: true });+ await page.getByRole("button", { name: "Fine-tune in the mixer" }).click();+ await page.getByRole("button", { name: "Split it" }).click();+ await page.getByRole("heading", { name: "Stems and mixer" }).waitFor({ timeout: 40_000 });+ check((await page.getByRole("radio", { checked: true, name: "Clean dialogue (−18 dB)" }).count()) === 1, "run: the mixer opens on the Clean dialogue preset");+ await page.screenshot({ path: path.join(out, "clean-mixer.png"), fullPage: true });++ // ---- The hand-off on a result: the Library's actions menu (a phone's ⋯ button on each tile).+ const phone = await setup(browser, PHONE, "dark", "open");+ const lib = await phone.newPage();+ watchConsole(lib, "library");+ await openRoute(lib, `${app}/library`);+ const more = lib.getByRole("button", { name: "More actions", exact: true }).first();+ await more.waitFor({ timeout: 30_000 });+ await more.click();+ const item = lib.getByRole("menuitem", { name: "Clean up dialogue" });+ check(await item.waitFor({ timeout: 10_000 }).then(() => true, () => false), "library: a result's menu offers Clean up dialogue");+ await lib.screenshot({ path: path.join(out, "clean-chip-390.png") });+ await item.click();+ await lib.waitForURL(/\/audio\/split\?.*preset=clean-dialogue/, { timeout: 30_000 });+ check(await lib.getByRole("radio", { checked: true, name: "Clean up dialogue" }).waitFor({ timeout: 30_000 }).then(() => true, () => false), "library: the chip opens Split soundtrack on Clean up dialogue with the file in");+ await noSideScroll(lib, "library hand-off 390");+ await phone.close();+ await ctx.close();+} finally {+ await browser.close();+}+console.log(failures.length ? `\n${failures.length} failure(s)` : "\nall checks passed");+process.exit(failures.length ? 1 : 0);diff --git a/tests/e2e/split-soundtrack.mjs b/tests/e2e/split-soundtrack.mjsindex c36c5c8d..108ee0e5 100644--- a/tests/e2e/split-soundtrack.mjs+++ b/tests/e2e/split-soundtrack.mjs@@ -64,7 +64,7 @@ try {await page.screenshot({ path: path.join(out, `split-empty-${dname}-${theme}.png`), fullPage: true });await noSideScroll(page, `${label} empty`);await page.locator('input[type="file"]').setInputFiles(wav);- await page.getByText("Split soundtrack runs on your GPU (open source).").waitFor({ timeout: 20_000 });+ await page.getByText("Split soundtrack runs on your GPU.").waitFor({ timeout: 20_000 });check(true, `${label}: the cloud engine says Split soundtrack runs on your GPU`);await page.screenshot({ path: path.join(out, `split-cloud-${dname}-${theme}.png`), fullPage: true });await page.getByRole("button", { name: "Use open source" }).click();diff --git a/tests/public-signup-tools.test.ts b/tests/public-signup-tools.test.tsindex 8cae9d80..5c72cfb8 100644--- a/tests/public-signup-tools.test.ts+++ b/tests/public-signup-tools.test.ts@@ -256,6 +256,28 @@ describe("the routes: a visitor's price is its own GPU's, and the owner's charac});});+describe("Clean up dialogue (DBS D5) on /api/audio-tools", () => {+ it("prices a visitor's run on its own GPU, never a demo, only of its own file; the cloud cleaners use the install's keys, so a run is own-gpu-tool", async () => {+ process.env.FUOBE_PUBLIC_SIGNUP = "1";+ const who = newAccount();+ const cookie = auth.createSession(who.id).value;+ const owners = wav();+ const body = (media: string, engine = "open") => ({ tool: "clean-dialogue", engine, media, kind: "audio", name: "Take" });+ for (const c of [undefined, cookie]) {+ const r = await audioTools.POST(call("/api/audio-tools?preview=1", body(owners), c));+ expect(r.status).toBe(422);+ expect((await r.json()).error).toBe("That audio file is gone — add it again");+ }+ const account = await audioTools.POST(call("/api/audio-tools?preview=1", body(wav("mine.wav", who.id)), cookie));+ expect(await account.json()).toMatchObject({ steps: 1, costUsd: 0, demo: false, channels: 2 });+ const owner = await audioTools.POST(call("/api/audio-tools?preview=1", body(owners), auth.createSession().value));+ expect(await owner.json()).toMatchObject({ steps: 1, demo: true });+ const run = proxy(req("/api/audio-tools", { method: "POST", cookie }));+ expect(run.status).toBe(403);+ expect((await run.json()).code).toBe("own-gpu-tool");+ });+});+describe("Remove dialogue (DBS D2) on /api/audio-tools", () => {it("prices a visitor's run on its own GPU, never a demo, and only of its own video; the run is own-gpu-tool at the proxy", async () => {process.env.FUOBE_PUBLIC_SIGNUP = "1";diff --git a/tests/split-soundtrack.test.ts b/tests/split-soundtrack.test.tsindex 9807013b..2c0ea10d 100644--- a/tests/split-soundtrack.test.ts+++ b/tests/split-soundtrack.test.ts@@ -303,14 +303,17 @@ describe("the mixer", () => {]);});- it("has the presets: no dialogue, dialogue only, music only, music under dialogue at −12 dB", () => {+ it("has the presets: no dialogue, dialogue only, music only, music under dialogue at −12 dB, clean dialogue at −18 dB", () => {const gains = Object.fromEntries(PRESETS.map((p) => [p.id, stemGains(p.mix)]));expect(gains["no-dialogue"]).toEqual({ voice: 0, music: 0, effects: 0, background: 1 });expect(gains["dialogue-only"]).toEqual({ voice: 1, music: 0, effects: 0, background: 0 });expect(gains["music-only"]).toEqual({ voice: 0, music: 1, effects: 0, background: 0 });expect(gains["music-under"].voice).toBe(1);expect(gains["music-under"].background).toBeCloseTo(0.251, 3);- expect(PRESETS.map((p) => p.label)).toEqual(["Original", "No dialogue", "Dialogue only", "Music only", "Music under dialogue (−12 dB)"]);+ // Clean up dialogue (D5): the dialogue with the music and effects 18 dB down.+ expect(gains["clean-dialogue"].voice).toBe(1);+ expect(gains["clean-dialogue"].background).toBeCloseTo(0.126, 3);+ expect(PRESETS.map((p) => p.label)).toEqual(["Original", "No dialogue", "Dialogue only", "Music only", "Music under dialogue (−12 dB)", "Clean dialogue (−18 dB)"]);for (const p of PRESETS) expect(presetOf(p.mix)).toBe(p.id);});diff --git a/workflows/comfyui/requirements.json b/workflows/comfyui/requirements.jsonindex 50e9baa8..e92765fa 100644--- a/workflows/comfyui/requirements.json+++ b/workflows/comfyui/requirements.json@@ -1,6 +1,6 @@{"v": 1,- "hash": "ebaa4cc9c7e7542212e088d14be089e916d5586e4f68684b88448482e1c28c57",+ "hash": "f3c2a6e9d250aa347a6ad902475b03d851fb7258134b9d8ffbf31101fa0dabca","comfyui": {"min":"0.41.0","testedCommit":"fc04da91"},"folders": ["audio_encoders","background_removal","checkpoints","clip_vision","dbs","diffusion_models","facerestore_models","foley","frame_interpolation","geometry_estimation","insightface","latent_upscale_models","loras","mmaudio","model_patches","optical_flow","reuse","text_encoders","thinksound","upscale_models","vae"],"sentinels": ["AILab_Qwen3ASRSubtitle","AUSBOSS_NODES_CropForInpaint","AUSBOSS_NODES_ImageCropRotatePad","AUSBOSS_NODES_StitchInpaint","Add Subtitles To Frames","Apply Whisper","CFGOverride","ClothesSegment","ComfyMathExpression","CropFuobeLive","DBSLoader","DBSSeparate","DownloadAndLoadWav2VecModel","DualModelGuider","FL_ChatterboxDialogTTS","FL_ChatterboxMultilingualTTS","FL_ChatterboxVC","GetImageRangeFromBatch","GetImageSizeAndCount","GrowMaskWithBlur","H3AdaLNLoRAFix","H3CharacterSwapAssemble","H3CharacterSwapController","H3CharacterSwapExpandMask","H3CharacterSwapModels","H3CharacterSwapPrepareVideo","H3CharacterSwapRecoverMasks","H3CharacterSwapSelectSubject","H3CharacterSwapSettings","H3CharacterSwapShot","H3CharacterSwapWindowPlan","H3RelayAppendWindow","H3RelayApplyEditMask","H3RelayApplyHistory","H3RelayExpandMask","H3RelayFinishWindows","H3RelayPrepareSource","H3RelayRecoverMasks","H3RelayReviewWindows","H3RelaySamplingMemory","H3RelaySelectMask","H3RelayTextMemory","H3RelayWindowInputs","H3RelayWindowPlan","H3SLAAttention","HunyuanDependenciesLoader","HunyuanFoleySampler","HunyuanModelLoader","INTConstant","Ideogram4Scheduler","ImageBatchExtendWithOverlap","ImageGridtoBatch","ImageResizeKJv2","IndexTTS2Simple","Krea2EditGroundedEncode","Krea2EditModelPatch","Krea2OstrisEditModelPatch","LTXAVTextEncoderLoader","LTXAddVideoICLoRAGuide","LTXICLoRALoaderModelOnly","LTXVAddGuide","LTXVAudioVAEDecode","LTXVAudioVAELoader","LTXVConcatAVLatent","LTXVConditioning","LTXVCropGuides","LTXVDualCFGGuider","LTXVEmptyLatentAudio","LTXVImgToVideoInplace","LTXVLatentUpsampler","LTXVPreprocess","LTXVScheduler","LTXVSeparateAVLatent","LTXVTiledFusionSampler","LatentSyncNode","LoadBackgroundRemovalModel","LoadImageFuobeLive","LoadVideoDepthAnythingModel","MMAudioFeatureUtilsLoader","MMAudioModelLoader","MMAudioSampler","MelBandRoFormerModelLoader","MelBandRoFormerSampler","MiniMaxH3TurboLoRA","MiniMaxH3TurboSampler","MultiTalkModelLoader","MultiTalkWav2VecEmbeds","OpenH3RegenFastVAEDecode","OpenH3RegenFinish","OpenH3RegenLora","OpenH3RegenPrepareDraft","OpenH3RegenRefineLatent","OpenH3RegenSigmas","OpenH3RegenUpscale","OpenH3SaveRefinedLatent","PasteBackFuobeLive","Qwen21EncodeFuobeLive","Qwen21ReferenceFuobeLive","QwenImage21Cache","REUSEEnhance","REUSELoader","RIFE VFI","RMBG","ReActorFaceSwap","RemoveBackground","SAM3_Detect","SAM3_TrackToMask","SAM3_VideoTrack","SaveImageFuobeLive","SeedVR2Conditioning","SeedVR2PostProcessing","SeedVR2Preprocess","TS_ImageToSVGStringColor_Vtracer","TS_SVGStringToSVGBytesIO","TextEncodeFibo2","TextEncodeKrea2OstrisEdit","TextEncodeQwenImage21","ThinkSoundFeatureUtilsLoader","ThinkSoundModelLoader","ThinkSoundSampler","Trellis2Conditioning","Trellis2ShapeStage","Trellis2TextureStage","Trellis2UpsampleStage","VHS_BatchManager","VHS_LoadAudioUpload","VHS_LoadVideo","VHS_SelectEveryNthImage","VHS_VideoCombine","VHS_VideoInfo","VHS_VideoInfoLoaded","VideoDepthAnythingOutput","VideoDepthAnythingProcess","VideoLengthAdjuster","WanVideoBlockSwap","WanVideoClipVisionEncode","WanVideoDecode","WanVideoEncode","WanVideoImageToVideoMultiTalk","WanVideoLoraSelect","WanVideoModelLoader","WanVideoPassImagesFromSamples","WanVideoSampler","WanVideoTextEncodeCached","WanVideoVAELoader","ZenImage21AdapterLoader","ZenImage21TextEncode"],@@ -160,7 +160,7 @@"loras/lightx2v_T2V_14B_cfg_step_distill_v2_lora_rank64_bf16.safetensors": {"folder":"loras","file":"lightx2v_T2V_14B_cfg_step_distill_v2_lora_rank64_bf16.safetensors","url":"https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Lightx2v/lightx2v_T2V_14B_cfg_step_distill_v2_lora_rank64_bf16.safetensors","pinnedUrl":"https://huggingface.co/Kijai/WanVideo_comfy/resolve/8260d429d19fd7a72304cad059160b95d843913f/Lightx2v/lightx2v_T2V_14B_cfg_step_distill_v2_lora_rank64_bf16.safetensors","sizeBytes":630697104,"gated":false,"presence":"loader","loaders":[["LoraLoader","lora_name"],["LoraLoaderModelOnly","lora_name"]]},"loras/ltx-2-19b-distilled-lora-384.safetensors": {"folder":"loras","file":"ltx-2-19b-distilled-lora-384.safetensors","url":"https://huggingface.co/Lightricks/LTX-2/resolve/main/ltx-2-19b-distilled-lora-384.safetensors","pinnedUrl":"https://huggingface.co/Lightricks/LTX-2/resolve/64f65d09e0b76c96202b5bc09997673184cf9b5d/ltx-2-19b-distilled-lora-384.safetensors","sizeBytes":7674558424,"gated":false,"presence":"loader","loaders":[["LoraLoaderModelOnly","lora_name"]]},"loras/ltx-2.5-22b-ic-lora-refine-details-1.0.safetensors": {"folder":"loras","file":"ltx-2.5-22b-ic-lora-refine-details-1.0.safetensors","url":"https://huggingface.co/Lightricks/LTX-2.5-22b-IC-LoRA-Refine-Details/resolve/4912c478b35dd96b6cdcc5f7c7ff9d72c2c57929/ltx-2.5-22b-ic-lora-refine-details-1.0.safetensors","pinnedUrl":"https://huggingface.co/Lightricks/LTX-2.5-22b-IC-LoRA-Refine-Details/resolve/4912c478b35dd96b6cdcc5f7c7ff9d72c2c57929/ltx-2.5-22b-ic-lora-refine-details-1.0.safetensors","sizeBytes":1310000000,"gated":true,"presence":"list"},- "loras/ltx-2.5-22b-ic-lora-restore-1.0.safetensors": {"folder":"loras","file":"ltx-2.5-22b-ic-lora-restore-1.0.safetensors","url":"https://huggingface.co/Lightricks/LTX-2.5-22b-IC-LoRA-Restore/resolve/79245e197a6cd3251e77d178dc380b0e9f2d6563/ltx-2.5-22b-ic-lora-restore-1.0.safetensors","pinnedUrl":"https://huggingface.co/Lightricks/LTX-2.5-22b-IC-LoRA-Restore/resolve/79245e197a6cd3251e77d178dc380b0e9f2d6563/ltx-2.5-22b-ic-lora-restore-1.0.safetensors","sizeBytes":1710000000,"gated":true,"presence":"loader","loaders":[["LTXICLoRALoaderModelOnly","lora_name"]]},+ "loras/ltx-2.5-22b-ic-lora-restore-1.0.safetensors": {"folder":"loras","file":"ltx-2.5-22b-ic-lora-restore-1.0.safetensors","url":"https://huggingface.co/Lightricks/LTX-2.5-22b-IC-LoRA-Restore/resolve/79245e197a6cd3251e77d178dc380b0e9f2d6563/ltx-2.5-22b-ic-lora-restore-1.0.safetensors","pinnedUrl":"https://huggingface.co/Lightricks/LTX-2.5-22b-IC-LoRA-Restore/resolve/79245e197a6cd3251e77d178dc380b0e9f2d6563/ltx-2.5-22b-ic-lora-restore-1.0.safetensors","sizeBytes":1710000000,"gated":true,"presence":"list"},"loras/minimax_h3_fl2v_turbo_8step_v1.0_768p_comfyui_bf16.safetensors": {"folder":"loras","file":"minimax_h3_fl2v_turbo_8step_v1.0_768p_comfyui_bf16.safetensors","url":"https://huggingface.co/lightx2v/Minimax-h3-Turbo/resolve/3ec17a324ced54151364f24f8b5fb6bf7e26414f/minimax_h3_fl2v_turbo_8step_v1.0_768p_comfyui_bf16.safetensors","pinnedUrl":"https://huggingface.co/lightx2v/Minimax-h3-Turbo/resolve/3ec17a324ced54151364f24f8b5fb6bf7e26414f/minimax_h3_fl2v_turbo_8step_v1.0_768p_comfyui_bf16.safetensors","sizeBytes":1956193000,"gated":false,"presence":"loader","loaders":[["LoraLoaderModelOnly","lora_name"]]},"loras/minimax_h3_flf2v_lora_v1.safetensors": {"folder":"loras","file":"minimax_h3_flf2v_lora_v1.safetensors","url":"https://huggingface.co/pablodawson/MiniMax-H3-360-Orbit-LoRA/resolve/5ddbc2dbbe95edbbdaf5017c3e934b1d01791697/minimax_h3_flf2v_lora_v1.safetensors","pinnedUrl":"https://huggingface.co/pablodawson/MiniMax-H3-360-Orbit-LoRA/resolve/5ddbc2dbbe95edbbdaf5017c3e934b1d01791697/minimax_h3_flf2v_lora_v1.safetensors","sizeBytes":155111424,"gated":false,"presence":"loader","loaders":[["LoraLoaderModelOnly","lora_name"]]},"loras/minimax_h3_turbo_v4_step600_ema.safetensors": {"folder":"loras","file":"minimax_h3_turbo_v4_step600_ema.safetensors","url":"https://huggingface.co/larryvrh/MiniMax-H3-Turbo-Lora/resolve/43a74557ac3f6539db8e0f2a959d03feb7a81480/minimax_h3_turbo_v4_step600_ema.safetensors","pinnedUrl":"https://huggingface.co/larryvrh/MiniMax-H3-Turbo-Lora/resolve/43a74557ac3f6539db8e0f2a959d03feb7a81480/minimax_h3_turbo_v4_step600_ema.safetensors","sizeBytes":779849816,"gated":false,"presence":"loader","loaders":[["MiniMaxH3TurboLoRA","lora_name"]]},