Skip to content

armgit / fuobe

Public Imported from GitHub
0

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.

Audio: Design a voice describes a voice with starter chips, plays three takes and saves the one you like as a voice for every picker

Claude1eaafd1bedec
diff --git a/src/components/audio-tools/design-voice-tool.tsx b/src/components/audio-tools/design-voice-tool.tsx
new file mode 100644
index 00000000..a176e447
--- /dev/null
+++ b/src/components/audio-tools/design-voice-tool.tsx
@@ -0,0 +1,272 @@
+"use client";
+
+import { AudioLines, Check, Loader2, Mic, RotateCcw, Save, Sparkles } from "lucide-react";
+import Link from "next/link";
+import { useMemo, useState } from "react";
+import { toast } from "sonner";
+import { Button } from "@/components/ui/button";
+import { Input } from "@/components/ui/input";
+import { Textarea } from "@/components/ui/textarea";
+import { Panel, ToolHero, ToolShell } from "@/components/av/tool-shell";
+import { useCreateGeneration, useEngine, useGenerations, useIsVisitor, useSaveElement } from "@/lib/api";
+import { getModel } from "@/lib/catalog";
+import { stepCostUsd } from "@/lib/catalog/faceless";
+import type { Generation } from "@/lib/catalog/types";
+import { toastError } from "@/lib/refusals";
+import { cn } from "@/lib/utils";
+import {
+ DEFAULT_TEST_LINE,
+ describeVoice,
+ DESIGN_MODELS,
+ designBlocker,
+ designModelFor,
+ TEST_LINE_MAX,
+ VOICE_CHIPS,
+ VOICE_FEATURE,
+ VOICE_TAKES,
+ type ChipGroup,
+ type ChipPicks,
+ type DesignModelKey,
+} from "@/lib/voice-design";
+
+/**
+ * Audio → Design a voice (nm10-voice-design): describe a voice (starter chips and your own words), hear a test line in
+ * three takes, and save the one you like as an Element voice. Qwen3-TTS runs on both engines; VoxCPM2 on your GPU only.
+ * A saved voice keeps its take, its words and its line, so later lines reuse it on either engine (src/server/voices.ts).
+ */
+
+const chip = "inline-flex h-8 shrink-0 items-center gap-1 rounded-full px-3 text-[13px] font-medium transition-colors";
+
+function money(engine: "open" | "cloud", usd: number | null): string {
+ if (engine === "open") return "Free on your GPU";
+ if (usd === null) return "Price unknown";
+ return usd < 0.01 ? "Under $0.01" : `≈ $${usd.toFixed(2)}`;
+}
+
+/** One take: play it, then save it as a voice (or, for a visitor, use it right away in Speech). */
+function Take({ g, index, description, line, canSave }: { g: Generation; index: number; description: string; line: string; canSave: boolean }) {
+ const save = useSaveElement();
+ const [naming, setNaming] = useState(false);
+ const [name, setName] = useState("");
+ const [saved, setSaved] = useState(false);
+ const url = g.outputs[0]?.url;
+ const busy = g.status === "queued" || g.status === "running";
+ const submit = () => {
+ if (!url || !name.trim()) return;
+ save.mutate(
+ {
+ name: name.trim(),
+ kind: "voice",
+ description: (g.request.params?.voiceDescription ?? description).slice(0, 500),
+ references: [url],
+ voice: { modelId: g.request.modelId, description: g.request.params?.voiceDescription ?? description, transcript: g.request.prompt ?? line },
+ },
+ {
+ onSuccess: (el) => {
+ setSaved(true);
+ setNaming(false);
+ toast.success(`Saved ${el.name}`, { description: "It’s in Elements → Voices and in every voice picker." });
+ },
+ onError: (e) => toastError(e),
+ },
+ );
+ };
+ return (
+ <li className="min-w-0 rounded-xl border bg-background p-3">
+ <div className="mb-2 flex min-w-0 items-center gap-2">
+ <span className="grid size-7 shrink-0 place-items-center rounded-full bg-brand-faint text-[12px] font-semibold text-brand-text">{index + 1}</span>
+ <p className="min-w-0 flex-1 truncate text-[13px] font-medium">Take {index + 1}</p>
+ {saved && (
+ <span className="inline-flex items-center gap-1 text-[12px] text-success">
+ <Check className="size-3.5" /> Saved
+ </span>
+ )}
+ </div>
+ {url ? (
+ <audio src={url} controls preload="metadata" className="h-9 w-full min-w-0" aria-label={`Play take ${index + 1}`} />
+ ) : busy ? (
+ <p className="flex h-9 items-center gap-2 text-[13px] text-muted-foreground" role="status">
+ <Loader2 className="size-3.5 animate-spin" /> {g.status === "queued" ? "Waiting to start…" : "Speaking…"}
+ </p>
+ ) : (
+ <p className="text-[13px] text-destructive">{g.error ?? "This take didn’t come through. Try again."}</p>
+ )}
+ {url && (
+ <div className="mt-2 flex flex-wrap items-center gap-1.5">
+ {canSave && !saved && !naming && (
+ <Button size="sm" className="rounded-full" onClick={() => setNaming(true)}>
+ <Save className="size-3.5" /> Save as voice
+ </Button>
+ )}
+ <Button asChild size="sm" variant="ghost" className="rounded-full">
+ <Link href={`/audio?voice=${encodeURIComponent(url)}`}>
+ <Mic className="size-3.5" /> Use in Speech
+ </Link>
+ </Button>
+ </div>
+ )}
+ {naming && (
+ <form
+ className="mt-2 flex min-w-0 flex-wrap items-center gap-1.5"
+ onSubmit={(e) => {
+ e.preventDefault();
+ submit();
+ }}
+ >
+ <Input value={name} onChange={(e) => setName(e.target.value)} placeholder="Name it, e.g. Old Narrator" maxLength={60} autoFocus aria-label="Voice name" className="h-8 min-w-0 flex-1 basis-40" />
+ <Button size="sm" type="submit" className="rounded-full" disabled={!name.trim() || save.isPending}>
+ {save.isPending ? <Loader2 className="size-3.5 animate-spin" /> : <Check className="size-3.5" />} Save
+ </Button>
+ <Button size="sm" type="button" variant="ghost" className="rounded-full" onClick={() => setNaming(false)}>
+ Cancel
+ </Button>
+ </form>
+ )}
+ </li>
+ );
+}
+
+export function DesignVoiceTool({ tabs }: { tabs?: React.ReactNode }) {
+ const [engine, setEngine, mode] = useEngine();
+ const visitor = useIsVisitor();
+ const create = useCreateGeneration();
+ const [picks, setPicks] = useState<ChipPicks>({});
+ const [typed, setTyped] = useState("");
+ const [line, setLine] = useState(DEFAULT_TEST_LINE);
+ const [choice, setChoice] = useState<DesignModelKey>("qwen");
+ const [batch, setBatch] = useState<string | null>(null);
+ const description = describeVoice(picks, typed);
+ // "Paid APIs only" offers no GPU models: VoxCPM2 is left out, with the reason.
+ const choices = DESIGN_MODELS.filter((m) => mode !== "cloud" || m.cloud);
+ const key = choices.some((m) => m.key === choice) ? choice : choices[0].key;
+ const modelId = designModelFor(key, engine);
+ const model = modelId ? getModel(modelId) : undefined;
+ const blocker = designBlocker(key, engine) ?? (!description ? "Describe the voice, or pick a few chips" : !line.trim() ? "Write a line for it to say" : null);
+ const usd = model ? stepCostUsd(model, { feature: VOICE_FEATURE, modelId: model.id, prompt: line }) : null;
+ const price = money(engine, usd === null ? null : usd * VOICE_TAKES);
+
+ const all = useGenerations({ features: [VOICE_FEATURE], limit: 24 });
+ const takes = useMemo(() => {
+ const items = all.data ?? [];
+ const id = batch ?? items[0]?.batchId ?? null;
+ return id ? items.filter((g) => g.batchId === id).sort((a, b) => a.createdAt - b.createdAt) : [];
+ }, [all.data, batch]);
+ const latest = takes[0];
+
+ const pick = (group: ChipGroup, option: string) => setPicks((p) => ({ ...p, [group]: p[group] === option ? undefined : option }));
+ const run = () => {
+ if (blocker || !modelId) return void toast(blocker ?? "Pick a model");
+ create.mutate(
+ {
+ feature: VOICE_FEATURE,
+ modelId,
+ engine,
+ op: "voice-design",
+ prompt: line.trim(),
+ title: "Designed voice",
+ params: { voiceDescription: description, numOutputs: VOICE_TAKES },
+ },
+ { onSuccess: (items) => setBatch(items[0]?.batchId ?? null), onError: (e) => toastError(e) },
+ );
+ };
+
+ return (
+ <ToolShell title="Audio" tabs={tabs}>
+ <ToolHero title="Design a voice" subtitle="Describe who’s speaking. Hear three takes of your line, then save the one you like as a voice you can use anywhere." />
+ <div className="mx-auto mt-8 max-w-[820px] min-w-0 space-y-3">
+ <Panel title="The voice">
+ <div className="space-y-3">
+ {VOICE_CHIPS.map((g) => (
+ <div key={g.group} className="flex min-w-0 flex-wrap items-center gap-1.5" role="group" aria-label={g.label}>
+ <span className="w-16 shrink-0 text-[12px] font-medium text-muted-foreground">{g.label}</span>
+ {g.options.map((o) => (
+ <button
+ key={o}
+ type="button"
+ aria-pressed={picks[g.group] === o}
+ onClick={() => pick(g.group, o)}
+ className={cn(chip, picks[g.group] === o ? "bg-brand-faint text-brand-text hover:bg-brand-faint-hover" : "bg-secondary text-secondary-foreground hover:bg-accent")}
+ >
+ {picks[g.group] === o && <Check className="size-3" />} {o}
+ </button>
+ ))}
+ </div>
+ ))}
+ <Textarea
+ value={typed}
+ onChange={(e) => setTyped(e.target.value.slice(0, 400))}
+ rows={2}
+ placeholder="Add your own words, e.g. “a gravelly 60-year-old narrator with a smile in his voice”"
+ aria-label="Describe the voice in your own words"
+ className="resize-none text-sm"
+ />
+ {description && (
+ <p className="rounded-lg bg-muted/60 px-3 py-2 text-[13px] text-muted-foreground">
+ <span className="font-medium text-foreground">The model hears: </span>
+ {description}
+ </p>
+ )}
+ </div>
+ </Panel>
+ <Panel title="Test line">
+ <Textarea value={line} onChange={(e) => setLine(e.target.value.slice(0, TEST_LINE_MAX))} rows={2} aria-label="Test line" className="resize-none text-sm" />
+ <p className="mt-1.5 text-[12px] text-muted-foreground">Each take says this line. The take you save keeps it, which helps later lines sound the same.</p>
+ </Panel>
+ <Panel title="Model">
+ <div className="grid gap-2 sm:grid-cols-2" role="radiogroup" aria-label="Model">
+ {choices.map((m) => {
+ const off = engine === "cloud" && !m.cloud;
+ return (
+ <button
+ key={m.key}
+ type="button"
+ role="radio"
+ aria-checked={key === m.key}
+ onClick={() => setChoice(m.key)}
+ className={cn("min-w-0 rounded-xl border p-3 text-left transition-colors hover:bg-accent", key === m.key && "border-primary bg-brand-faint hover:bg-brand-faint")}
+ >
+ <span className="flex items-center gap-2 text-[13px] font-medium">
+ <AudioLines className="size-4 shrink-0 text-brand-text" /> {m.label}
+ </span>
+ <span className={cn("mt-1 block text-[12px] text-muted-foreground", off && "text-warning")}>{m.blurb}</span>
+ </button>
+ );
+ })}
+ </div>
+ {mode === "cloud" && <p className="mt-2 text-[12px] text-muted-foreground">VoxCPM2 runs on your GPU (open source), so it isn’t offered with paid APIs only.</p>}
+ </Panel>
+ <div className="flex flex-wrap items-center gap-3 pt-1">
+ <p className={cn("min-w-0 flex-1 text-[13px]", blocker ? "text-muted-foreground" : "text-muted-foreground")} aria-live="polite">
+ {blocker ?? (
+ <>
+ {VOICE_TAKES} takes · <span className="font-mono text-foreground">{price}</span>
+ </>
+ )}
+ </p>
+ {engine === "cloud" && key === "voxcpm" && mode === "both" && (
+ <Button variant="outline" className="rounded-full" onClick={() => setEngine("open")}>
+ Use open source
+ </Button>
+ )}
+ <Button size="lg" className={cn("rounded-full", blocker && "bg-muted text-subtle-foreground hover:bg-muted")} onClick={run} disabled={create.isPending}>
+ {create.isPending ? <Loader2 className="size-4 animate-spin" /> : takes.length ? <RotateCcw className="size-4" /> : <Sparkles className="size-4" />}{" "}
+ {takes.length ? "Make 3 new takes" : "Make 3 takes"}
+ </Button>
+ </div>
+ {latest && (
+ <section aria-labelledby="voice-takes" className="pt-4">
+ <h3 id="voice-takes" className="mb-1 font-heading text-[22px]">
+ Takes
+ </h3>
+ {latest.request.params?.voiceDescription && <p className="mb-3 text-[13px] text-pretty text-muted-foreground">{latest.request.params.voiceDescription}</p>}
+ <ul className="grid gap-2 md:grid-cols-3">
+ {takes.map((g, i) => (
+ <Take key={g.id} g={g} index={i} description={description} line={line} canSave={!visitor} />
+ ))}
+ </ul>
+ </section>
+ )}
+ </div>
+ </ToolShell>
+ );
+}
diff --git a/src/components/elements-view.tsx b/src/components/elements-view.tsx
index 50ad664c..e45d3d8f 100644
--- a/src/components/elements-view.tsx
+++ b/src/components/elements-view.tsx
@@ -36,6 +36,7 @@ import { isLegacySoulId, SOUL_ID_PHOTOS } from "@/lib/catalog/training";
import { copyText } from "@/lib/clipboard";
import { cn } from "@/lib/utils";
import { toastError } from "@/lib/refusals";
+import { voiceOrigin } from "@/lib/voice-design";
const TIPS: Record<ElementKind, string> = {
character: `3+ clear photos of one person (${SOUL_ID_PHOTOS.recommended}+ to train a Soul ID, up to ${SOUL_ID_PHOTOS.max}): different angles, at least one full-body, no sunglasses, filters or group shots.`,
@@ -204,7 +205,18 @@ function ElementForm({ onOpenChange, element, defaultKind = "character", onSaved
{kind !== "voice" && photos.length > 0 && <span className="tabular-nums"> · {photos.length}/{MAX_PHOTOS}</span>}
</p>
{kind === "voice" ? (
- <VoiceSample value={photos[0]} onChange={(v) => setPhotos(v ? [{ ...v, id: nanoid(6) }] : [])} />
+ <>
+ <VoiceSample value={photos[0]} onChange={(v) => setPhotos(v ? [{ ...v, id: nanoid(6) }] : [])} />
+ {!photos[0] && (
+ <p className="text-[12px] text-muted-foreground">
+ No recording?{" "}
+ <Link href="/audio/design" className="font-medium text-brand-text underline underline-offset-2">
+ Design a voice
+ </Link>{" "}
+ from a description instead.
+ </p>
+ )}
+ </>
) : (
<PhotoGrid photos={photos} setPhotos={setPhotos} />
)}
@@ -326,6 +338,7 @@ function ElementCard({ el }: { el: StudioElement }) {
<div className="min-w-0">
<p className="truncate font-medium">{el.name}</p>
<HandleCopy handle={el.handle} />
+ {el.kind === "voice" && el.voice && <p className="truncate text-[11px] text-muted-foreground" title={el.voice.description}>{voiceOrigin(el.voice)}</p>}
</div>
<span className="mt-0.5 inline-flex shrink-0 items-center gap-1 rounded-full bg-secondary px-2 py-0.5 text-[11px] text-secondary-foreground">
<Icon className="size-3" /> {elementKindInfo(el.kind).label}
diff --git a/src/components/faceless/narrator.tsx b/src/components/faceless/narrator.tsx
index dbadbd78..a3948206 100644
--- a/src/components/faceless/narrator.tsx
+++ b/src/components/faceless/narrator.tsx
@@ -15,6 +15,7 @@ import type { Engine } from "@/lib/catalog/types";
import { cn } from "@/lib/utils";
import { toastError } from "@/lib/refusals";
import { voicePreview, waitFor } from "./hooks";
+import { voiceOrigin } from "@/lib/voice-design";
/** One shared player, so starting a sample stops the one before. */
const player = { audio: null as HTMLAudioElement | null, owner: "" };
@@ -163,7 +164,7 @@ export function NarratorList({ engine, voices, value, onChange }: { engine: Engi
<p className="px-1 pb-1.5 text-[11px] font-medium tracking-wide text-muted-foreground uppercase">{engine === "open" ? "Narrator to clone" : "Your own voice"}</p>
{engine === "open" && <p className="px-1 pb-2 text-[12px] text-muted-foreground">Open-source narration clones a voice: pick a saved voice, or record or upload 10–60 s of clean speech.</p>}
<div className="space-y-0.5">
- {saved.map((e) => row(`saved:${e.id}`, { kind: "sample", url: e.references[0], name: e.name }, e.name, e.description ?? "Saved voice", async () => e.references[0]))}
+ {saved.map((e) => row(`saved:${e.id}`, { kind: "sample", url: e.references[0], name: e.name }, e.name, voiceOrigin(e.voice) ?? e.description ?? "Saved voice", async () => e.references[0]))}
{own && row(`own:${own.url}`, own, own.name ?? "Your recording", "Recorded or uploaded", async () => own.url)}
</div>
<div className="flex flex-wrap items-center gap-1.5 px-1 pt-2">
diff --git a/src/components/studio/audio-controls.tsx b/src/components/studio/audio-controls.tsx
index 99649364..ff659128 100644
--- a/src/components/studio/audio-controls.tsx
+++ b/src/components/studio/audio-controls.tsx
@@ -8,6 +8,7 @@ import { Slider } from "@/components/ui/slider";
import { useAskBeforeUpload, useElements } from "@/lib/api";
import type { GenParams, ModelDef } from "@/lib/catalog/types";
import { cn } from "@/lib/utils";
+import { voiceOrigin } from "@/lib/voice-design";
import { fileToSlot, type SlotValue } from "./media-slot";
import { VoiceRecorder } from "./voice-recorder";
import { useMaybeClean } from "@/components/audio-tools/clean-voice-switch";
@@ -118,7 +119,7 @@ export function VoicePicker({
onClick={() => pick({ kind: "sample", value: { ref: e.references[0], preview: e.references[0], kind: "audio", name: e.name } })}
icon={<AudioLines className="size-3.5" />}
name={e.name}
- hint={e.description ?? "Saved voice"}
+ hint={voiceOrigin(e.voice) ?? e.description ?? "Saved voice"}
/>
))
) : (
diff --git a/src/components/studio/mode-switch-studio.tsx b/src/components/studio/mode-switch-studio.tsx
index b3cbf548..e8904c25 100644
--- a/src/components/studio/mode-switch-studio.tsx
+++ b/src/components/studio/mode-switch-studio.tsx
@@ -33,6 +33,7 @@ import { AudioJoinTool, AudioLoopTool } from "@/components/audio-tools/audio-too
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 { ModeStudio, ModeTabs } from "./mode-studio";
import type { StudioConfig } from "./studio-context";
@@ -57,7 +58,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, 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, 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} />,
@@ -65,6 +66,7 @@ const TOOLS: Partial<Record<HubKind, Record<string, (p: { tabs: React.ReactNode
join: ({ tabs }) => <AudioJoinTool tabs={tabs} />,
split: ({ tabs }) => <SplitSoundtrackTool tabs={tabs} />,
clean: ({ tabs }) => <CleanVoiceTool tabs={tabs} />,
+ design: ({ tabs }) => <DesignVoiceTool tabs={tabs} />,
},
"video-tools": {
"remove-object": ({ tabs }) => <RemoveObjectTool tabs={tabs} />,
diff --git a/src/lib/api.ts b/src/lib/api.ts
index 51c75b28..75da5762 100644
--- a/src/lib/api.ts
+++ b/src/lib/api.ts
@@ -786,7 +786,15 @@ export function useElement(id: string) {
export function useSaveElement() {
const qc = useQueryClient();
return useMutation({
- mutationFn: async (body: { id?: string; name: string; kind?: ElementKind; description?: string | null; references: string[] }) => {
+ mutationFn: async (body: {
+ id?: string;
+ name: string;
+ kind?: ElementKind;
+ description?: string | null;
+ references: string[];
+ /** Design a voice: the model that made the take, its words and its line (the server keeps the rest). */
+ voice?: { modelId: string; description?: string; transcript?: string };
+ }) => {
const { id, ...rest } = body;
return json<StudioElement>(
await fetch(id ? `/api/elements/${id}` : "/api/elements", {
diff --git a/src/lib/catalog/models.ts b/src/lib/catalog/models.ts
index b130108e..fa06f277 100644
--- a/src/lib/catalog/models.ts
+++ b/src/lib/catalog/models.ts
@@ -1216,6 +1216,30 @@ const open: ModelDef[] = [
routes: [comfy("tts", "tts-indextts2")],
options: { voiceClone: true },
}),
+ // Design a voice (nm10-voice-design): a new voice from words, then reused by cloning the take picked (src/server/voices.ts).
+ // Qwen3-TTS 1.7B runs the same weights on fal (qwen-3-tts); VoxCPM2 is hosted nowhere, so it runs on your GPU only.
+ o({
+ id: "oss-qwen3-tts",
+ name: "Qwen3-TTS",
+ vendor: "Alibaba Qwen",
+ family: "qwen-tts",
+ kind: "audio",
+ tagline: "Design a voice from a description, or clone one from a short sample, in 10 languages",
+ badges: ["new"],
+ routes: [comfy("voice-design", "tts-qwen3-design"), comfy("tts", "tts-qwen3-clone")],
+ options: { voiceClone: true, seed: true },
+ }),
+ o({
+ id: "oss-voxcpm2",
+ name: "VoxCPM2",
+ vendor: "OpenBMB",
+ family: "voxcpm",
+ kind: "audio",
+ tagline: "Design or clone a voice in studio-quality 48 kHz, in 30 languages",
+ badges: ["new"],
+ routes: [comfy("voice-design", "tts-voxcpm2"), comfy("tts", "tts-voxcpm2-clone")],
+ options: { voiceClone: true, seed: true },
+ }),
o({
id: "oss-chatterbox-dialogue",
name: "Chatterbox Dialogue",
diff --git a/src/lib/hubs.ts b/src/lib/hubs.ts
index 1b3161c3..75c418d6 100644
--- a/src/lib/hubs.ts
+++ b/src/lib/hubs.ts
@@ -17,6 +17,7 @@ export const HUB_MODES: Record<HubKind, { id: string; label: string }[]> = {
{ id: "speech", label: "Speech" },
{ id: "dialogue", label: "Dialogue" },
{ id: "voice-change", label: "Voice change" },
+ { id: "design", label: "Design a voice" },
{ 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.ts
index e67a17f0..c7a9494b 100644
--- a/src/lib/licences.ts
+++ b/src/lib/licences.ts
@@ -463,6 +463,17 @@ export const NODE_PACKS: NodePack[] = [
url: SPDX("Apache-2.0"),
note: "Zen Image Edit's adapter loader and text encode: Qwen-Image 2.1 on the Qwen3.5-0.8B encoder (Apache-2.0) and a fusion adapter. The adapter and the Qwen-Image 2.1 weights are non-commercial (Qwen Research License)",
}),
+ // Design a voice (nm10-voice-design), pinned in workflows/comfyui/packs.json: LICENSE files read at the pinned commits.
+ pack("ComfyUI-QwenTTS", "https://github.com/1038lab/ComfyUI-QwenTTS/tree/d8122a8ba835b65fd65c113d2b273b1ad1579293", {
+ ...GPL,
+ note: "Qwen3-TTS voice design and voice clone nodes; GPL-3.0 code. The Qwen3-TTS 1.7B weights it downloads are Apache-2.0",
+ }),
+ pack("ComfyUI-VoxCPM2", "https://github.com/Saganaki22/ComfyUI-VoxCPM2/tree/0e52a6cd006769e030d0e1ae907ffebbbfac4f5f", {
+ name: "Apache-2.0",
+ class: "commercial",
+ 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",
+ }),
// 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/voice-design.ts b/src/lib/voice-design.ts
new file mode 100644
index 00000000..2fa7599f
--- /dev/null
+++ b/src/lib/voice-design.ts
@@ -0,0 +1,104 @@
+/**
+ * Audio → Design a voice (nm10-voice-design): a voice made from words, heard in three takes, and the take you like saved
+ * as an Element voice. Pure data and logic (client and server): the starter chips, the description they write, which
+ * model runs on which engine, and how a saved voice reads in a voice picker.
+ *
+ * Qwen3-TTS 1.7B runs on both engines (oss-qwen3-tts on your GPU, qwen-3-tts hosted on fal); VoxCPM2 is hosted nowhere,
+ * so it runs on your GPU only. A saved voice keeps the take as its clip: any model that clones a voice reuses it, and
+ * fal's Qwen3-TTS clones it once into an embedding file it keeps (src/server/voices.ts).
+ */
+import { VOICE_DESCRIPTION_MAX, type ElementVoice } from "./catalog/elements";
+import type { Engine } from "./catalog/types";
+
+/** Takes per run: three to pick from. */
+export const VOICE_TAKES = 3;
+export const VOICE_FEATURE = "voice-design";
+export const DEFAULT_TEST_LINE = "Hello there. This is how I sound, and I can't wait to tell your story.";
+export const TEST_LINE_MAX = 300;
+
+export type ChipGroup = "age" | "gender" | "accent" | "tone" | "pace";
+
+/** Starter chips: one pick per group, written into the description in this order. */
+export const VOICE_CHIPS: { group: ChipGroup; label: string; options: string[] }[] = [
+ { group: "age", label: "Age", options: ["Young", "In their thirties", "Middle-aged", "Older"] },
+ { group: "gender", label: "Gender", options: ["Female", "Male", "Androgynous"] },
+ { group: "accent", label: "Accent", options: ["American", "British", "Australian", "Irish", "Indian", "Scottish"] },
+ { group: "tone", label: "Tone", options: ["Warm", "Gravelly", "Bright", "Calm", "Authoritative", "Playful", "Breathy"] },
+ { group: "pace", label: "Pace", options: ["Slow", "Measured", "Brisk"] },
+];
+
+export type ChipPicks = Partial<Record<ChipGroup, string>>;
+
+const lower = (s: string) => s.charAt(0).toLowerCase() + s.slice(1);
+
+/**
+ * The words the model reads: the picked chips as one sentence ("A warm, older female voice with a British accent,
+ * speaking at a slow pace."), then what was typed. Either may be empty; the result is held to VOICE_DESCRIPTION_MAX.
+ */
+export function describeVoice(picks: ChipPicks, typed = ""): string {
+ const tone = picks.tone ? lower(picks.tone) : "";
+ const age = picks.age ? (picks.age === "In their thirties" ? "" : lower(picks.age)) : "";
+ const gender = picks.gender ? lower(picks.gender) : "";
+ const thirties = picks.age === "In their thirties" ? " in their thirties" : "";
+ const who = [age, gender].filter(Boolean).join(" ");
+ const parts: string[] = [];
+ if (tone || who || thirties || picks.accent || picks.pace) {
+ // "warm, older female": the tone, then who is speaking.
+ const head = [tone, who].filter(Boolean).join(", ");
+ let s = `${head ? `${/^[aeiou]/i.test(head) ? "An" : "A"} ${head}` : "A"} voice${thirties}`;
+ if (picks.accent) s += ` with ${/^[aeiou]/i.test(picks.accent) ? "an" : "a"} ${picks.accent} accent`;
+ if (picks.pace) s += `, speaking at a ${lower(picks.pace)} pace`;
+ parts.push(`${s}.`);
+ }
+ const typedWords = typed.trim();
+ const words = typedWords.charAt(0).toUpperCase() + typedWords.slice(1);
+ if (words) parts.push(/[.!?]$/.test(words) ? words : `${words}.`);
+ return parts.join(" ").slice(0, VOICE_DESCRIPTION_MAX);
+}
+
+export type DesignModelKey = "qwen" | "voxcpm";
+
+/** The models Design a voice offers, with the model each engine runs (null: none there). */
+export const DESIGN_MODELS: { key: DesignModelKey; label: string; open: string; cloud: string | null; blurb: string }[] = [
+ {
+ key: "qwen",
+ label: "Qwen3-TTS · both engines",
+ open: "oss-qwen3-tts",
+ cloud: "qwen-3-tts",
+ blurb: "Free on your GPU, or in the cloud. 10 languages.",
+ },
+ {
+ key: "voxcpm",
+ label: "VoxCPM2 · your GPU",
+ open: "oss-voxcpm2",
+ cloud: null,
+ blurb: "Studio-quality 48 kHz in 30 languages. Runs on your GPU (open source).",
+ },
+];
+
+/** The model a choice runs on an engine, or null when it doesn't run there (VoxCPM2 in the cloud). */
+export function designModelFor(key: DesignModelKey, engine: Engine): string | null {
+ const m = DESIGN_MODELS.find((d) => d.key === key) ?? DESIGN_MODELS[0];
+ return engine === "open" ? m.open : m.cloud;
+}
+
+/** Why a choice can't run on an engine (shown instead of the run button), or null when it can. */
+export function designBlocker(key: DesignModelKey, engine: Engine): string | null {
+ return designModelFor(key, engine) ? null : "VoxCPM2 runs on your GPU (open source). Switch to Open source, or pick Qwen3-TTS for the cloud.";
+}
+
+/** Which Design a voice choice a model id belongs to. */
+export function designKeyOf(modelId: string): DesignModelKey | null {
+ return DESIGN_MODELS.find((d) => d.open === modelId || d.cloud === modelId)?.key ?? null;
+}
+
+/**
+ * How a saved voice reads in a voice picker: what it was designed with and where that runs ("Designed with Qwen3-TTS ·
+ * both engines"), or null for a recorded voice. Every saved voice can be cloned by any model that clones voices.
+ */
+export function voiceOrigin(voice: ElementVoice | undefined): string | null {
+ if (!voice) return null;
+ const key = designKeyOf(voice.modelId);
+ const m = DESIGN_MODELS.find((d) => d.key === key);
+ return m ? `Designed with ${m.label}` : "Designed voice";
+}
diff --git a/src/server/gpu/tools.ts b/src/server/gpu/tools.ts
index b4f9e5a1..071dd0f1 100644
--- a/src/server/gpu/tools.ts
+++ b/src/server/gpu/tools.ts
@@ -217,6 +217,8 @@ export const STUDIO_ROWS: StudioRowDef[] = [
{ href: "/audio", label: "Voice", group: "Audio", config: S.AUDIO_STUDIO },
{ href: "/audio/dialogue", label: "Dialogue", group: "Audio", config: S.DIALOGUE_STUDIO },
{ href: "/audio/voice-change", label: "Voice change", group: "Audio", config: S.VOICE_CHANGE_STUDIO },
+ // 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 },
// DBS soundtrack separation (D1): dialogue, music and effects.
{ href: "/audio/split", label: "Split soundtrack", group: "Audio", steps: [{ modelId: SPLIT_MODEL, op: "separate-audio" }] },
diff --git a/tests/voice-design.test.ts b/tests/voice-design.test.ts
new file mode 100644
index 00000000..5a0ea48e
--- /dev/null
+++ b/tests/voice-design.test.ts
@@ -0,0 +1,47 @@
+import { describe, expect, it } from "vitest";
+import { getModel } from "@/lib/catalog";
+import { DESIGN_MODELS, describeVoice, designBlocker, designModelFor, voiceOrigin } from "@/lib/voice-design";
+
+describe("Design a voice: the words the model reads", () => {
+ it("writes the chips as one sentence, then what was typed", () => {
+ expect(describeVoice({ tone: "Warm", age: "Older", gender: "Female", accent: "British", pace: "Slow" }, "a hint of a smile")).toBe(
+ "A warm, older female voice with a British accent, speaking at a slow pace. A hint of a smile.",
+ );
+ expect(describeVoice({ gender: "Male", age: "In their thirties", accent: "Irish" })).toBe("A male voice in their thirties with an Irish accent.");
+ expect(describeVoice({ tone: "Authoritative" })).toBe("An authoritative voice.");
+ expect(describeVoice({}, " A gravelly 60-year-old narrator ")).toBe("A gravelly 60-year-old narrator.");
+ expect(describeVoice({})).toBe("");
+ expect(describeVoice({}, "x".repeat(900)).length).toBe(500);
+ });
+});
+
+describe("Design a voice: the model each engine runs", () => {
+ it("runs Qwen3-TTS on both engines and VoxCPM2 on your GPU only", () => {
+ expect(designModelFor("qwen", "open")).toBe("oss-qwen3-tts");
+ expect(designModelFor("qwen", "cloud")).toBe("qwen-3-tts");
+ expect(designModelFor("voxcpm", "open")).toBe("oss-voxcpm2");
+ expect(designModelFor("voxcpm", "cloud")).toBeNull();
+ expect(designBlocker("voxcpm", "cloud")).toMatch(/runs on your GPU/);
+ expect(designBlocker("qwen", "cloud")).toBeNull();
+ expect(DESIGN_MODELS.find((m) => m.key === "qwen")!.label).toBe("Qwen3-TTS · both engines");
+ });
+
+ it("names catalog models that design voices and clone them", () => {
+ for (const m of DESIGN_MODELS) {
+ for (const id of [m.open, m.cloud].filter(Boolean) as string[]) {
+ const model = getModel(id);
+ expect(model, id).toBeDefined();
+ expect(model!.routes.map((r) => r.op).sort(), id).toEqual(["tts", "voice-design"]);
+ expect(model!.options.voiceClone, id).toBe(true);
+ }
+ }
+ expect(getModel("oss-voxcpm2")!.engine).toBe("open");
+ expect(getModel("qwen-3-tts")!.engine).toBe("cloud");
+ });
+
+ it("says what a saved voice was designed with", () => {
+ expect(voiceOrigin({ modelId: "qwen-3-tts", engine: "cloud" })).toBe("Designed with Qwen3-TTS · both engines");
+ expect(voiceOrigin({ modelId: "oss-voxcpm2", engine: "open" })).toBe("Designed with VoxCPM2 · your GPU");
+ expect(voiceOrigin(undefined)).toBeNull();
+ });
+});