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
Audio: Edit speech changes a word, the pitch, pace, mood or noise of a recording on your GPU, with Fix this line in Captions, the ⋯ menu and Assist
Claude038245666707
diff --git a/scripts/comfy/library.spec.mjs b/scripts/comfy/library.spec.mjsindex 1fac617e..5f58abcf 100644--- a/scripts/comfy/library.spec.mjs+++ b/scripts/comfy/library.spec.mjs@@ -2086,7 +2086,7 @@ export const SPEC = [defaults: { crossfade: 0.12 },limits: { maxDurationSec: 1200 },vramGb: 24,- license: 'AuK code and weights MIT (Tencent); its Qwen2.5-Omni-3B encoder Qwen Research License (non-commercial)',+ license: 'AuK code and weights MIT (Tencent); its Qwen2.5-Omni-3B encoder Qwen Research License (NON-COMMERCIAL)',autoDownloads: ['install-comfyui.sh with AUK=1 AUK_WEIGHTS=1 downloads into the AuK checkout\'s ckpts/ (relative paths resolve there, not in a ComfyUI models folder): tencent/AuK-Flash at 575b92f0895f75180bf2cbd35f2e176c5732b8ed (auk_flash.safetensors 6.12 GB, vae.safetensors 0.64 GB, config.yaml) and Qwen/Qwen2.5-Omni-3B at f75b40e3da2003cdd6e1829b1f420ca70797c34e (3 safetensors shards, 11.97 GB, plus config and tokenizer files); AUK_BASE=1 adds tencent/AuK at 790742b71a4430120daf2b2099192abae449eb9f (auk_base.safetensors 6.12 GB) for the Best setting',],@@ -2115,7 +2115,7 @@ export const SPEC = [outputs: [{ node: '4', kind: 'audio' }],limits: { maxDurationSec: 30 },vramGb: 24,- license: 'AuK code and weights MIT (Tencent); its Qwen2.5-Omni-3B encoder Qwen Research License (non-commercial)',+ license: 'AuK code and weights MIT (Tencent); its Qwen2.5-Omni-3B encoder Qwen Research License (NON-COMMERCIAL)',autoDownloads: ['install-comfyui.sh with AUK=1 AUK_WEIGHTS=1 downloads into the AuK checkout\'s ckpts/ (relative paths resolve there, not in a ComfyUI models folder): tencent/AuK-Flash at 575b92f0895f75180bf2cbd35f2e176c5732b8ed (auk_flash.safetensors 6.12 GB, vae.safetensors 0.64 GB, config.yaml) and Qwen/Qwen2.5-Omni-3B at f75b40e3da2003cdd6e1829b1f420ca70797c34e (3 safetensors shards, 11.97 GB, plus config and tokenizer files); AUK_BASE=1 adds tencent/AuK at 790742b71a4430120daf2b2099192abae449eb9f (auk_base.safetensors 6.12 GB) for the Best setting',],diff --git a/src/components/audio-tools/hooks.ts b/src/components/audio-tools/hooks.tsindex ae69de21..ac5f4230 100644--- a/src/components/audio-tools/hooks.ts+++ b/src/components/audio-tools/hooks.ts@@ -4,6 +4,7 @@ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";import { useEffect, useState } from "react";import type { AudioToolPreview } from "@/lib/av/audio-tools";import type { Engine, Generation } from "@/lib/catalog/types";+import type { SpeechEffect } from "@/lib/speech-edit";import { responseError } from "@/lib/refusals";export type AudioToolBody =@@ -37,6 +38,19 @@ export type AudioToolBody =channels?: number;sourceDuration?: number;}+ | {+ tool: "speech-edit";+ engine: Engine;+ media: string;+ kind: "audio" | "video";+ name?: string;+ cues: { start: number; end: number; text: string }[];+ edited?: string[];+ range?: { start: number; end: number };+ effect?: SpeechEffect;+ quality?: "fast" | "best";+ sourceDuration?: number;+ }| {tool: "clean";engine: Engine;diff --git a/src/components/audio-tools/speech-edit-tool.tsx b/src/components/audio-tools/speech-edit-tool.tsxnew file mode 100644index 00000000..636c7f46--- /dev/null+++ b/src/components/audio-tools/speech-edit-tool.tsx@@ -0,0 +1,559 @@+"use client";++import { AudioLines, Clapperboard, Cpu, Download, FileVideo, Library, Loader2, Mic2, RotateCcw, Sparkles, Upload, X } from "lucide-react";+import Link from "next/link";+import { nanoid } from "nanoid";+import { useCallback, useEffect, useId, useMemo, useState } from "react";+import { toast } from "sonner";+import { Button } from "@/components/ui/button";+import { Checkbox } from "@/components/ui/checkbox";+import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";+import { Feed } from "@/components/studio/feed";+import { ACCEPT, kindOfFile, LibraryGrid, type SlotValue } from "@/components/studio/media-slot";+import { VoiceRecorder } from "@/components/studio/voice-recorder";+import { Segmented } from "@/components/faceless/controls";+import { Panel, ToolHero, ToolShell } from "@/components/av/tool-shell";+import { useGeneration } from "@/components/av/use-generation";+import { useAskBeforeUpload, useCreateGeneration, useEngine, useGenerations } from "@/lib/api";+import { clock } from "@/lib/av/audio-tools";+import type { Generation, OutputFile } from "@/lib/catalog/types";+import type { Cue } from "@/lib/cues";+import { parseCues } from "@/lib/cues";+import { downloadHref } from "@/lib/library";+import { readSpeechEditHandoff } from "@/lib/speech-edit-handoff";+import { toastError } from "@/lib/refusals";+import {+ AUK_LANGUAGES,+ AUK_SETTINGS,+ CLOUD_ONLY_SPEECH_EDIT_PROBLEM,+ CLOUD_SPEECH_EDIT_PROBLEM,+ EFFECT_LABELS,+ EMOTIONS,+ PACES,+ PITCH_STEPS,+ PROMPT_HELPER_NOTE,+ SPEECH_EDIT_FEATURE,+ VOLUME_STEPS,+ type AukQuality,+ type EffectKind,+ type SpeechEffect,+} from "@/lib/speech-edit";+import { cn } from "@/lib/utils";+import { BeforeAfterAudio } from "./before-after-audio";+import { useAudioToolPreview, useAudioToolRun, useSettled, type AudioToolBody } from "./hooks";+import { uploadSource } from "./split-tool";++/**+ * Audio → Edit speech (nm10-speech-edit): add a recording or a video, transcribe it, then change its words (AuK re-speaks+ * just the changed part in the same voice) or how a stretch of it sounds (pitch, pace, volume, emotion, whisper, Clean up,+ * Keep only this speaker). Runs on your GPU (open source): AuK is hosted on neither fal nor Replicate. The result plays+ * against the original with an A/B switch; a video gets its new sound back with the picture copied as it is.+ */++const SUBTITLE = "Change a word without re-recording it, or how a line sounds: its pitch, pace, mood or noise. The new words come out in the same voice. Free, on your own GPU.";++type Source = SlotValue & { kind: "audio" | "video"; duration?: number };+type Mode = "words" | "sound";++const baseName = (s: { name?: string }) => (s.name ?? "Recording").replace(/\.[a-z0-9]{2,4}$/i, "");+const cuesOf = (g: Generation | undefined): Cue[] | null => {+ const out = g?.outputs.find((o) => o.kind === "text");+ if (!out) return null;+ return Array.isArray(out.meta?.cues) ? (out.meta!.cues as Cue[]) : out.text ? parseCues(out.text) : null;+};+const audioOf = (g: Generation | undefined): OutputFile | undefined => g?.outputs.find((o) => o.kind === "audio");+const videoOf = (g: Generation | undefined): OutputFile | undefined => g?.outputs.find((o) => o.kind === "video");++const EFFECTS: EffectKind[] = ["pitch", "pace", "volume", "emotion", "whisper", "unwhisper", "clean", "isolate"];++function defaultEffect(kind: EffectKind): SpeechEffect {+ switch (kind) {+ case "pitch":+ return { kind, semitones: 2 };+ case "pace":+ return { kind, speed: 1.25 };+ case "volume":+ return { kind, db: 5 };+ case "emotion":+ return { kind, emotion: "happy" };+ default:+ return { kind } as SpeechEffect;+ }+}++/** ?audio= / ?video= from a result's ⋯ menu, and a Captions handoff, read once after hydration. */+function useArrival(take: (s: Source, cues?: Cue[], line?: number) => void) {+ useEffect(() => {+ const q = new URLSearchParams(window.location.search);+ for (const kind of ["video", "audio"] as const) {+ const url = q.get(kind);+ if (!url?.startsWith("/api/files/")) continue;+ const handed = readSpeechEditHandoff(url, q);+ return take({ ref: url, preview: url, kind, id: nanoid(8), name: handed?.name ?? decodeURIComponent(url.split("/").pop() ?? "") }, handed?.cues, handed?.line);+ }+ // Once, on arrival.+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, []);+}++function AddMedia({ onPick, onUpdate }: { onPick: (s: Source) => void; onUpdate: (next: (cur: Source | null) => Source | null) => void }) {+ const [over, setOver] = useState(false);+ const [picking, setPicking] = useState(false);+ const askFirst = useAskBeforeUpload();+ const inputId = useId();+ const take = (f: File | undefined) => {+ if (!f || askFirst()) return;+ const kind = kindOfFile(f);+ if (kind !== "audio" && kind !== "video") return void toast("Audio or video only: drop a recording or a clip here");+ void uploadSource(f, kind, onPick, onUpdate);+ };+ return (+ <div+ className={cn("flex flex-col items-center justify-center gap-3 rounded-2xl border-2 border-dashed border-border-strong bg-background px-4 py-8 text-center transition-colors sm:py-10", over && "border-primary bg-brand-faint")}+ onDragOver={(e) => {+ e.preventDefault();+ setOver(true);+ }}+ onDragLeave={() => setOver(false)}+ onDrop={(e) => {+ e.preventDefault();+ setOver(false);+ take(e.dataTransfer.files?.[0]);+ }}+ >+ <span className="grid size-12 place-items-center rounded-2xl bg-brand-faint text-brand-text">{over ? <Upload className="size-5" /> : <AudioLines className="size-5" />}</span>+ <div>+ <p className="text-[15px] font-medium">Add a recording or a video with speech</p>+ <p className="mt-1 text-[13px] text-muted-foreground">English or Chinese speech, up to 20 minutes</p>+ </div>+ <div className="flex flex-wrap items-center justify-center gap-1.5">+ <Button size="sm" className="rounded-full" onClick={() => askFirst() || document.getElementById(inputId)?.click()}>+ <Upload className="size-3.5" /> Upload+ </Button>+ <VoiceRecorder max={300} onRecorded={(v) => onPick({ ...v, id: nanoid(8), kind: "audio", name: "Recording" })} />+ <Popover open={picking} onOpenChange={setPicking}>+ <PopoverTrigger asChild>+ <Button variant="ghost" size="sm" className="rounded-full">+ <Library className="size-3.5" /> Pick from Library+ </Button>+ </PopoverTrigger>+ <PopoverContent className="w-[min(92vw,360px)] p-2" collisionPadding={12}>+ <p className="px-1 pb-2 text-[13px] font-medium">From your library</p>+ {picking && (+ <LibraryGrid+ kinds={["audio", "video"]}+ onPick={(v) => {+ onPick({ ...v, kind: v.kind === "video" ? "video" : "audio" });+ setPicking(false);+ }}+ />+ )}+ </PopoverContent>+ </Popover>+ </div>+ <input+ id={inputId}+ type="file"+ accept={`${ACCEPT.audio},${ACCEPT.video}`}+ hidden+ onChange={(e) => {+ take(e.target.files?.[0]);+ e.target.value = "";+ }}+ />+ </div>+ );+}++function SourcePanel({ source, onDuration, onRemove }: { source: Source; onDuration: (s: number) => void; onRemove: () => void }) {+ const meta = (e: React.SyntheticEvent<HTMLMediaElement>) => Number.isFinite(e.currentTarget.duration) && e.currentTarget.duration > 0 && onDuration(e.currentTarget.duration);+ return (+ <Panel+ title={+ <span className="inline-flex min-w-0 items-center gap-1.5">+ {source.kind === "video" ? <FileVideo className="size-3.5 shrink-0" /> : <AudioLines className="size-3.5 shrink-0" />}+ <span className="truncate">{baseName(source)}</span>+ </span>+ }+ aside={+ <>+ {source.duration ? <span className="font-mono text-[12px] text-muted-foreground tabular-nums">{clock(source.duration)}</span> : null}+ <Button variant="ghost" size="icon-sm" className="rounded-full" aria-label="Remove the recording" onClick={onRemove}>+ <X className="size-4" />+ </Button>+ </>+ }+ >+ {source.uploading ? (+ <p className="inline-flex items-center gap-2 text-[13px] text-muted-foreground" role="status">+ <Loader2 className="size-3.5 animate-spin" /> Uploading…+ </p>+ ) : source.kind === "video" ? (+ <video key={source.preview} src={source.preview} controls playsInline preload="metadata" onLoadedMetadata={meta} className="max-h-[36vh] w-full rounded-xl bg-media object-contain" />+ ) : (+ <audio key={source.preview} src={source.preview} controls preload="metadata" onLoadedMetadata={meta} className="h-9 w-full min-w-0" aria-label={`Play ${baseName(source)}`} />+ )}+ </Panel>+ );+}++/** One transcript line: its words to edit (Words), or a tick to pick it (Sound). */+function Line({ cue, index, text, mode, picked, onText, onPick }: { cue: Cue; index: number; text: string; mode: Mode; picked: boolean; onText: (t: string) => void; onPick: (v: boolean) => void }) {+ const changed = text.trim() !== cue.text.trim();+ return (+ <li className={cn("rounded-xl border px-2.5 py-2 transition-colors", changed ? "border-primary/50 bg-brand-faint/50" : picked && mode === "sound" ? "border-primary/40 bg-brand-faint/40" : "border-border")} data-line={index}>+ <div className="mb-1 flex min-w-0 items-center gap-2">+ {mode === "sound" && <Checkbox checked={picked} onCheckedChange={(v) => onPick(v === true)} aria-label={`Pick line ${index + 1}`} />}+ <span className="font-mono text-[11px] text-muted-foreground tabular-nums">+ {clock(cue.start)} – {clock(cue.end)}+ </span>+ {changed && (+ <button type="button" className="ml-auto inline-flex items-center gap-1 text-[12px] text-muted-foreground hover:text-foreground" onClick={() => onText(cue.text)} aria-label={`Undo the change to line ${index + 1}`}>+ <RotateCcw className="size-3" /> Undo+ </button>+ )}+ </div>+ {mode === "words" ? (+ <>+ <textarea+ value={text}+ onChange={(e) => onText(e.target.value)}+ rows={Math.max(1, Math.ceil(text.length / 70))}+ aria-label={`Words of line ${index + 1}`}+ className="w-full min-w-0 resize-none rounded-md bg-transparent px-1 text-[14px] leading-relaxed outline-none focus:bg-muted focus:ring-2 focus:ring-ring/40"+ />+ {changed && <p className="px-1 text-[12px] text-muted-foreground line-through decoration-muted-foreground/60">{cue.text}</p>}+ </>+ ) : (+ <p className="px-1 text-[14px] leading-relaxed">{cue.text}</p>+ )}+ </li>+ );+}++function EffectOptions({ effect, onChange }: { effect: SpeechEffect; onChange: (e: SpeechEffect) => void }) {+ switch (effect.kind) {+ case "pitch":+ return <Segmented label="Semitones" value={effect.semitones} onChange={(semitones) => onChange({ kind: "pitch", semitones })} options={PITCH_STEPS.map((n) => ({ value: n, label: n > 0 ? `+${n}` : String(n) }))} />;+ case "pace":+ return <Segmented label="Speed" value={effect.speed} onChange={(speed) => onChange({ kind: "pace", speed })} options={PACES.map((n) => ({ value: n, label: `${n}×` }))} />;+ case "volume":+ return <Segmented label="Decibels" value={effect.db} onChange={(db) => onChange({ kind: "volume", db })} options={VOLUME_STEPS.map((n) => ({ value: n, label: `${n > 0 ? "+" : ""}${n} dB` }))} />;+ case "emotion":+ return <Segmented label="Emotion" value={effect.emotion} onChange={(emotion) => onChange({ kind: "emotion", emotion })} options={EMOTIONS.map((e) => ({ value: e, label: e.charAt(0).toUpperCase() + e.slice(1) }))} />;+ case "clean":+ return <p className="text-[12px] text-muted-foreground">Takes out background noise and room echo, and keeps everyone speaking.</p>;+ case "isolate":+ return <p className="text-[12px] text-muted-foreground">Keeps the person saying the picked lines and takes out other voices.</p>;+ default:+ return null;+ }+}++export function SpeechEditTool({ tabs }: { tabs?: React.ReactNode }) {+ const [engine, setEngine, mode] = useEngine();+ const create = useCreateGeneration();+ const run = useAudioToolRun();+ const [source, setSource] = useState<Source | null>(null);+ // Lines handed over (Captions' "Fix this line"), else the transcript's; edits are kept by line.+ const [handed, setHanded] = useState<Cue[] | null>(null);+ const [edits, setEdits] = useState<Record<number, string>>({});+ const [focus, setFocus] = useState<number | null>(null);+ const [transcriptId, setTranscriptId] = useState<string | null>(null);+ const [view, setView] = useState<Mode>("words");+ const [picked, setPicked] = useState<Set<number>>(new Set());+ const [effect, setEffect] = useState<SpeechEffect>(defaultEffect("pitch"));+ const [quality, setQuality] = useState<AukQuality>("fast");+ const [resultId, setResultId] = useState<string | null>(null);+ const [videoId, setVideoId] = useState<string | null>(null);+ const result = useGeneration(resultId);+ const onVideo = useGeneration(videoId);++ const transcript = useGeneration(transcriptId);+ const t = transcript.data;+ const transcribed = useMemo(() => (t?.status === "succeeded" ? cuesOf(t) : null), [t]);+ const cues = handed ?? (transcribed?.length ? transcribed : null);+ const texts = useMemo(() => (cues ?? []).map((c, i) => edits[i] ?? c.text), [cues, edits]);+ const take = useCallback(+ (s: Source, given?: Cue[], line?: number) => {+ setSource(s);+ setResultId(null);+ setVideoId(null);+ setTranscriptId(null);+ setPicked(new Set());+ setEdits({});+ setHanded(given?.length ? given : null);+ setFocus(given?.length ? (line ?? null) : null);+ },+ [],+ );+ useArrival(take);+ const clear = () => {+ setSource(null);+ setHanded(null);+ setEdits({});+ setTranscriptId(null);+ setResultId(null);+ setVideoId(null);+ setPicked(new Set());+ };++ // A finished transcript with no lines: said once.+ useEffect(() => {+ if (t?.status === "succeeded" && !cuesOf(t)?.length) toast("No speech found in this recording");+ }, [t]);+ // A handed-over line: scrolled into view and focused.+ useEffect(() => {+ if (focus === null) return;+ const el = document.querySelector<HTMLTextAreaElement>(`[data-line="${focus}"] textarea`);+ el?.scrollIntoView({ block: "center" });+ el?.focus();+ }, [focus, cues]);++ const ready = source && !source.uploading && source.ref ? source : null;+ const changes = cues ? texts.filter((x, i) => x.trim() !== cues[i]?.text.trim()).length : 0;+ const range = useMemo(() => {+ if (!cues || !picked.size) return null;+ const idx = [...picked].sort((a, b) => a - b);+ return { start: cues[idx[0]].start, end: cues[idx[idx.length - 1]].end };+ }, [cues, picked]);+ const body: AudioToolBody | null = useMemo(() => {+ if (!ready || !cues?.length) return null;+ const base = { tool: "speech-edit" as const, engine, media: ready.ref, kind: ready.kind, name: baseName(ready), cues, quality, ...(ready.duration && { sourceDuration: ready.duration }) };+ if (view === "words") return changes ? { ...base, edited: texts } : null;+ return range ? { ...base, range, effect } : null;+ }, [ready, cues, texts, changes, view, range, effect, engine, quality]);+ const preview = useAudioToolPreview(useSettled(engine === "open" ? body : null, 500));+ const p = preview.data;+ const error = preview.error ? (preview.error as Error).message : null;+ const cloudProblem = mode === "cloud" ? CLOUD_ONLY_SPEECH_EDIT_PROBLEM : CLOUD_SPEECH_EDIT_PROBLEM;+ const blocker = !source+ ? "Add a recording"+ : source.uploading+ ? "Uploading…"+ : engine === "cloud"+ ? cloudProblem+ : !cues+ ? "Transcribe it first"+ : view === "words" && !changes+ ? "Change the words of a line"+ : view === "sound" && !range+ ? "Tick the lines to change"+ : null;+ const g = result.data;+ const busy = run.isPending || g?.status === "queued" || g?.status === "running" || onVideo.data?.status === "queued" || onVideo.data?.status === "running";+ const transcribing = create.isPending || t?.status === "queued" || t?.status === "running";++ const transcribe = () => {+ if (!ready) return;+ create.mutate(+ { feature: SPEECH_EDIT_FEATURE, modelId: "oss-qwen3-asr", engine: "open", op: "transcribe", inputs: ready.kind === "video" ? { video: ready.ref } : { audio: ready.ref }, title: `Transcript · ${baseName(ready)}` },+ { onSuccess: (items) => setTranscriptId(items[0]?.id ?? null), onError: (e) => toastError(e) },+ );+ };+ const go = () => {+ if (blocker) return void toast(blocker);+ if (error) return void toast.error(error);+ run.mutate(body!, {+ onSuccess: (r) => {+ const edit = r.items.find((x) => x.op === "speech-edit") ?? r.result;+ setResultId(edit.id);+ setVideoId(r.items.find((x) => x.op === "mux")?.id ?? null);+ toast.success("Editing the speech on your GPU");+ },+ onError: (e) => toastError(e),+ });+ };+ const out = g?.status === "succeeded" ? audioOf(g) : undefined;+ const clip = onVideo.data?.status === "succeeded" ? videoOf(onVideo.data) : undefined;+ const warning = p && source?.kind === "video" ? p.notes.find((n) => /Lipsync/.test(n)) : undefined;++ return (+ <ToolShell title="Audio" tabs={tabs}>+ {!source && <ToolHero title="Edit speech" subtitle={SUBTITLE} />}+ <div className={cn("mx-auto max-w-[860px] space-y-3", source ? "pt-4" : "mt-6")}>+ {!source ? (+ <AddMedia onPick={(s) => take(s)} onUpdate={setSource} />+ ) : (+ <SourcePanel source={source} onDuration={(duration) => setSource((s) => (s ? { ...s, duration } : s))} onRemove={clear} />+ )}+ {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">+ <span className="font-medium text-foreground">Edit speech runs on your GPU (open source).</span>{" "}+ {mode === "cloud" ? "This install is set to paid cloud APIs only (Settings → Engine mode), and AuK isn't hosted on fal or Replicate." : "AuK isn't hosted on fal or Replicate, so the cloud engine can't change what was said."}+ </p>+ {mode === "both" ? (+ <Button variant="outline" size="sm" className="shrink-0 rounded-full" onClick={() => setEngine("open")}>+ <Cpu className="size-3.5" /> Use open source+ </Button>+ ) : null}+ </div>+ </Panel>+ )}+ {source && engine === "open" && !cues && (+ <Panel title="1 · Transcribe">+ <div className="flex flex-wrap items-center gap-3">+ <p className="min-w-0 flex-1 text-[13px] text-muted-foreground">Fuobe writes down what was said, line by line, so you can change it like text. Free on your GPU.</p>+ <Button className="rounded-full" onClick={transcribe} disabled={!ready || transcribing}>+ {transcribing ? <Loader2 className="size-4 animate-spin" /> : <Sparkles className="size-4" />} Transcribe+ </Button>+ </div>+ {t?.status === "failed" && (+ <p className="mt-2 text-[13px] text-destructive" role="alert">+ {t.error ?? "Transcribing failed"}+ </p>+ )}+ </Panel>+ )}+ {source && engine === "open" && cues && (+ <Panel+ title="2 · Change it"+ aside={<Segmented label="What to change" value={view} onChange={setView} options={[{ value: "words", label: "Words" }, { value: "sound", label: "How it sounds" }]} />}+ >+ <p className="mb-2 text-[12px] text-muted-foreground">+ {view === "words"+ ? "Edit a line's words: replace, add or remove a few. Only the changed part is re-spoken, with a second of the recording around it, in the same voice."+ : "Tick the lines to change, then pick what to do to them."}+ </p>+ {view === "sound" && (+ <div className="mb-3 space-y-2 rounded-xl bg-muted/50 p-2.5">+ <Segmented label="Effect" value={effect.kind} onChange={(k) => setEffect(defaultEffect(k))} options={EFFECTS.map((k) => ({ value: k, label: EFFECT_LABELS[k] }))} />+ <EffectOptions effect={effect} onChange={setEffect} />+ </div>+ )}+ <ol className="max-h-[52vh] space-y-1.5 overflow-y-auto pr-1">+ {cues.map((c, i) => (+ <Line+ key={i}+ cue={c}+ index={i}+ text={texts[i] ?? c.text}+ mode={view}+ picked={picked.has(i)}+ onText={(x) => setEdits((all) => ({ ...all, [i]: x }))}+ onPick={(v) =>+ setPicked((s) => {+ const n = new Set(s);+ if (v) n.add(i);+ else n.delete(i);+ return n;+ })+ }+ />+ ))}+ </ol>+ <div className="mt-3 flex flex-wrap items-center gap-2">+ <span className="w-16 shrink-0 text-[13px]">Quality</span>+ <Segmented label="Quality" value={quality} onChange={setQuality} options={(["fast", "best"] as const).map((q) => ({ value: q, label: AUK_SETTINGS[q].label.replace(/ \(.*\)$/, "") }))} />+ <span className="text-[12px] text-muted-foreground">{quality === "fast" ? "AuK-Flash, 4 steps" : "Full AuK, 32 steps: slower, a little closer to the voice"}</span>+ </div>+ </Panel>+ )}+ {source && (+ <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>+ {p.notes.map((n) => (+ <p key={n} className="text-[12px]">+ {n}+ </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">+ {engine === "cloud" ? (+ mode === "cloud" ? (+ "Not available on this install: it is set to paid cloud APIs only"+ ) : (+ "Switch to the open engine to edit speech"+ )+ ) : blocker ? (+ blocker+ ) : error ? (+ error+ ) : p ? (+ <>+ <span className="font-mono text-foreground">{p.demo ? "Demo · free" : "Free · runs on your GPU"}</span>+ {view === "words" ? ` · ${changes} line${changes === 1 ? "" : "s"} changed` : ""}+ </>+ ) : (+ "Checking…"+ )}+ </p>+ <Button size="lg" className={cn("rounded-full", (blocker || error) && "bg-muted text-subtle-foreground hover:bg-muted")} onClick={go} disabled={busy}>+ {busy ? <Loader2 className="size-4 animate-spin" /> : <Sparkles className="size-4" />} Edit speech+ </Button>+ </div>+ <p className="text-[12px] text-muted-foreground">+ {PROMPT_HELPER_NOTE} AuK understands {AUK_LANGUAGES.join(" and ")}. Only change recordings of your own voice, or of someone who agreed to it.+ </p>+ </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 ?? "Re-speaking the changed parts"}…{g.progress ? ` ${Math.round(g.progress * 100)}%` : ""}+ </p>+ </Panel>+ )}+ {g?.status === "failed" && (+ <p className="text-[13px] text-destructive" role="alert">+ {g.error ?? "Editing failed"}+ </p>+ )}+ {source && out && (+ <Panel title="Original and edited">+ <BeforeAfterAudio key={out.url} before={source.preview} after={out.url} labels={{ before: "Original", after: "Edited" }} />+ {warning && <p className="mt-2 text-[12px] text-muted-foreground">{warning}</p>}+ <div className="mt-3 flex flex-wrap items-center gap-2">+ <Button variant="outline" size="sm" className="rounded-full" asChild>+ <a href={downloadHref(out.url, `${baseName(source)} · edited.flac`)} download>+ <Download className="size-3.5" /> Download+ </a>+ </Button>+ {clip ? (+ <>+ <Button variant="outline" size="sm" className="rounded-full" asChild>+ <a href={downloadHref(clip.url, `${baseName(source)} · edited.mp4`)} download>+ <Clapperboard className="size-3.5" /> Download the video+ </a>+ </Button>+ {warning && (+ <Button size="sm" className="rounded-full" asChild>+ <Link href={`/lipsync?video=${encodeURIComponent(source.ref)}&audio=${encodeURIComponent(out.url)}`}>+ <Mic2 className="size-3.5" /> Lipsync it+ </Link>+ </Button>+ )}+ </>+ ) : source.kind === "video" && onVideo.data && onVideo.data.status !== "failed" ? (+ <span className="inline-flex items-center gap-1.5 text-[12px] text-muted-foreground">+ <Loader2 className="size-3 animate-spin" /> Putting the new sound on the video…+ </span>+ ) : null}+ </div>+ </Panel>+ )}+ </div>+ <Results />+ </ToolShell>+ );+}++/** Earlier edits (and their videos). */+function Results() {+ const items = useGenerations({ features: [SPEECH_EDIT_FEATURE], limit: 12 }).data?.filter((g) => g.op !== "transcribe") ?? [];+ if (!items.length) return null;+ return (+ <section className="mx-auto mt-10 max-w-[1040px]" aria-labelledby="speech-edit-results">+ <h3 id="speech-edit-results" className="mb-3 font-heading text-[22px]">+ Your edited speech+ </h3>+ <Feed items={items} />+ </section>+ );+}diff --git a/src/components/av/cue-editor.tsx b/src/components/av/cue-editor.tsxindex adcd318e..96ded748 100644--- a/src/components/av/cue-editor.tsx+++ b/src/components/av/cue-editor.tsx@@ -1,6 +1,6 @@"use client";-import { Merge, Plus, Redo2, Scissors, Trash2, Undo2 } from "lucide-react";+import { Merge, Plus, Redo2, Scissors, TextCursorInput, Trash2, Undo2 } from "lucide-react";import { memo, useCallback, useEffect, useReducer, useRef } from "react";import { Button } from "@/components/ui/button";import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";@@ -60,6 +60,7 @@ const Row = memo(function Row({last,dispatch,onSeek,+ onFixLine,}: {cue: Cue;index: number;@@ -67,6 +68,7 @@ const Row = memo(function Row({last: boolean;dispatch: (a: CueAction) => void;onSeek?: (t: number) => void;+ onFixLine?: (index: number) => void;}) {const text = useRef<HTMLTextAreaElement>(null);const [start, setStart, resetStart] = useDraft(formatCueTime(cue.start));@@ -105,6 +107,11 @@ const Row = memo(function Row({<span className="text-muted-foreground">→</span>{timeInput("end", end, setEnd)}<div className="ml-auto flex items-center opacity-100 sm:opacity-0 sm:group-focus-within/cue:opacity-100 sm:group-hover/cue:opacity-100">+ {onFixLine && (+ <RowAction label="Fix this line: change what was said" line={index} onClick={() => onFixLine(index)} disabled={!cue.text.trim()}>+ <TextCursorInput className="size-3.5" />+ </RowAction>+ )}<RowAction label="Split at the cursor" line={index} onClick={splitAtCaret} disabled={!cue.text.trim().includes(" ")}><Scissors className="size-3.5" /></RowAction>@@ -147,12 +154,15 @@ export function CueEditor({onSeek,className,emptyHint = "No lines yet",+ onFixLine,}: {editor: ReturnType<typeof useCueEditor>;currentTime?: number;onSeek?: (t: number) => void;className?: string;emptyHint?: string;+ /** "Fix this line": open Edit speech on this line (change what was said in the recording itself). */+ onFixLine?: (index: number) => void;}) {const { cues, dispatch, canUndo, canRedo } = editor;const list = useRef<HTMLOListElement>(null);@@ -184,7 +194,7 @@ export function CueEditor({{cues.length ? (<ol ref={list} className="relative min-h-0 flex-1 space-y-0.5 overflow-y-auto pr-1">{cues.map((c, i) => (- <Row key={i} cue={c} index={i} active={i === active} last={i === cues.length - 1} dispatch={send} onSeek={onSeek} />+ <Row key={i} cue={c} index={i} active={i === active} last={i === cues.length - 1} dispatch={send} onSeek={onSeek} onFixLine={onFixLine} />))}</ol>) : (diff --git a/src/components/captions/captions-studio.tsx b/src/components/captions/captions-studio.tsxindex 9ce0466e..f0a3a091 100644--- a/src/components/captions/captions-studio.tsx+++ b/src/components/captions/captions-studio.tsx@@ -1,6 +1,7 @@"use client";import { Captions, Download, FileUp, Flame, Loader2, Sparkles, Wand2 } from "lucide-react";+import { useRouter } from "next/navigation";import { useEffect, useMemo, useRef, useState } from "react";import { toast } from "sonner";import { Button } from "@/components/ui/button";@@ -35,6 +36,7 @@ import {type CaptionSize,} from "@/lib/av/captions";import { parseCues, toSrt, toVtt, type Cue } from "@/lib/cues";+import { speechEditLink } from "@/lib/speech-edit-handoff";import { cn } from "@/lib/utils";import { toastError } from "@/lib/refusals";@@ -140,7 +142,8 @@ export function CaptionsStudio({ tabs }: { tabs?: React.ReactNode }) {}function Editor({ video, restored, onReplace }: { video: SlotValue; restored: Saved | null; onReplace: (v: SlotValue | null) => void }) {- const [engine] = useEngine();+ const [engine, , mode] = useEngine();+ const router = useRouter();const create = useCreateGeneration();const editor = useCueEditor(restored?.cues ?? []);const [look, setLook] = useState<CaptionLook>(restored?.look ?? DEFAULT_LOOK);@@ -268,6 +271,8 @@ function Editor({ video, restored, onReplace }: { video: SlotValue; restored: Sa}}className="max-h-[60vh]"emptyHint="Transcribe the clip, import an .srt / .vtt, or write the lines yourself."+ /* Fix this line: change what was said in the clip itself (Edit speech, your GPU only). */+ onFixLine={mode === "cloud" ? undefined : (i) => router.push(speechEditLink({ media: video.ref, kind: "video", name: video.name, cues, line: i }))}/></Panel>diff --git a/src/components/studio/mode-switch-studio.tsx b/src/components/studio/mode-switch-studio.tsxindex e8904c25..9b7c32a8 100644--- a/src/components/studio/mode-switch-studio.tsx+++ b/src/components/studio/mode-switch-studio.tsx@@ -34,6 +34,7 @@ import { SplitSoundtrackTool } from "@/components/audio-tools/split-tool";import { RemoveDialogueTool } from "@/components/audio-tools/remove-dialogue-tool";import { CleanVoiceTool } from "@/components/audio-tools/clean-voice-tool";import { DesignVoiceTool } from "@/components/audio-tools/design-voice-tool";+import { SpeechEditTool } from "@/components/audio-tools/speech-edit-tool";import { ModeStudio, ModeTabs } from "./mode-studio";import type { StudioConfig } from "./studio-context";@@ -58,7 +59,7 @@ const CONFIGS: Record<HubKind, Record<string, StudioConfig>> = {},};-/** Modes that are their own tool rather than a composer studio (Translate & dub, Loop / extend, Join, Split soundtrack, Clean up voice, Design a voice, Remove object, Remove dialogue, Evolution, Restore & colourise, Captions, Trim). */+/** Modes that are their own tool rather than a composer studio (Translate & dub, Loop / extend, Join, Split soundtrack, Clean up voice, Design a voice, Edit speech, Remove object, Remove dialogue, Evolution, Restore & colourise, Captions, Trim). */const TOOLS: Partial<Record<HubKind, Record<string, (p: { tabs: React.ReactNode }) => React.ReactNode>>> = {audio: {translate: ({ tabs }) => <DubStudio tabs={tabs} />,@@ -67,6 +68,7 @@ const TOOLS: Partial<Record<HubKind, Record<string, (p: { tabs: React.ReactNodesplit: ({ tabs }) => <SplitSoundtrackTool tabs={tabs} />,clean: ({ tabs }) => <CleanVoiceTool tabs={tabs} />,design: ({ tabs }) => <DesignVoiceTool tabs={tabs} />,+ "edit-speech": ({ tabs }) => <SpeechEditTool tabs={tabs} />,},"video-tools": {"remove-object": ({ tabs }) => <RemoveObjectTool tabs={tabs} />,diff --git a/src/components/studio/result-actions.tsx b/src/components/studio/result-actions.tsxindex 9d5ebbca..b1ab188a 100644--- a/src/components/studio/result-actions.tsx+++ b/src/components/studio/result-actions.tsx@@ -33,6 +33,7 @@ import {Sparkles,Trash2,UserRoundPlus,+ TextCursorInput,Wand2,WandSparkles,Zap,@@ -100,6 +101,7 @@ export const ACTION_ICONS: Record<OutputActionId, LucideIcon> = {"remove-dialogue": MicOff,"clean-voice": AudioWaveform,"clean-dialogue": AudioLines,+ "edit-speech": TextCursorInput,"copy-text": Copy,"view-3d": Box,download: Download,diff --git a/src/lib/hubs.ts b/src/lib/hubs.tsindex 75c418d6..c5b602c2 100644--- a/src/lib/hubs.ts+++ b/src/lib/hubs.ts@@ -18,6 +18,7 @@ export const HUB_MODES: Record<HubKind, { id: string; label: string }[]> = {{ id: "dialogue", label: "Dialogue" },{ id: "voice-change", label: "Voice change" },{ id: "design", label: "Design a voice" },+ { id: "edit-speech", label: "Edit speech" },{ id: "translate", label: "Translate" },{ id: "transcribe", label: "Transcribe" },{ id: "clean", label: "Clean up voice" },diff --git a/src/lib/licences.ts b/src/lib/licences.tsindex 645b773e..7b813622 100644--- a/src/lib/licences.ts+++ b/src/lib/licences.ts@@ -474,6 +474,13 @@ export const NODE_PACKS: NodePack[] = [url: SPDX("Apache-2.0"),note: "VoxCPM2 text to speech (voice design) and voice clone nodes; Apache-2.0 code. The VoxCPM2 weights it downloads are Apache-2.0",}),+ // Edit speech (nm10-speech-edit), pinned in workflows/comfyui/packs.json: the LICENSE file read at the pinned commit.+ pack("ComfyUI-AuK", "https://github.com/Tencent-Hunyuan/AuK/tree/0d40366b1039e37c6cad008ab4713f6ad6d954b7/comfyui/ComfyUI-AuK", {+ name: "MIT",+ class: "commercial",+ url: SPDX("MIT"),+ note: "Tencent AuK's own nodes (speech editing and text to speech); MIT code and weights. The Qwen2.5-Omni-3B encoder AuK loads is under the Qwen Research License (non-commercial)",+ }),// Genjutsu's Character swap (docs/research/openjutsu-6.md §7): Akatz Labs' packs, pinned in install-comfyui.sh.pack("h3_character_swap", "https://github.com/akatz-labs/h3-character-swap-tool/tree/0670e4fdf95adf2262caa4b81afed2a9c4ae4b7b/worker_nodes/h3_character_swap", {...GPL,diff --git a/src/lib/output-actions.ts b/src/lib/output-actions.tsindex 3239958d..62123deb 100644--- a/src/lib/output-actions.ts+++ b/src/lib/output-actions.ts@@ -37,6 +37,7 @@ export type OutputActionId =| "remove-dialogue"| "clean-voice"| "clean-dialogue"+ | "edit-speech"| "copy-text"| "view-3d"| "download"@@ -149,6 +150,8 @@ export function outputActions(g: Generation, index: number, ctx: ActionContext =if (g.feature === "upload" || (g.op && SOUNDED_VIDEO_OPS.has(g.op))) link("clean-voice", "Clean up voice", `/audio/clean?video=${q(o.url)}`);// Clean up dialogue (Split soundtrack's preset): the music and effects out from under the speech, or a cloud cleaner.if ((g.feature === "upload" || (g.op && SOUNDED_VIDEO_OPS.has(g.op))) && g.feature !== CLEAN_DIALOGUE_FEATURE) link("clean-dialogue", "Clean up dialogue", cleanDialogueHref("video", o.url));+ // Edit speech (AuK, your GPU only): change what someone says in a clip with sound.+ if ((g.feature === "upload" || (g.op && SOUNDED_VIDEO_OPS.has(g.op))) && ctx.engineMode !== "cloud") link("edit-speech", "Edit speech", `/audio/edit-speech?video=${q(o.url)}`);// A Fuobe DoP colour-grade effect: the clip opens in Color grading with its grade picked (one click to export).const dopGrade = gradeOf(o);link("grade", dopGrade ? `Apply the ${dopGrade.name} grade` : "Color grade", `/color-grade?video=${q(o.url)}${dopGrade ? `&preset=${q(dopGrade.id)}` : ""}`);@@ -164,6 +167,8 @@ export function outputActions(g: Generation, index: number, ctx: ActionContext =// Not on music or sound effects (it keeps only a voice), nor on a voice it already cleaned.if (g.op !== "music" && g.op !== "sfx" && g.feature !== CLEAN_FEATURE) link("clean-voice", "Clean up voice", `/audio/clean?audio=${q(o.url)}`);if (g.op !== "music" && g.op !== "sfx" && g.feature !== CLEAN_DIALOGUE_FEATURE) link("clean-dialogue", "Clean up dialogue", cleanDialogueHref("audio", o.url));+ // Edit speech (AuK, your GPU only): change a word, the pitch, the pace or the mood of what was said.+ if (g.op !== "music" && g.op !== "sfx" && ctx.engineMode !== "cloud") link("edit-speech", "Edit speech", `/audio/edit-speech?audio=${q(o.url)}`);break;case "text":out.push({ id: "copy-text", label: "Copy", placement: "primary" }, file, { id: "favorite", label: g.favorite ? "Unfavorite" : "Favorite", placement: "bar" });diff --git a/src/lib/speech-edit-handoff.ts b/src/lib/speech-edit-handoff.tsnew file mode 100644index 00000000..80e7808b--- /dev/null+++ b/src/lib/speech-edit-handoff.ts@@ -0,0 +1,36 @@+import type { Cue } from "./cues";++/**+ * Edit speech's handoff (nm10-speech-edit): another page ("Fix this line" in Captions) opens Audio → Edit speech with a+ * clip, its transcript and the line to fix. The transcript rides in sessionStorage (a long one doesn't fit a URL); the+ * clip's URL is in the link, and the page uses the stored lines only when they belong to that clip.+ */++export const SPEECH_EDIT_HANDOFF = "fuobe:speech-edit";++export interface SpeechEditHandoff {+ media: string;+ kind: "audio" | "video";+ name?: string;+ cues: Cue[];+ line?: number;+}++/** Store the handoff and return the link that reads it. */+export function speechEditLink(h: SpeechEditHandoff): string {+ try {+ sessionStorage.setItem(SPEECH_EDIT_HANDOFF, JSON.stringify(h));+ } catch {}+ return `/audio/edit-speech?${h.kind}=${encodeURIComponent(h.media)}&from=handoff`;+}++/** The handoff for this clip, when the link says there is one and it is this clip's. */+export function readSpeechEditHandoff(media: string, search: URLSearchParams): SpeechEditHandoff | null {+ if (search.get("from") !== "handoff") return null;+ try {+ const h = JSON.parse(sessionStorage.getItem(SPEECH_EDIT_HANDOFF) ?? "null") as SpeechEditHandoff | null;+ return h?.media === media && Array.isArray(h.cues) ? h : null;+ } catch {+ return null;+ }+}diff --git a/src/lib/speech-edit.ts b/src/lib/speech-edit.tsindex c12e885e..281a1c59 100644--- a/src/lib/speech-edit.ts+++ b/src/lib/speech-edit.ts@@ -396,7 +396,7 @@ export function planTextWindows(input: PlanInput, changes: TextChange[]): Speechconst w = windowAround(s, e, cuts, duration, budget);return { c, s, e, w, delta };};- let list = [...changes].sort((a, b) => a.from - b.from || a.to - b.to).map(build);+ const list = [...changes].sort((a, b) => a.from - b.from || a.to - b.to).map(build);// Merge neighbours whose windows overlap or leave no room for two seams between them.for (let k = 0; k < list.length - 1; ) {const [p, n] = [list[k], list[k + 1]];diff --git a/src/server/assist/agent.ts b/src/server/assist/agent.tsindex c9ce2dbb..29a17536 100644--- a/src/server/assist/agent.ts+++ b/src/server/assist/agent.ts@@ -705,7 +705,7 @@ How you work:- Call generate (or create_storyboard) directly. The app shows the user a plan card with the cost and runs it when they approve — never ask "shall I go ahead?" in text.- For multi-step work (an image, then animate it; transcribe, translate, then voice it), put the steps in one generate call and set "after" on each later job: it starts by itself when the earlier job finishes and gets its result as input. When you need to judge a result before deciding the next step, wait with check_generations instead (look=true to see images) and pass the output URL into the next call.- Besides images, video and audio, models can transcribe speech, translate or write text (scripts, captions, ad copy), split images into layers, separate voice from background, trim, caption or re-sound clips, and turn an image into a 3D model: search_models with kind "text" or "model3d" finds the text and 3D ones.-- Whole studio jobs have their own tools, and each job opens in its studio, where the user can carry on: split_layers (a Layers project), restyle_footage (a Shorts Studio session), dub_video (a dub the user reviews line by line in Translate & dub), faceless_episode (a Faceless Studio episode), create_ads (an Ads Studio batch), add_captions (the Captions editor), restore_video (old or black-and-white footage restored and colourised, in Restore & colourise), blockout_film (a grey-box 3D blockout from Blender or any 3D app filmed from reference stills and timed beats, as Cinema's Blockout does; in the Library) and katana (a reference edit — a 1–30 s video — rebuilt shot for shot with the user's own subject from 1–5 photos, when they want "this edit, but with me / my product"). Use them instead of chaining those steps by hand; once one starts, say which studio it's in (the chat links to it).+- Whole studio jobs have their own tools, and each job opens in its studio, where the user can carry on: split_layers (a Layers project), restyle_footage (a Shorts Studio session), dub_video (a dub the user reviews line by line in Translate & dub), faceless_episode (a Faceless Studio episode), create_ads (an Ads Studio batch), add_captions (the Captions editor), restore_video (old or black-and-white footage restored and colourised, in Restore & colourise), blockout_film (a grey-box 3D blockout from Blender or any 3D app filmed from reference stills and timed beats, as Cinema's Blockout does; in the Library), edit_speech (a word, the pitch, pace, mood or noise of a recording or video changed without re-recording it, on the user's GPU; pass the transcript's timed lines) and katana (a reference edit — a 1–30 s video — rebuilt shot for shot with the user's own subject from 1–5 photos, when they want "this edit, but with me / my product"). Use them instead of chaining those steps by hand; once one starts, say which studio it's in (the chat links to it).- Use the user's files by the URLs listed in their message. Earlier outputs are found with list_recent. Saved characters and products are Elements: check list_elements and write their @handle in prompts.- Results show up in the chat by themselves, so don't repeat URLs back. After starting jobs, say briefly what's coming; after they finish, give a short take and suggest a next step.- Be brief and friendly. Plain sentences, no headings. Prices are estimates in USD; open-source models run free on the user's own GPU.diff --git a/src/server/assist/studio-tools.ts b/src/server/assist/studio-tools.tsindex 81010ff9..1dc53a3d 100644--- a/src/server/assist/studio-tools.ts+++ b/src/server/assist/studio-tools.ts@@ -18,6 +18,8 @@ import { db } from "../db";import { chooseRoute, ConnectComfyError, createGenerations, outputKind, previewChained } from "../generations";import { isOffered } from "../model-access";import { engineMode } from "../settings";+import { storedMedia } from "../storage";+import { EMOTIONS, PACES, PITCH_STEPS, planSpeechEdit, VOLUME_STEPS, CLOUD_ONLY_SPEECH_EDIT_PROBLEM, type SpeechEffect } from "@/lib/speech-edit";import { fileUrl, saveFile } from "../storage";import { defineTool, type JobPlace, type ToolContext, type ToolOutcome } from "./define";@@ -771,7 +773,95 @@ const blockoutFilm = defineTool({},});-export const STUDIO_TOOLS = [splitLayers, restyleFootage, dubVideo, facelessEpisode, createAds, addCaptions, restoreVideo, blockoutFilm];+// ---------------------------------------------------------------------------+// Edit speech (nm10-speech-edit): Tencent AuK on your GPU++const SpeechEditInput = z.object({+ media: ref.describe("The recording (or video) whose speech to change."),+ kind: z.enum(["audio", "video"]).describe("audio, or video (its sound is edited and put back on the picture, copied as it is)."),+ transcript: z+ .array(z.object({ start: z.number().min(0), end: z.number().min(0), text: z.string() }))+ .min(1)+ .max(2000)+ .describe("Its transcript as timed lines (seconds), e.g. the cues of a transcribe result on this file."),+ changes: z+ .array(z.object({ line: z.number().int().min(0).describe("The line's index in transcript."), text: z.string().describe("What the line should say now.") }))+ .optional()+ .describe("Word edits: the lines that should say something else. Only the changed words are re-spoken, in the same voice."),+ effect: z+ .object({+ kind: z.enum(["pitch", "pace", "volume", "emotion", "whisper", "unwhisper", "clean", "isolate"]),+ semitones: z.number().int().optional().describe(`pitch: one of ${PITCH_STEPS.join(", ")}.`),+ speed: z.number().optional().describe(`pace: one of ${PACES.join(", ")}.`),+ db: z.number().int().optional().describe(`volume: one of ${VOLUME_STEPS.join(", ")}.`),+ emotion: z.enum(EMOTIONS as [string, ...string[]]).optional().describe("emotion: the new mood."),+ })+ .optional()+ .describe("Instead of word edits: change how a range sounds (clean = remove noise and room echo; isolate = keep only the speaker of that range)."),+ range: z.object({ start: z.number().min(0), end: z.number().min(0) }).optional().describe("The range (seconds) the effect changes."),+ quality: z.enum(["fast", "best"]).optional().describe("fast (default): AuK-Flash, 4 steps; best: the full AuK model, 32 steps."),+});+export type SpeechEditToolInput = z.infer<typeof SpeechEditInput>;++/** The tool's arguments as an Edit speech run (one AuK job; on a video, the stream-copy mux too). Throws what's missing. */+export function speechEditSteps(i: SpeechEditToolInput): PipelineStep[] {+ if (engineMode() === "cloud") throw new Error(CLOUD_ONLY_SPEECH_EDIT_PROBLEM);+ // The file's length from its header when it can be read (the run checks the file itself); else the transcript's.+ const info = storedMedia(i.media, { allContainers: true });+ const seconds = info?.info?.duration && info.info.duration > 0 ? info.info.duration : undefined;+ const cues = i.transcript;+ const edited = i.changes?.length ? cues.map((c, k) => i.changes!.filter((x) => x.line === k).pop()?.text ?? c.text) : undefined;+ let effect: SpeechEffect | undefined;+ if (i.effect) {+ const e = i.effect;+ const bad = (what: string) => new Error(`Pick ${what} for the ${e.kind} effect`);+ if (e.kind === "pitch") {+ if (!(PITCH_STEPS as readonly number[]).includes(e.semitones ?? NaN)) throw bad(`semitones (${PITCH_STEPS.join(", ")})`);+ effect = { kind: "pitch", semitones: e.semitones as (typeof PITCH_STEPS)[number] };+ } else if (e.kind === "pace") {+ if (!(PACES as readonly number[]).includes(e.speed ?? NaN)) throw bad(`a speed (${PACES.join(", ")})`);+ effect = { kind: "pace", speed: e.speed as (typeof PACES)[number] };+ } else if (e.kind === "volume") {+ if (!(VOLUME_STEPS as readonly number[]).includes(e.db ?? NaN)) throw bad(`decibels (${VOLUME_STEPS.join(", ")})`);+ effect = { kind: "volume", db: e.db as (typeof VOLUME_STEPS)[number] };+ } else if (e.kind === "emotion") {+ if (!e.emotion) throw bad("an emotion");+ effect = { kind: "emotion", emotion: e.emotion as Extract<SpeechEffect, { kind: "emotion" }>["emotion"] };+ } else effect = { kind: e.kind };+ }+ const plan = planSpeechEdit({ engine: "open", media: i.media, kind: i.kind, cues, edited: effect ? undefined : edited, effect, range: i.range, quality: i.quality, seconds, hasAudio: info?.info?.hasAudio });+ return plan.steps.map((s) => ({ key: s.key, request: s.request, ...(s.after && { after: s.after }), ...(s.chain && { chain: s.chain }) }));+}++const editSpeech = defineTool({+ name: "edit_speech",+ description:+ "Change what was said in a recording or a video without re-recording it — Fuobe's Edit speech (Audio → Edit speech), with Tencent AuK on your GPU (open source; it isn't hosted in the cloud). " ++ "Pass the file, its transcript (timed lines, e.g. a transcribe result's cues) and either changes (lines that should say something else: only the changed words are re-spoken, in the same voice, and crossfaded back) " ++ "or an effect on a range (pitch, pace, volume, emotion, whisper, clean up noise and echo, keep only one speaker). A video gets its new sound back with the picture copied. English and Chinese speech. Gated by the same approval card as generate.",+ schema: SpeechEditInput,+ gated: true,+ title: (i) => (i.effect ? `Edit speech: ${i.effect.kind}` : "Edit speech"),+ place: () => ({ studio: "Edit speech", href: "/audio/edit-speech" }),+ plan: (i) => {+ try {+ return planSteps("edit_speech", speechEditSteps(i));+ } catch (e) {+ return [{ tool: "edit_speech", modelId: "oss-auk", modelName: "AuK", kind: "audio", op: "speech-edit", prompt: "Edit speech", note: "Edit speech", count: 0, costUsd: 0, demo: false, atomic: true, error: (e as Error).message }];+ }+ },+ async run(i) {+ let steps: PipelineStep[];+ try {+ steps = speechEditSteps(i);+ } catch (e) {+ return { content: JSON.stringify({ error: (e as Error).message }), isError: true };+ }+ return startPipeline("Edit speech", steps, String(steps[0].request.batchTitle ?? "Edit speech"));+ },+});++export const STUDIO_TOOLS = [splitLayers, restyleFootage, dubVideo, facelessEpisode, createAds, addCaptions, restoreVideo, blockoutFilm, editSpeech];/** For tests: the fallback pipelines, as they would be created. */export const fallbackSteps = { restore: restoreSteps, layers: layerSteps, restyle: restyleSteps, dub: dubSteps, faceless: facelessSteps, captions: captionSteps, ads: adRequests, blockout: blockoutSteps };diff --git a/src/server/gpu/tools.ts b/src/server/gpu/tools.tsindex 3df51115..4794708e 100644--- a/src/server/gpu/tools.ts+++ b/src/server/gpu/tools.ts@@ -227,6 +227,9 @@ export const STUDIO_ROWS: StudioRowDef[] = [// Design a voice (nm10-voice-design): Qwen3-TTS designs the takes and clones the one saved (VoxCPM2 is the other choice).{ href: "/audio/design", label: "Design a voice", group: "Audio", steps: [{ modelId: "oss-qwen3-tts", op: "voice-design" }, { modelId: "oss-qwen3-tts", op: "tts" }] },{ href: "/audio/transcribe", label: "Transcribe", group: "Audio", config: S.TRANSCRIBE_STUDIO },+ // Edit speech (nm10-speech-edit): Qwen3-ASR times the words, AuK re-speaks the changed parts (a video's sound goes back on+ // the picture with the stream-copy mux).+ { href: "/audio/edit-speech", label: "Edit speech", group: "Audio", steps: [{ modelId: "oss-qwen3-asr", op: "transcribe" }, { modelId: "oss-auk", op: "speech-edit" }] },// DBS soundtrack separation (D1): dialogue, music and effects.{ href: "/audio/split", label: "Split soundtrack", group: "Audio", steps: [{ modelId: SPLIT_MODEL, op: "separate-audio" }] },// Clean up dialogue (DBS D5, Split soundtrack's preset): graph C's remix, and the stream-copy mux for a video.diff --git a/src/server/mcp.ts b/src/server/mcp.tsindex 8965f88c..4cb559ac 100644--- a/src/server/mcp.ts+++ b/src/server/mcp.ts@@ -21,7 +21,7 @@ const INSTRUCTIONS ="Fuobe is an AI image, video and audio studio (paid cloud models and open-source ComfyUI workflows); it also transcribes, translates and writes text and turns images into 3D models. " +"Look up models with search_models (kinds image, video, audio, text, model3d), price a plan with estimate_cost and tell the user the cost before you call generate or create_storyboard. " +'Chain steps in one generate call with "after" (a still, then animate it). ' +- "Whole studio jobs have their own tools (split_layers, restyle_footage, dub_video, faceless_episode, create_ads, add_captions, restore_video, and katana, which rebuilds a 1–30 s reference edit shot for shot with the user's own subject from 1–5 photos): price them with estimate_job first. " ++ "Whole studio jobs have their own tools (split_layers, restyle_footage, dub_video, faceless_episode, create_ads, add_captions, restore_video, edit_speech, which changes what was said in a recording on the user's GPU, and katana, which rebuilds a 1–30 s reference edit shot for shot with the user's own subject from 1–5 photos): price them with estimate_job first. " +"Each studio job opens in that Fuobe studio (a Layers project, a Shorts session, a dub to review, a Faceless episode, an Ads Studio batch, the Captions editor, Katana): the result's href is its page on this Fuobe server, so give the user that link; a call the studio can't take runs as plain steps and says why. " +"Skills are playbooks for kinds of jobs (product photos, UGC videos, thumbnails…): list_skills, then load_skill to read one — they're also offered as prompts. " +"A skill that runs by itself (list_skills marks it and names its inputs) runs with run_skill and values for those inputs, the same steps every time: price it with estimate_job first. " +diff --git a/tests/assist-context.test.ts b/tests/assist-context.test.tsindex 8ab60932..561e80ae 100644--- a/tests/assist-context.test.ts+++ b/tests/assist-context.test.ts@@ -378,7 +378,13 @@ describe("studio tools", () => {{ video, seconds: 8, beats: [{ start: 0, label: "Arrival", words: "She walks in." }] },{ video, seconds: 40, beats: [{ start: 0, label: "Arrival" }, { start: 20, label: "Lights out" }], references: [{ url: image, role: "character", name: "Mara" }], model: "minimax-h3-max-3d", sounds: ["Footsteps"] },],+ edit_speech: [+ { media: video, kind: "video", transcript: [{ start: 0, end: 2.4, text: "We open on Tuesday." }, { start: 3, end: 5, text: "Everyone is welcome." }], changes: [{ line: 0, text: "We open on Thursday." }] },+ { media: video, kind: "video", transcript: [{ start: 0, end: 2.4, text: "We open on Tuesday." }], effect: { kind: "pitch", semitones: 2 }, range: { start: 0, end: 2.4 } },+ ],};+ /** Tools that run on your GPU only: "Paid APIs only" refuses them on the card, with the reason. */+ const OPEN_ONLY = new Set(["edit_speech"]);it("every studio tool plans without errors on both engines in demo mode", () => {expect(Object.keys(SAMPLES).sort()).toEqual(studio.STUDIO_TOOLS.map((t) => t.name).sort());@@ -389,6 +395,10 @@ describe("studio tools", () => {for (const input of inputs)for (const engine of ["cloud", "open"] as const) {const p = plan(name, input, engine);+ if (OPEN_ONLY.has(name) && mode === "cloud") {+ expect(p.jobs.find((j) => j.error)?.error ?? p.error, `${name} ${engine}/${mode}`).toMatch(/runs on your GPU/);+ continue;+ }expect(p.error, `${name} ${engine}/${mode}`).toBeUndefined();expect(p.jobs.length, `${name} ${engine}/${mode}`).toBeGreaterThan(0);for (const j of p.jobs) expect(j.error, `${name} ${engine}/${mode}: ${j.modelId}`).toBeUndefined();diff --git a/tests/speech-edit-comfy.test.ts b/tests/speech-edit-comfy.test.tsindex 871a0f79..a195c031 100644--- a/tests/speech-edit-comfy.test.ts+++ b/tests/speech-edit-comfy.test.ts@@ -122,7 +122,7 @@ describe("what the ComfyUI provider binds", () => {op,upload: async (_b: Buffer, _t: string, name: string) => name,device: async () => device,- media: () => ({ duration }),+ media: () => ({ duration, container: "wav" as const, hasVideo: false, hasAudio: true }),});it("rebuilds the windows from params.extra, on the GPU's device, with the fade-in it writes", async () => {diff --git a/tests/speech-edit-server.test.ts b/tests/speech-edit-server.test.tsnew file mode 100644index 00000000..0ecb8e30--- /dev/null+++ b/tests/speech-edit-server.test.ts@@ -0,0 +1,201 @@+import fs from "node:fs";+import os from "node:os";+import path from "node:path";+import { afterAll, afterEach, beforeAll, describe, expect, it } from "vitest";+import { NextRequest } from "next/server";++/**+ * Edit speech on the server (nm10-speech-edit): POST /api/audio-tools tool "speech-edit" in demo mode, the open-engine+ * rule (Engine mode "Paid APIs only" refuses it), the public sign-up rules for its price check and run, Assist / MCP's+ * edit_speech, the ⋯ menu's link, the licence row and the GPU pre-flight board's row.+ */++const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-speech-edit-server-"));+process.env.FUOBE_DATA_DIR = dir;+process.env.COMFYUI_URL = "http://127.0.0.1:9";+process.env.OLLAMA_URL = "http://127.0.0.1:9";+delete process.env.FUOBE_PASSWORD;+delete process.env.FUOBE_PUBLIC_SIGNUP;+const auth = await import("@/server/auth");+const { proxy } = await import("@/proxy");+const { setSetting } = await import("@/server/settings");+const { saveFile } = await import("@/server/storage");+const gens = await import("@/server/generations");+const route = await import("@/app/api/audio-tools/route");+const { STUDIO_ROWS, studioTool } = await import("@/server/gpu/tools");+const { outputActions } = await import("@/lib/output-actions");+const { getModel } = await import("@/lib/catalog");+const { NODE_PACKS } = await import("@/lib/licences");+const { handleMcp } = await import("@/server/mcp");++beforeAll(() => setSetting("demoMode", "on"));+afterEach(() => {+ delete process.env.FUOBE_PUBLIC_SIGNUP;+ setSetting("engineMode", "both");+});+afterAll(() => {+ try {+ fs.rmSync(dir, { recursive: true, force: true });+ } catch {}+});++function wav(name = "take.wav", accountId?: string, seconds = 9): string {+ const rate = 8000;+ const n = rate * seconds;+ const b = Buffer.alloc(44 + n * 2);+ b.write("RIFF", 0);+ b.writeUInt32LE(36 + n * 2, 4);+ b.write("WAVEfmt ", 8);+ b.writeUInt32LE(16, 16);+ b.writeUInt16LE(1, 20);+ b.writeUInt16LE(1, 22);+ b.writeUInt32LE(rate, 24);+ b.writeUInt32LE(rate * 2, 28);+ b.writeUInt16LE(2, 32);+ b.writeUInt16LE(16, 34);+ b.write("data", 36);+ b.writeUInt32LE(n * 2, 40);+ return saveFile({ data: b, contentType: "audio/wav", name, source: "upload", ...(accountId && { accountId }) }).url;+}++const CUES = [+ { start: 0.2, end: 2.4, text: "We open the new studio" },+ { start: 3, end: 4.8, text: "on Tuesday morning." },+ { start: 5.5, end: 8.6, text: "Everyone is welcome to come along." },+];+const body = (media: string, extra: Record<string, unknown> = {}) => ({ tool: "speech-edit", engine: "open", media, kind: "audio", name: "Take", cues: CUES, edited: [CUES[0].text, "on Thursday morning.", CUES[2].text], ...extra });+function call(url: string, b: unknown, cookie?: string) {+ return new Request(`http://localhost:3000${url}`, { method: "POST", headers: { "Content-Type": "application/json", ...(cookie && { cookie: `${auth.SESSION_COOKIE}=${cookie}` }) }, body: JSON.stringify(b) });+}++describe("POST /api/audio-tools speech-edit (demo mode)", () => {+ it("prices a word edit as free on your GPU and runs it into the Library as one track", async () => {+ const media = wav();+ const p = await (await route.POST(call("/api/audio-tools?preview=1", body(media)))).json();+ expect(p).toMatchObject({ steps: 1, costUsd: 0, demo: true });+ expect(p.summary).toMatch(/re-spoken by AuK in the same voice/);+ const res = await route.POST(call("/api/audio-tools", body(media)));+ expect(res.status).toBe(201);+ const run = await res.json();+ expect(run.result).toMatchObject({ modelId: "oss-auk", op: "speech-edit", feature: "speech-edit" });+ expect(run.result.request.params.extra.speechWindows[0].instruction).toBe("Replace 'Tuesday' with 'Thursday'.");+ const deadline = Date.now() + 15_000;+ let g = gens.getGeneration(run.result.id)!;+ while (g.status !== "succeeded" && g.status !== "failed" && Date.now() < deadline) {+ await new Promise((r) => setTimeout(r, 200));+ g = gens.getGeneration(run.result.id)!;+ }+ expect(g.status).toBe("succeeded");+ expect(g.outputs.filter((o) => o.kind === "audio")).toHaveLength(1);+ }, 30_000);++ it("prices an effect on a range, and says what's missing in words", async () => {+ const media = wav();+ const fx = await (await route.POST(call("/api/audio-tools?preview=1", body(media, { edited: undefined, range: { start: 0, end: 4.8 }, effect: { kind: "pitch", semitones: 2 } })))).json();+ expect(fx).toMatchObject({ steps: 1, costUsd: 0 });+ const same = await route.POST(call("/api/audio-tools?preview=1", body(media, { edited: CUES.map((c) => c.text) })));+ expect(same.status).toBe(422);+ expect((await same.json()).error).toMatch(/Nothing changed/);+ const odd = await route.POST(call("/api/audio-tools?preview=1", body(media, { edited: undefined, range: { start: 0, end: 4 }, effect: { kind: "pitch", semitones: 7 } })));+ expect(odd.status).toBe(400);+ expect((await odd.json()).error).toBe("Pick one of the offered settings for the effect");+ const none = await route.POST(call("/api/audio-tools?preview=1", { ...body(media), cues: [] }));+ expect((await none.json()).error).toBe("Transcribe the recording first, then edit its lines");+ });++ it("runs on your GPU only: the cloud engine and Paid APIs only say so", async () => {+ const media = wav();+ const cloud = await route.POST(call("/api/audio-tools?preview=1", body(media, { engine: "cloud" })));+ expect(cloud.status).toBe(422);+ expect((await cloud.json()).error).toMatch(/runs on your GPU \(open source\): AuK isn't hosted on fal or Replicate/);+ setSetting("engineMode", "cloud");+ const paid = await route.POST(call("/api/audio-tools?preview=1", body(media)));+ expect((await paid.json()).error).toMatch(/set to paid cloud APIs only/);+ });++ it("a video gets its new sound back on the picture", async () => {+ const media = wav("clip.wav");+ const p = await (await route.POST(call("/api/audio-tools?preview=1", body(media, { kind: "video" })))).json();+ expect(p.steps).toBe(2);+ expect(p.notes.join(" ")).toMatch(/Lipsync/);+ });+});++describe("public sign-up", () => {+ const passed = (r: Response) => r.headers.get("x-middleware-next") === "1";+ const req = (url: string, cookie?: string) =>+ new NextRequest(`http://localhost:3000${url}`, { method: "POST", headers: cookie ? { cookie: `${auth.SESSION_COOKIE}=${cookie}` } : {}, body: "{}" });+ let n = 0;+ const newAccount = () => auth.createAccount(`speech${++n}@example.com`, "long enough");++ it("prices a visitor's edit on its own GPU, never a demo, and only of its own file; the run is own-gpu-tool for an account", async () => {+ process.env.FUOBE_PUBLIC_SIGNUP = "1";+ auth.setPassword("install password");+ const who = newAccount();+ const cookie = auth.createSession(who.id).value;+ // Through the sign-in proxy: the price check passes, the run is refused as a tool (it would use the studio's GPU).+ expect(passed(proxy(req("/api/audio-tools?preview=1", cookie)))).toBe(true);+ const run = proxy(req("/api/audio-tools", cookie));+ expect(run.status).toBe(403);+ expect((await run.json()).code).toBe("own-gpu-tool");+ // The owner's file answers a guest and an account as one that's gone.+ const owners = wav("owners.wav");+ for (const c of [undefined, cookie]) {+ const r = await route.POST(call("/api/audio-tools?preview=1", body(owners), c));+ expect(r.status).toBe(422);+ expect((await r.json()).error).toBe("That recording is gone — add it again");+ }+ const mine = await route.POST(call("/api/audio-tools?preview=1", body(wav("mine.wav", who.id)), cookie));+ expect(await mine.json()).toMatchObject({ steps: 1, costUsd: 0, demo: false });+ });+});++describe("Assist and MCP's edit_speech", () => {+ const rpc = (method: string, params?: unknown) => handleMcp({ jsonrpc: "2.0", id: 1, method, params });+ const args = (media: string) => ({ media, kind: "audio", transcript: CUES, changes: [{ line: 1, text: "on Thursday morning." }] });++ it("is listed with its schema, priced with estimate_job and runs as a pipeline in demo mode", async () => {+ const list = (await rpc("tools/list")) as { result: { tools: { name: string; inputSchema: { properties: Record<string, unknown>; required: string[] }; description: string }[] } };+ const t = list.result.tools.find((x) => x.name === "edit_speech")!;+ expect(t).toBeTruthy();+ expect(Object.keys(t.inputSchema.properties).sort()).toEqual(["changes", "effect", "kind", "media", "quality", "range", "transcript"]);+ expect(t.inputSchema.required.sort()).toEqual(["kind", "media", "transcript"]);+ expect(t.description).toMatch(/estimate_job/);+ const media = wav();+ const est = (await rpc("tools/call", { name: "estimate_job", arguments: { tool: "edit_speech", arguments: args(media) } })) as { result: { structuredContent: { jobs: { modelId: string; op: string; error?: string }[] } } };+ expect(est.result.structuredContent.jobs).toMatchObject([{ modelId: "oss-auk", op: "speech-edit" }]);+ expect(est.result.structuredContent.jobs[0].error).toBeUndefined();+ const out = (await rpc("tools/call", { name: "edit_speech", arguments: args(media) })) as { result: { isError: boolean; content: { text: string }[] } };+ expect(out.result.isError).toBe(false);+ expect(JSON.parse(out.result.content[0].text).steps).toHaveLength(1);+ // An effect with a value AuK doesn't take is refused on the card.+ const bad = (await rpc("tools/call", { name: "estimate_job", arguments: { tool: "edit_speech", arguments: { media, kind: "audio", transcript: CUES, effect: { kind: "pitch", semitones: 9 }, range: { start: 0, end: 4 } } } })) as {+ result: { structuredContent: { jobs: { error?: string }[] } };+ };+ expect(bad.result.structuredContent.jobs[0].error).toMatch(/semitones/);+ });+});++describe("where Edit speech shows up", () => {+ it("in the ⋯ menu of speech results, never in Paid APIs only, and not on music", () => {+ const g = (op: string, kind: "audio" | "video", feature = "studio") =>+ ({ id: "g", op, feature, status: "succeeded", favorite: false, engine: "open", request: { modelId: "m", op }, outputs: [{ url: "/api/files/x.wav", kind }] }) as never;+ const has = (x: ReturnType<typeof outputActions>) => x.find((a) => a.id === "edit-speech");+ expect(has(outputActions(g("tts", "audio"), 0))?.href).toBe(`/audio/edit-speech?audio=${encodeURIComponent("/api/files/x.wav")}`);+ expect(has(outputActions(g("music", "audio"), 0))).toBeUndefined();+ expect(has(outputActions(g("tts", "audio"), 0, { engineMode: "cloud" }))).toBeUndefined();+ expect(has(outputActions(g("lipsync", "video"), 0))?.href).toMatch(/^\/audio\/edit-speech\?video=/);+ });++ it("has its model, licence and a row on the GPU pre-flight board", () => {+ const m = getModel("oss-auk")!;+ expect(m.routes.map((r) => [r.op, r.endpoint])).toEqual([+ ["speech-edit", "speech-edit-auk"],+ ["tts", "speech-tts-auk"],+ ]);+ expect(NODE_PACKS.find((p) => p.name === "ComfyUI-AuK")?.licence).toMatchObject({ name: "MIT", class: "commercial" });+ const row = STUDIO_ROWS.find((r) => r.href === "/audio/edit-speech")!;+ expect(row).toMatchObject({ label: "Edit speech", group: "Audio" });+ expect(studioTool(row)!.workflows).toEqual(expect.arrayContaining(["speech-edit-auk"]));+ });+});diff --git a/workflows/comfyui/manifest.json b/workflows/comfyui/manifest.jsonindex 7592a0a2..b2d33885 100644--- a/workflows/comfyui/manifest.json+++ b/workflows/comfyui/manifest.json@@ -1,6 +1,6 @@{"version": 1,- "generatedAt": "2026-11-02T15:31:11.087Z",+ "generatedAt": "2026-11-02T15:38:23.909Z","comfyuiCommit": "fc04da91b2ab12f99e4716371a7e4f98ac982597","comfyuiVersion": "0.41.0","workflowTemplatesVersion": "0.11.86",@@ -7302,7 +7302,7 @@}],"vramGb": 24,- "license": "AuK code and weights MIT (Tencent); its Qwen2.5-Omni-3B encoder Qwen Research License (non-commercial)",+ "license": "AuK code and weights MIT (Tencent); its Qwen2.5-Omni-3B encoder Qwen Research License (NON-COMMERCIAL)","validated": false,"notes": "The recording (a video upload works: LoadAudio reads its soundtrack) and the edit windows Fuobe plans (params.extra.speechWindows: start, end, instruction, seconds). The graph is rebuilt for every window in one prompt: each window is cut with TrimAudioDuration, edited by AuKGenerateEdit (one shared AuKModelLoader) and crossfaded back over its first and last 0.12 s as a + (b − a) × fade-in, with the linear fade-in Fuobe writes (fadeCurve: the ramp, then a flat tail AudioMerge trims off). The recording and each edit are first brought to one rate (merged with silence at the other's: AuK speaks at 24 kHz), so no seam piece is resampled at its edges (a resampled piece tapers there: a click). Windows hold at least 1 s of untouched speech each side and are cut at silences. AuK takes a window plus its new audio up to 30 s per call (its node refuses more and does not split), so a window is at most about 14.7 s for a same-length effect. AuK-Flash by default (checkpoint ckpts/AuK-Flash/auk_flash.safetensors, 4 steps, CFG 0, sway -1); params.extra.quality \"best\" loads ckpts/AuK/auk_base.safetensors at 32 steps, CFG 2. The Prompt Enhancer is off: Fuobe writes the Cookbook instruction (Replace 'X' with 'Y'. / Add … after … / Remove …; pitch, speed, volume, emotion, whisper, enhancement and speaker extraction) and sets generation_seconds itself. device is bound to the server's first torch device (cuda:0, or cpu with fp32). AuK outputs mono, so edited windows are duplicated into a stereo recording. Peak VRAM ~25 GiB (AuK's README, A800, bf16), ~17 GiB with cpu_offload. Languages: English and Chinese (the technical report, arXiv 2609.08936: a bilingual corpus). Saves FLAC.","autoDownloads": [@@ -7367,7 +7367,7 @@}],"vramGb": 24,- "license": "AuK code and weights MIT (Tencent); its Qwen2.5-Omni-3B encoder Qwen Research License (non-commercial)",+ "license": "AuK code and weights MIT (Tencent); its Qwen2.5-Omni-3B encoder Qwen Research License (NON-COMMERCIAL)","validated": false,"notes": "Zero-shot TTS: the voice sample (audio) and the line as AuK's instruction (Say the following with the same voice: \"…\"), written by Fuobe; without a sample the loader is removed and AuK is asked for instruct TTS (Generate speech based on the following description: \"…\". The content to speak is: \"…\".) with params.voiceDescription. generation_seconds is the line's length at a speaking rate (the Prompt Enhancer that would estimate it is off). The sample plus the line fit in 30 s. AuK-Flash, 4 steps, CFG 0. Get consent for cloned voices. Saves FLAC.","autoDownloads": [