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.

Merge Design a voice: describe a voice, hear three takes, save one for every picker

Adarsh3eb165d3c04e
diff --cc scripts/comfy/build-library.mjs
index 2beadfae,362fac37..4bc3a58b
--- a/scripts/comfy/build-library.mjs
+++ b/scripts/comfy/build-library.mjs
@@@ -80,7 -80,7 +80,7 @@@ export const LOADER_FOLDERS =
REUSELoader: { model: 'reuse' },
};
// Nodes that fetch their own weights at runtime (no manual download needed; listed in the entry's autoDownloads).
--// Zen Image Edit's adapter loader reads paths (nm10-qwen21-fast): its adapter is a requiredModels file, Qwen3.5-0.8B its autoDownloads.
++// Zen Image Edit's adapter loader reads paths: its adapter is a requiredModels file, Qwen3.5-0.8B its autoDownloads.
const SELF_DOWNLOADING = new Set(['RIFE VFI', 'DownloadAndLoadWav2VecModel', 'RMBG', 'AILab_Qwen3ASRSubtitle', 'Apply Whisper', 'ClothesSegment', 'LatentSyncNode', 'ZenImage21AdapterLoader']);
// Binding keys whose input is a user-supplied model file (not part of "models").
const USER_MODEL_KEYS = new Set(['lora', 'loraHigh', 'loraLow', 'upscaleModel']);
@@@ -160,7 -160,11 +160,11 @@@ export const BINDING_KEYS = new Set(
'reuseModel', 'rate', 'roomToneDb', 'level', 'bedDb',
// Blockout to film: a near = dark depth pass (Blender's mist) inverted before VACE reads it
'invertDepth',
- // nm10-qwen21-fast: the VAE file Options → Decoder picks (Qwen-Image 2.1) and a speed tier's sigma schedule for the canvas size
- // Design a voice (nm10-voice-design): the voice in words, and what a voice sample says (Qwen3-TTS / VoxCPM2 clones)
++ // Design a voice: the voice in words, and what a voice sample says (Qwen3-TTS / VoxCPM2 clones)
+ 'voiceDescription', 'voiceTranscript',
+ // VoxCPM2's device combo (cuda | mps | cpu): the server's first torch device
+ 'device',
- // nm10-qwen21-fast: the VAE file Options → Decoder picks (Qwen-Image 2.1) and a speed tier's sigma schedule for the canvas size
++ // The VAE file Options → Decoder picks (Qwen-Image 2.1) and a speed tier's sigma schedule for the canvas size
'vae', 'sigmas',
]);
diff --cc scripts/comfy/library.spec.mjs
index 9a8ac790,c8354b52..c0c58609
--- a/scripts/comfy/library.spec.mjs
+++ b/scripts/comfy/library.spec.mjs
@@@ -116,6 -116,10 +116,10 @@@
// Keys added with MOSS-Image (docs/research/new-models-7.md §4.6). Model settings (params.extra; MOSS-Image's Quality control writes them):
// sampler, scheduler (KSampler sampler_name / scheduler)
// unet (UNETLoader file: the Fast tier's drop-in 8-step DMD file, listed in optionalModels)
-// Keys added with Design a voice (nm10-voice-design). * = the provider fills it:
++// Keys added with Design a voice. * = the provider fills it:
+ // voiceDescription* (the voice in words: params.voiceDescription, op voice-design)
+ // voiceTranscript* (what the voice sample says: params.voiceTranscript, or a saved voice's line)
+ // device* (VoxCPM2's device combo: the server's first torch device, cuda | mps | cpu)
// Entry field requiredModels: files a loader reads by a name with no extension (DBSLoader's model folder), listed in the
// manifest like any model (KNOWN_MODELS keys are the path under the folder, e.g. 'DBS-BSRNN-DnR/model.safetensors'), so the
// Workflows page's presence check and its install commands cover them.
@@@ -190,10 -194,14 +194,14 @@@ export const CUSTOM_NODE_REPOS =
'ComfyUI-RE-USE': 'https://github.com/workingprototype/Fuobe/tree/8cc0417b5cb8a603f06502d97d5c6d8c6035ea0d/comfy-nodes/ComfyUI-RE-USE',
// Live edit: Fuobe's own node file (src/lib/comfy-live-nodes.ts), shipped with Fuobe rather than cloned from a repo.
'fuobe-live': 'https://github.com/workingprototype/Fuobe',
-- // nm10-qwen21-fast: Qwen-Image 2.1 on a 16 GB card: recoilme's Zen Image Edit nodes (Qwen3.5-0.8B encoder + fusion adapter),
++ // Qwen-Image 2.1 on a 16 GB card: recoilme's Zen Image Edit nodes (Qwen3.5-0.8B encoder + fusion adapter),
// Apache-2.0 code, release v2 (adapter_v12). Not on the validation server (needs transformers >= 5.17; the pinned
// ComfyUI's venv has 5.22.1).
'zen-image-edit-comfyui': 'https://github.com/recoilme/zen-image-edit-comfyui/tree/7a29e58c973b84798df926e3251727884fdacc2d',
- // nm10-voice-design: Design a voice. 1038lab's Qwen3-TTS nodes (GPL-3.0 code, Apache-2.0 weights) and Saganaki22's VoxCPM2
++ // Design a voice: 1038lab's Qwen3-TTS nodes (GPL-3.0 code, Apache-2.0 weights) and Saganaki22's VoxCPM2
+ // nodes (Apache-2.0). Neither is on the validation server; both download their weights from Hugging Face on first run.
+ 'ComfyUI-QwenTTS': 'https://github.com/1038lab/ComfyUI-QwenTTS/tree/d8122a8ba835b65fd65c113d2b273b1ad1579293',
+ 'ComfyUI-VoxCPM2': 'https://github.com/Saganaki22/ComfyUI-VoxCPM2/tree/0e52a6cd006769e030d0e1ae907ffebbbfac4f5f',
};
// Node classes of the packs entries list in `packs` (packs the validation server doesn't have installed): the build
@@@ -386,13 -396,13 +396,13 @@@ export const KNOWN_MODELS =
'qwen3vl_8b_int8_convrot.safetensors': { folder: 'text_encoders', url: 'https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/text_encoders/qwen3vl_8b_int8_convrot.safetensors', variants: ['qwen3vl_8b_bf16.safetensors'] },
'qwen_image_2.1_vae_bf16.safetensors': { folder: 'vae', url: 'https://huggingface.co/Comfy-Org/Qwen-Image-2.1/resolve/main/vae/qwen_image_2.1_vae_bf16.safetensors' },
'qwen-image-2.1-outpaint-v2.safetensors': { folder: 'loras', url: 'https://huggingface.co/ausboss/Qwen-Image-2.1-Outpaint-LoRA/resolve/main/qwen-image-2.1-outpaint-v2.safetensors' },
-- // nm10-qwen21-fast: Qwen-Image 2.1 speed tiers, the clean decoder and the 2.1 Next-Scene LoRA, each pinned at the revision
++ // Qwen-Image 2.1 speed tiers, the clean decoder and the 2.1 Next-Scene LoRA, each pinned at the revision
// its card was read at (2026-11-01) and renamed where upstream uses a name many LoRAs share (pytorch_lora_weights).
'Qwen-Image-2.1-DMD2-2steps-v1.5.safetensors': { folder: 'loras', url: 'https://huggingface.co/linoyts/Qwen-Image-2.1-DMD2-2steps/resolve/5bae28369ecea3232405c17a53c04d35d15796b8/pytorch_lora_weights_v1_5.safetensors' },
'Qwen-Image-2.1-Lightning-4steps.safetensors': { folder: 'loras', url: 'https://huggingface.co/lightx2v/Qwen-Image-2.1-Lightning/resolve/6b0a1176327c01522a44276c5da67331a025b6fc/pytorch_lora_weights.safetensors' },
'p_q_image_2.1_6_steps_upsampled_v0.2_comfyui_bf16.safetensors': { folder: 'loras', url: 'https://huggingface.co/PrunaAI/P-Q-Image-2.1-Comfy/resolve/aa7dcecb1767e220e31a55706e33fd057c9a3fca/p_q_image_2.1_6_steps_upsampled_v0.2_comfyui_bf16.safetensors' },
'Qwen-Image-2.1-Next-Scene-step2500.safetensors': { folder: 'loras', url: 'https://huggingface.co/akhaliq/Qwen-Image-2.1-Next-Scene-LoRA/resolve/67ce88cd413fe177758af5d91e25eb3a334aa06f/next_scene_step2500.safetensors' },
-- // Zen Image Edit's fusion adapter (nm10-qwen21-fast): a GitHub release asset of recoilme/zen-image-edit-comfyui (release v2,
++ // Zen Image Edit's fusion adapter: a GitHub release asset of recoilme/zen-image-edit-comfyui (release v2,
// sha256 and size in model-pins.json), kept in models/text_encoders; the loader is given its full path at run time.
'adapter_v12.safetensors': { folder: 'text_encoders', url: 'https://github.com/recoilme/zen-image-edit-comfyui/releases/download/v2/adapter_v12.safetensors' },
'texture_fix_vae_for_qwen_image_2.1_bf16.safetensors': { folder: 'vae', url: 'https://huggingface.co/madebyollin/texture-fix-vae-for-qwen-image-2.1/resolve/9a10df811f183323e4e94d255c18add1924ce340/texture_fix_vae_for_qwen_image_2.1_bf16.safetensors' },
@@@ -565,7 -575,7 +575,7 @@@ function wanI2V(variant)
};
}
--// nm10-qwen21-fast: Options → Decoder "Clean" on every Qwen-Image 2.1 graph picks madebyollin's Texture-Fix VAE (the vae binding).
++// Options → Decoder "Clean" on every Qwen-Image 2.1 graph picks madebyollin's Texture-Fix VAE (the vae binding).
const QWEN21_CLEAN_VAE = 'texture_fix_vae_for_qwen_image_2.1_bf16.safetensors';
const QWEN21_LICENCE = 'Qwen Research License Agreement (Qwen-Image 2.1): NON-COMMERCIAL, research and evaluation only';
const QWEN21_CLEAN_NOTE = ' Options → Decoder "Clean" sets vae to the Texture-Fix VAE (madebyollin, a finetuned Qwen-Image 2.1 decoder, Qwen Research License; optional file, which the GPU pre-flight asks for when Clean is picked).';
@@@ -575,7 -585,7 +585,7 @@@ const ZEN_LICENCE = '; Zen Image Edit f
const ZEN_FIRST_RUN = [
'Qwen3.5-0.8B (1.7 GB, Apache-2.0), the text encoder: Fuobe uses the pinned copy in models/text_encoders/qwen3.5_0.8b when it is there (hf download Qwen/Qwen3.5-0.8B --revision 2fc06364715b967f1860aea9cf38778875588b17 --local-dir models/text_encoders/qwen3.5_0.8b); otherwise the loader downloads it from Hugging Face on first run',
];
--// The speed tiers' LoRAs (nm10-qwen21-fast, cards read 2026-11-01): file, licence, what the card says.
++// The speed tiers' LoRAs (cards read 2026-11-01): file, licence, what the card says.
const QWEN21_TIERS = {
draft: {
title: '2 steps, DMD2 LoRA v1.5',
@@@ -2730,9 -2835,9 +2835,9 @@@ export const SPEC =
'prompt = the optional "what goes there" hint (the lead-in "Also include in the prompt:" is added); it must not name the subject, which then appears again in the margin. ' +
'Removed: AusBoss Seed/Text/Compare/RunTimer/ShowText/WorkflowNote and its SaveImage (SaveImage).' + QWEN21_CLEAN_NOTE,
},
-- // ---- nm10-qwen21-fast: Qwen-Image 2.1 in 2-6 steps (Options → Speed), the 2.1 Next-Scene LoRA, and a 16 GB route ---------
++ // ---- Qwen-Image 2.1 in 2-6 steps (Options → Speed), the 2.1 Next-Scene LoRA, and a 16 GB route ---------------------------
// Each speed graph is its base graph with one LoRA + ManualSigmas branch (qwen21Tier above); the provider picks it from
- // params.extra.speed (src/lib/comfy-variants.ts). Turbo is the owner's qwen-image-21-turbo-edit; Full is the base graph.
+ // params.extra.speed (src/lib/comfy-variants.ts). Turbo is qwen-image-21-turbo-edit; Full is the base graph.
qwen21Tier('t2i', 'draft', { title: 'Qwen-Image 2.1 Text to Image', capability: 't2i', bindings: { prompt: [b('4', 'prompt')], width: [b('5', 'width')], height: [b('5', 'height')] }, output: '9', limits: { maxWidth: 2048, maxHeight: 2048, dimensionMultiple: 32 } }),
qwen21Tier('t2i', 'fast', { title: 'Qwen-Image 2.1 Text to Image', capability: 't2i', bindings: { prompt: [b('4', 'prompt')], width: [b('5', 'width')], height: [b('5', 'height')] }, output: '9', limits: { maxWidth: 2048, maxHeight: 2048, dimensionMultiple: 32 } }),
qwen21Tier('t2i', 'details', { title: 'Qwen-Image 2.1 Text to Image', capability: 't2i', bindings: { prompt: [b('4', 'prompt')], width: [b('5', 'width')], height: [b('5', 'height')] }, output: '9', limits: { maxWidth: 2048, maxHeight: 2048, dimensionMultiple: 32 } }),
diff --cc scripts/gen-cloud-models.py
index ccf72391,b0eaee0b..bb4aa9ab
--- a/scripts/gen-cloud-models.py
+++ b/scripts/gen-cloud-models.py
@@@ -1364,6 -1364,15 +1364,15 @@@ model("bria-expand", "Bria Expand", "Br
# ----- New speech models
model("heygen-voice-turbo", "HeyGen Voice Turbo", "HeyGen", "heygen", "audio", "24 voices or an instant clone of yours, in 39 languages, for almost nothing",
[("tts", "heygen/heygen-voice/turbo")], badges=["new", "fast"], pricing=("request", 0.004, "per 1k chars"))
-# Qwen3-TTS 1.7B on fal (nm10-voice-design; research new-models-10.json endpointRecords, read 2026-11-02): a voice made from
++# Qwen3-TTS 1.7B on fal (research new-models-10.json endpointRecords, read 2026-11-02): a voice made from
+ # words, nine premade voices, and a clone in two steps (clone-voice turns the sample into an embedding file, text-to-speech
+ # speaks with it; a saved voice keeps the file: src/server/voices.ts). The same model runs on your GPU (oss-qwen3-tts).
+ # max_new_tokens is 200 codec tokens by default (12 Hz: about 16 s of speech): 4096 lets a long line finish.
+ model("qwen-3-tts", "Qwen3-TTS (hosted)", "Alibaba Qwen", "qwen-tts", "audio", "Design a voice from a description, or clone one, in 10 languages",
+ [("voice-design", "fal-ai/qwen-3-tts/voice-design/1.7b"),
+ ("tts", "fal-ai/qwen-3-tts/text-to-speech/1.7b", "fal", {"cloneFirst": {"endpoint": "fal-ai/qwen-3-tts/clone-voice/1.7b", "output": "speaker_embedding"}})],
+ badges=["new"], pricing=("request", 0.09, "per 1k chars; cloning a sample adds $0.0008 per minute of it"),
+ defaults={"voice": "Vivian"}, api_defaults={"max_new_tokens": 4096}, controls=[("language", "Language")])
model("gemini-3-8-flash-tts", "Gemini 3.8 Flash TTS", "Google", "gemini-tts", "audio", "30 Gemini voices with inline <laugh> and <sigh>",
[("tts", "google/gemini-3.8-flash-tts")], badges=["new"], pricing=("request", 0.045, "per 1k chars"))
@@@ -1807,6 -1816,21 +1816,21 @@@ def build_route(op, ep, provider, m, op
opts["voiceClone"] = True
if "voice" in kf and "[]" not in kf["voice"]:
fmap["voice"] = kf["voice"]
- # Voice design and cloning (Qwen3-TTS, nm10-voice-design): the voice in words, what the sample says, a cloned voice's file.
++ # Voice design and cloning (Qwen3-TTS): the voice in words, what the sample says, a cloned voice's file.
+ for k in ("voiceDescription", "voiceTranscript", "voiceEmbedding"):
+ if k in kf and kf[k].split(".")[0] in inputs:
+ fmap[k] = kf[k]
+ # A sample the endpoint can't take is cloned first by a sibling endpoint (fal's clone-voice), whose result file goes in
+ # voiceEmbedding (FieldMap.cloneFirst; src/server/providers/fal.ts): the route takes samples.
+ cf = ropts.get("cloneFirst")
+ if cf:
+ ce = EPS.get((provider, cf["endpoint"]))
+ ckf = (ce or {}).get("keyFields") or {}
+ if not ce or "referenceVoice" not in ckf or "voiceEmbedding" not in fmap:
+ warn(f"{m['id']}: {cf['endpoint']} can't clone for {ep}")
+ else:
+ fmap["cloneFirst"] = {"endpoint": cf["endpoint"], "audio": ckf["referenceVoice"], **({"text": ckf["voiceTranscript"]} if "voiceTranscript" in ckf else {}), "output": cf["output"]}
+ opts["voiceClone"] = True
if "voice" in kf and "elevenlabs" in ep:
opts["voices"] = ELEVEN_VOICES
elif "voice" in kf and "voices" not in opts and voice_list(spec_at(inputs, kf["voice"])):
diff --cc src/components/audio-tools/design-voice-tool.tsx
index 00000000,a176e447..01e09ecf
mode 000000,100644..100644
--- a/src/components/audio-tools/design-voice-tool.tsx
+++ b/src/components/audio-tools/design-voice-tool.tsx
@@@ -1,0 -1,272 +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
++ * Audio → Design a voice: 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 --cc src/lib/catalog/elements.ts
index ff2acc33,d65bbb81..325bdf22
--- a/src/lib/catalog/elements.ts
+++ b/src/lib/catalog/elements.ts
@@@ -50,6 -50,27 +50,27 @@@ export interface ElementLora
referenceId?: string;
}
+ /**
- * A voice made with Design a voice (nm10-voice-design), on the element that keeps it: its clip (references[0], the take
++ * A voice made with Design a voice, on the element that keeps it: its clip (references[0], the take
+ * picked) is what later lines clone, on either engine. The cloud's Qwen3-TTS reuses a voice by cloning that clip into an
+ * embedding file, which Fuobe keeps after its first cloud line (src/server/voices.ts), so it isn't cloned again.
+ */
+ export interface ElementVoice {
+ /** The model that made it (oss-qwen3-tts, oss-voxcpm2, qwen-3-tts). */
+ modelId: string;
+ engine: Engine;
+ /** The words it was designed from. */
+ description?: string;
+ /** What the clip says (the take's test line): VoxCPM2's closest ("ultimate") clone and Qwen3-TTS's reference text. */
+ transcript?: string;
+ /** Qwen3-TTS's embedding of the clip on fal, stored by Fuobe (/api/files/…). */
+ embedding?: string;
+ }
+
+ /** Element voices: the most an ElementVoice's words hold (the API and the form keep to these). */
+ export const VOICE_DESCRIPTION_MAX = 500;
+ export const VOICE_TRANSCRIPT_MAX = 1000;
+
export interface StudioElement {
id: string;
name: string;
diff --cc src/lib/catalog/models.ts
index d8d738b2,fa06f277..2e8a7a7a
--- a/src/lib/catalog/models.ts
+++ b/src/lib/catalog/models.ts
@@@ -162,7 -162,7 +162,7 @@@ const open: ModelDef[] =
routes: [comfy("edit", "qwen-image-21-turbo-edit", "8 steps, up to 4 references")],
options: { maxImages: 4, seed: true, controls: [QWEN21_DECODER] },
}),
-- // Qwen-Image 2.1 on a 16 GB card (nm10-qwen21-fast): Zen Image Edit's 0.8B encoder, which Qwen-Image 2.1's GPU option picks
++ // Qwen-Image 2.1 on a 16 GB card: Zen Image Edit's 0.8B encoder, which Qwen-Image 2.1's GPU option picks
// (Small, or Auto under 20 GB when the route is ready: src/server/qwen21-gpu.ts). Listed for its licence, its node pack and its switch, and for the pre-flight board's row; never in a picker.
o({
id: "oss-qwen-image-21-small",
@@@ -1170,7 -1169,7 +1170,7 @@@
options: { seed: true, negativePrompt: true, maxImages: 2 },
hidden: true,
}),
-- // Storyboard's next frame on your GPU since nm10-qwen21-fast: Qwen-Image 2.1 with akhaliq's 2.1 Next-Scene LoRA (the graph loads
++ // Storyboard's next frame on your GPU: Qwen-Image 2.1 with akhaliq's 2.1 Next-Scene LoRA (the graph loads
// it; options.loras holds the model to its switch). The 2509 graph below stays the classic choice and the cloud's recipe.
o({
id: "oss-qwen-image-21-next-scene",
@@@ -1217,6 -1216,30 +1217,30 @@@
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).
++ // Design a voice: 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 --cc src/lib/catalog/storyboard.ts
index 3871488e,3871488e..62057282
--- a/src/lib/catalog/storyboard.ts
+++ b/src/lib/catalog/storyboard.ts
@@@ -10,7 -10,7 +10,7 @@@
* came out, so the grade is applied once).
*
* The board is Fuobe's open recipe on both engines: on your GPU each next frame is Qwen-Image 2.1 with akhaliq's 2.1
-- * Next-Scene LoRA (nm10-qwen21-fast), or the classic Qwen-Image-Edit 2509 + next-scene LoRA when the board asks for it
++ * Next-Scene LoRA, or the classic Qwen-Image-Edit 2509 + next-scene LoRA when the board asks for it
* (`nextScene`); in the cloud fal's hosted Qwen-Image-Edit 2509 with the 2509 LoRA (sent as a URL), as Qwen-Image 2.1 isn't
* hosted. Nano Banana Pro stays a separate choice in the cloud (`partner`), every frame on it as boards ran before.
*/
diff --cc src/lib/catalog/types.ts
index 98d8b472,cd5b664b..a77775aa
--- a/src/lib/catalog/types.ts
+++ b/src/lib/catalog/types.ts
@@@ -87,7 -87,9 +87,9 @@@ export type Operation
// N7-5
| "camera-path" // image + params.cameraPath (+ inputs.video: the open engine's render along the path) → the camera following the path
// archive-restore
- | "restore-video"; // archive video (+ prompt: period, place, light; negative: what not to invent) → the same shot clean, in colour, larger
+ | "restore-video" // archive video (+ prompt: period, place, light; negative: what not to invent) → the same shot clean, in colour, larger
- // nm10-voice-design
++ // Design a voice
+ | "voice-design"; // params.voiceDescription (who is speaking) + prompt (the line) → the line in a new voice made from the words
export const OPERATION_LABELS: Record<Operation, string> = {
t2i: "Text to image",
diff --cc src/lib/licences.ts
index e67a17f0,c7a9494b..460ce729
--- a/src/lib/licences.ts
+++ b/src/lib/licences.ts
@@@ -456,13 -456,24 +456,24 @@@ export const NODE_PACKS: NodePack[] =
pack("ComfyUI-ThinkSound_Wrapper", "https://github.com/ShmuelRonen/ComfyUI-ThinkSound_Wrapper", NO_FILE("; the ThinkSound weights are Apache-2.0"), "isolated"),
pack("fuobe-live", "https://github.com/workingprototype/Fuobe", { name: "MIT", class: "commercial", url: SPDX("MIT"), note: "Fuobe's own live edit nodes (fuobe_live.py, shipped with Fuobe): a loader, a cached reference encode, a crop, a paste-back and a socket save. The Qwen-Image 2.1 weights and the DMD2 LoRA they run are non-commercial" }),
pack("ausboss-nodes", "https://github.com/ausboss/ComfyUI-AusBoss", { name: "MIT", class: "commercial", url: SPDX("MIT"), note: "Crop For Inpaint, Stitch Inpaint and Crop + Rotate + Pad for Qwen-Image 2.1's inpaint and expand; MIT code. The Qwen-Image 2.1 weights they run are non-commercial" }),
-- // Qwen-Image 2.1 on a 16 GB card (nm10-qwen21-fast): recoilme's Zen Image Edit nodes, LICENSE Apache-2.0 at the pinned commit.
++ // Qwen-Image 2.1 on a 16 GB card: recoilme's Zen Image Edit nodes, LICENSE Apache-2.0 at the pinned commit.
pack("zen-image-edit-comfyui", "https://github.com/recoilme/zen-image-edit-comfyui/tree/7a29e58c973b84798df926e3251727884fdacc2d", {
name: "Apache-2.0",
class: "commercial",
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.
++ // Design a voice, 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 --cc src/lib/voice-design.ts
index 00000000,2fa7599f..f8ef8166
mode 000000,100644..100644
--- a/src/lib/voice-design.ts
+++ b/src/lib/voice-design.ts
@@@ -1,0 -1,104 +1,104 @@@
+ /**
- * Audio → Design a voice (nm10-voice-design): a voice made from words, heard in three takes, and the take you like saved
++ * Audio → Design a voice: 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",
++ label: "Qwen3-TTS",
+ 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",
++ label: "VoxCPM2",
+ 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.
++ * How a saved voice reads in a voice picker: what it was designed with ("Designed with Qwen3-TTS"), 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 --cc src/server/db.ts
index e1bea8a5,b2dce4b7..d1b746cf
--- a/src/server/db.ts
+++ b/src/server/db.ts
@@@ -605,6 -605,9 +605,9 @@@ export const MIGRATIONS: string[] =
CREATE INDEX IF NOT EXISTS assets_account ON assets(account_id, created_at DESC);
CREATE INDEX IF NOT EXISTS assets_rel ON assets(rel_path);
CREATE INDEX IF NOT EXISTS assets_generation ON assets(generation_id);`,
- // originals (o/nm10-voice-design): a designed voice on its element (Design a voice): the model, the words, what its clip
++ // Design a voice: a designed voice on its element: the model, the words, what its clip
+ // says and, once the cloud has cloned it, Qwen3-TTS's embedding file (src/lib/catalog/elements.ts ElementVoice).
+ `ALTER TABLE characters ADD COLUMN voice_json TEXT;`,
];
/**
diff --cc src/server/gpu/tools.ts
index a0a8eb6d,071dd0f1..b7c79ed0
--- a/src/server/gpu/tools.ts
+++ b/src/server/gpu/tools.ts
@@@ -163,7 -163,7 +163,7 @@@ export const STUDIO_ROWS: StudioRowDef[
{ href: "/image", label: "Image", group: "Images", config: S.IMAGE_STUDIO },
{ href: "/edit", label: "Edit", group: "Images", config: S.EDIT_STUDIO },
{ href: "/inpaint", label: "Inpaint", group: "Images", config: S.INPAINT_STUDIO },
-- // Qwen-Image 2.1 on a 16 GB card (nm10-qwen21-fast): text to image and edits on Zen Image Edit's small encoder, which the
++ // Qwen-Image 2.1 on a 16 GB card: text to image and edits on Zen Image Edit's small encoder, which the
// Image and Edit studios pick by themselves under 20 GB once it is ready (Options → GPU on Auto). The row's page opens the Image
// studio on Qwen-Image 2.1.
{
@@@ -217,6 -217,8 +217,8 @@@
{ 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).
++ // Design a voice: 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 --cc src/server/voices.ts
index 00000000,ba50154f..2c88782a
mode 000000,100644..100644
--- a/src/server/voices.ts
+++ b/src/server/voices.ts
@@@ -1,0 -1,58 +1,58 @@@
+ import "server-only";
+ import type { ElementVoice, StudioElement } from "@/lib/catalog/elements";
+ import { listElements, updateElement } from "./elements";
+ import { fetchRemote } from "./remote-fetch";
+ import { saveFile } from "./storage";
+ import { tenant } from "./tenant";
+
+ /**
- * Saved voices (Design a voice, nm10-voice-design): an Element voice whose clip (references[0]) is the take picked. A
++ * Saved voices (Design a voice): an Element voice whose clip (references[0]) is the take picked. A
+ * later line that names that clip as its voice sample reuses the voice on either engine: ComfyUI clones the clip, and
+ * VoxCPM2 / Qwen3-TTS read what it says (ElementVoice.transcript) for a closer clone; fal's Qwen3-TTS clones it once into
+ * an embedding file, which is kept on the element after that first cloud line, so later lines go straight to speech.
+ *
+ * Elements are the owner's library: inside a tenant (an account's run, a visitor's price check) nothing here reads or
+ * writes them.
+ */
+
+ /** The same stored file, whatever query or host prefix the reference carries. */
+ const samePath = (a: string, b: string) => a.split(/[?#]/)[0] === b.split(/[?#]/)[0];
+
+ /** The saved voice a voice sample is, if it is one (the owner's runs only). */
+ export function savedVoiceFor(sample: string | undefined): (StudioElement & { voice: ElementVoice }) | null {
+ if (!sample || tenant()) return null;
+ const el = listElements("voice").find((e) => e.voice && e.references[0] && samePath(e.references[0], sample));
+ return el?.voice ? (el as StudioElement & { voice: ElementVoice }) : null;
+ }
+
+ /** Hosts fal answers a clone with (its CDN and storage). The file is fetched from nowhere else. */
+ const FAL_FILE_HOST = /(^|\.)(fal\.media|fal\.run|fal\.ai)$/i;
+ /** fal's own bucket on Google Cloud Storage (its schema examples answer from it): that bucket only, not the whole host. */
+ const isFalFile = (u: URL) => FAL_FILE_HOST.test(u.hostname) || (u.hostname === "storage.googleapis.com" && u.pathname.startsWith("/falserverless/"));
+ /** A Qwen3-TTS speaker embedding is a few kilobytes; anything near this is not one. */
+ const MAX_EMBEDDING_BYTES = 8 * 2 ** 20;
+
+ /**
+ * After a cloud line cloned a saved voice's clip (fal's clone-voice; FieldMap.cloneFirst), the embedding file is stored
+ * by Fuobe and kept on the element, so the next line skips the clone. Quietly does nothing for a sample that isn't a
+ * saved voice, a voice that already has one, a link that isn't fal's, or inside a tenant. Returns the stored file's URL.
+ */
+ export async function keepVoiceEmbedding(sample: string | undefined, url: string | undefined, fetchFile = fetchRemote): Promise<string | null> {
+ const saved = savedVoiceFor(sample);
+ if (!saved || saved.voice.embedding || !url) return null;
+ let u: URL;
+ try {
+ u = new URL(url);
+ } catch {
+ return null;
+ }
+ if (u.protocol !== "https:" || !isFalFile(u)) return null;
+ const file = await fetchFile(url, { maxBytes: MAX_EMBEDDING_BYTES, timeoutMs: 60_000 });
+ // The clip may have changed while the file came down, or another line kept its embedding first: only the clip it was
+ // cloned from keeps it, and nothing is stored that the element wouldn't keep.
+ const now = savedVoiceFor(sample);
+ if (!now || now.id !== saved.id || now.voice.embedding) return null;
+ const asset = saveFile({ data: file.data, contentType: "application/octet-stream", name: `${saved.handle}-voice.safetensors`, source: "derived" });
+ updateElement(saved.id, { voice: { ...now.voice, embedding: asset.url } });
+ return asset.url;
+ }
diff --cc tests/comfy-library-4.test.ts
index 3f0fe52f,b7c103f4..61e24b2c
--- a/tests/comfy-library-4.test.ts
+++ b/tests/comfy-library-4.test.ts
@@@ -100,13 -100,18 +100,18 @@@ describe("round-4 ComfyUI workflows", (
"minimax-h3-i2v-hq",
"minimax-h3-flf2v-hq",
"minimax-h3-orbit",
- // Design a voice (nm10-voice-design): ComfyUI-QwenTTS and ComfyUI-VoxCPM2 aren't on the validation server (tests/voice-design-server.test.ts).
++ // Design a voice: ComfyUI-QwenTTS and ComfyUI-VoxCPM2 aren't on the validation server (tests/voice-design-server.test.ts).
+ "tts-qwen3-design",
+ "tts-qwen3-clone",
+ "tts-voxcpm2",
+ "tts-voxcpm2-clone",
"qwen-image-21-t2i",
"qwen-image-21-edit",
"qwen-image-21-turbo-edit",
"qwen-image-21-live-edit",
"qwen-image-21-inpaint",
"qwen-image-21-outpaint",
-- // Qwen-Image 2.1's speeds, its next scene and its 16 GB route (nm10-qwen21-fast): unvalidated like their base graphs until
++ // Qwen-Image 2.1's speeds, its next scene and its 16 GB route: unvalidated like their base graphs until
// they run on a GPU (tests/qwen21-fast.test.ts).
"qwen-image-21-t2i-draft",
"qwen-image-21-t2i-fast",
diff --cc tests/e2e/design-voice.mjs
index 00000000,1736bd85..9f8a2702
mode 000000,100644..100644
--- a/tests/e2e/design-voice.mjs
+++ b/tests/e2e/design-voice.mjs
@@@ -1,0 -1,133 +1,135 @@@
-// Browser check of Audio → Design a voice (nm10-voice-design) and the Dialogue voice picker.
++// Browser check of Audio → Design a voice and the Dialogue voice picker.
+ // Usage: node tests/e2e/design-voice.mjs [appUrl] [outDir]
+ // appUrl: the app in demo mode (FUOBE_DEMO_MODE=on, no keys, COMFYUI_URL pointing at nothing), signed in as the owner.
+ // Checks, at 1440 px and 390 px in light and dark: the tool's chips, the description the model hears, the price ("Free on
+ // your GPU"; the cloud's per-character price), VoxCPM2 refused on the cloud with the reason, no sideways scroll; three takes
+ // made (placeholders), one saved as a voice; the saved voice in the Dialogue picker and in Elements → Voices with what it
+ // was designed with. Screenshots go to outDir. A page error or a console error fails the run.
+ import fs from "node:fs";
++import os from "node:os";
++import path from "node:path";
+ import { DESKTOP, PHONE, launch, openRoute } from "./_browser.mjs";
+
-const app = process.argv[2] ?? "http://localhost:3000";
-const out = process.argv[3] ?? fs.mkdtempSync("/tmp/fuobe-design-voice-");
++const app = process.argv[2] ?? "http://localhost:3440";
++const out = process.argv[3] ?? fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-design-voice-"));
+ fs.mkdirSync(out, { recursive: true });
+
+ const failures = [];
+ const check = (ok, what) => {
+ console.log(`${ok ? "✓" : "✗"} ${what}`);
+ if (!ok) failures.push(what);
+ };
+ const noSideScroll = async (page, label) => {
+ const over = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);
+ check(over <= 0, `${label}: no horizontal scroll (${over}px)`);
+ };
+ async function setup(browser, device, theme, engine) {
+ const ctx = await browser.newContext({ ...device, colorScheme: theme });
+ ctx.on("page", (p) => {
+ p.on("pageerror", (e) => check(false, `${engine} ${theme}: no page error (${String(e.message).slice(0, 160)})`));
+ p.on("console", (m) => m.type() === "error" && !/Failed to load resource/.test(m.text()) && check(false, `${engine} ${theme}: no console error (${m.text().slice(0, 160)})`));
+ });
+ await ctx.addInitScript(
+ ([e]) => {
+ try {
+ localStorage.setItem("fuobe.engine", e);
+ } catch {}
+ },
+ [engine],
+ );
+ await ctx.route((u) => u.origin !== new URL(app).origin && /^https?:$/.test(u.protocol), (r) => r.abort());
+ return ctx;
+ }
+
+ const browser = await launch();
+ try {
+ // 1440 light, open engine: describe, make three takes, save one.
+ {
+ const ctx = await setup(browser, DESKTOP, "light", "open");
+ const page = await ctx.newPage();
+ await openRoute(page, `${app}/audio/design`);
+ check(await page.getByRole("heading", { name: "Design a voice" }).isVisible(), "1440: the tool's heading");
+ check(await page.getByRole("tab", { name: "Design a voice" }).or(page.getByRole("link", { name: "Design a voice" })).first().isVisible(), "1440: the Audio tab");
+ await page.getByRole("group", { name: "Tone" }).getByRole("button", { name: "Warm", exact: true }).click();
+ await page.getByRole("group", { name: "Age" }).getByRole("button", { name: "Older", exact: true }).click();
+ await page.getByRole("group", { name: "Gender" }).getByRole("button", { name: "Male", exact: true }).click();
+ await page.getByRole("group", { name: "Accent" }).getByRole("button", { name: "British", exact: true }).click();
+ await page.getByLabel("Describe the voice in your own words").fill("a gravelly narrator with a smile in his voice");
+ const heard = await page.getByText("The model hears:").locator("..").innerText();
+ check(heard.includes("A warm, older male voice with a British accent. A gravelly narrator with a smile in his voice."), `1440: the description the model hears (${heard.slice(0, 120)})`);
+ check(await page.getByText("Free on your GPU", { exact: true }).isVisible(), "1440: free on the open engine");
+ await page.screenshot({ path: `${out}/design-1440-light.png`, fullPage: true });
+ await page.getByRole("button", { name: /Make 3 (new )?takes/ }).click();
+ const takes = page.locator("li").filter({ has: page.locator("audio") });
+ await takes.nth(2).waitFor({ timeout: 60_000 });
+ check((await takes.count()) === 3, "1440: three takes, each with a player");
+ await takes.first().getByRole("button", { name: "Save as voice" }).click();
+ await page.getByLabel("Voice name").fill("Old Narrator");
+ await page.getByRole("button", { name: "Save", exact: true }).click();
+ await page.getByText("Saved", { exact: true }).first().waitFor({ timeout: 15_000 });
+ check(true, "1440: a take saved as a voice");
+ await noSideScroll(page, "1440 light");
+ await page.screenshot({ path: `${out}/design-1440-light-takes.png`, fullPage: true });
+ const saved = await (await fetch(`${app}/api/elements?kind=voice`)).json();
+ const v = saved.items.find((e) => e.name === "Old Narrator");
+ check(!!v && v.voice?.modelId === "oss-qwen3-tts" && /British accent/.test(v.voice?.description ?? "") && !!v.voice?.transcript && v.references[0]?.startsWith("/api/files/"), "the saved voice keeps its model, words, line and take");
+
+ // Elements → Voices shows what it was designed with.
+ await openRoute(page, `${app}/elements`);
- const card = page.getByText("Designed with Qwen3-TTS · both engines").first();
++ const card = page.getByText("Designed with Qwen3-TTS").first();
+ await card.waitFor({ timeout: 15_000 }).catch(() => {});
+ check(await card.isVisible().catch(() => false), "Elements: the voice says what it was designed with");
+ await page.screenshot({ path: `${out}/elements-1440-light.png`, fullPage: true });
+
+ // Dialogue's voice picker lists it.
+ await openRoute(page, `${app}/audio/dialogue`);
+ const pick = page.getByRole("button", { name: /add a sample|Speaker A/i }).first();
+ await pick.click();
+ const row = page.getByRole("button", { name: /Old Narrator/ }).first();
+ await row.waitFor({ timeout: 10_000 }).catch(() => {});
+ check(await row.isVisible().catch(() => false), "Dialogue: the saved voice is in the picker");
- check(await page.getByText("Designed with Qwen3-TTS · both engines").first().isVisible().catch(() => false), "Dialogue: with what it was designed with");
++ check(await page.getByText("Designed with Qwen3-TTS").first().isVisible().catch(() => false), "Dialogue: with what it was designed with");
+ await page.screenshot({ path: `${out}/dialogue-picker-1440-light.png` });
+ await ctx.close();
+ }
+ // 1440 dark, cloud engine: VoxCPM2 refused with the reason; Qwen3-TTS priced per character.
+ {
+ const ctx = await setup(browser, DESKTOP, "dark", "cloud");
+ const page = await ctx.newPage();
+ await openRoute(page, `${app}/audio/design`);
+ await page.getByRole("group", { name: "Tone" }).getByRole("button", { name: "Calm", exact: true }).click();
+ const bar = page.locator("p[aria-live=polite]").last();
+ const cloudPrice = await bar.innerText();
+ check(/3 takes · (≈ \$|Price unknown|Under)/.test(cloudPrice), `1440 dark cloud: a price before running (${cloudPrice})`);
+ await page.getByRole("radio", { name: /VoxCPM2/ }).click();
+ check(await page.getByText("VoxCPM2 runs on your GPU (open source)").first().isVisible(), "1440 dark cloud: VoxCPM2 says it runs on your GPU");
+ await noSideScroll(page, "1440 dark");
+ await page.screenshot({ path: `${out}/design-1440-dark-cloud.png`, fullPage: true });
+ await ctx.close();
+ }
+ // 390 px, light and dark.
+ for (const theme of ["light", "dark"]) {
+ const ctx = await setup(browser, PHONE, theme, "open");
+ const page = await ctx.newPage();
+ await openRoute(page, `${app}/audio/design`);
+ await page.getByRole("group", { name: "Pace" }).getByRole("button", { name: "Measured", exact: true }).click();
+ await noSideScroll(page, `390 ${theme}`);
+ await page.screenshot({ path: `${out}/design-390-${theme}.png`, fullPage: true });
+ await openRoute(page, `${app}/audio/dialogue`);
+ await noSideScroll(page, `390 ${theme} dialogue`);
+ // On a phone the voice chips may sit behind the composer's settings: open the picker where it shows.
+ const chip = page.getByRole("button", { name: /add a sample/i }).first();
+ if (await chip.isVisible().catch(() => false)) {
+ await chip.click();
+ await page.waitForTimeout(400);
+ await noSideScroll(page, `390 ${theme} dialogue picker open`);
+ }
+ await page.screenshot({ path: `${out}/dialogue-picker-390-${theme}.png` });
+ await ctx.close();
+ }
+ } finally {
+ await browser.close();
+ }
+ console.log(failures.length ? `\n${failures.length} failed` : "\nAll checks passed");
+ console.log(`Screenshots: ${out}`);
+ process.exit(failures.length ? 1 : 0);
diff --cc tests/model-access-listings.test.ts
index dfe1dad2,dfe1dad2..34cc060e
--- a/tests/model-access-listings.test.ts
+++ b/tests/model-access-listings.test.ts
@@@ -98,7 -98,7 +98,7 @@@ describe("Models & licences in listing
// Multiple-angles and Fuobe Speak's FusioniX among them), the preset LoRA map's files that aren't library files, and
// MiniMax H3's four (Akatz Labs' swap LoRA V1.5 and V1 and Person Remover V1, lightx2v's H3 Turbo), and Fuobe Restore's
// two gated IC-LoRAs (Lightricks' Restore and Detail Refine), and Open-H3 Regenerate's merged refiner LoRA, each once. Qwen-Image 2.1's three speed LoRAs and its Next-Scene LoRA
-- // (nm10-qwen21-fast) are four more.
++ // are four more.
expect(list.loras.length).toBe(181);
expect(list.loras.find((l) => l.file === "open_h3_regenerate_2k_lora.safetensors")).toMatchObject({ group: "adapter", base: "MiniMax H3", on: true, licence: { name: "MiniMax H3 Community License", class: "regions" } });
expect(list.packs.find((p) => p.name === "ComfyUI-Open-H3-Regenerate")).toMatchObject({ licence: { name: "Apache-2.0" }, on: true, models: 1 });
diff --cc tests/voice-design-comfy.test.ts
index 00000000,9275f641..1c72c39d
mode 000000,100644..100644
--- a/tests/voice-design-comfy.test.ts
+++ b/tests/voice-design-comfy.test.ts
@@@ -1,0 -1,67 +1,67 @@@
+ import fs from "node:fs";
+ import os from "node:os";
+ import path from "node:path";
+ import { describe, expect, it } from "vitest";
+
+ /**
- * Design a voice on your GPU (nm10-voice-design): the Qwen3-TTS and VoxCPM2 graphs, their node packs pinned for the
++ * Design a voice on your GPU: the Qwen3-TTS and VoxCPM2 graphs, their node packs pinned for the
+ * GPU pre-flight, and what the ComfyUI provider binds (the voice in words, what a sample says, VoxCPM2's device).
+ */
+
+ process.env.FUOBE_DATA_DIR = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-voice-design-comfy-"));
+ process.env.COMFYUI_URL = "http://127.0.0.1:9";
+
+ const root = path.resolve(__dirname, "..");
+ const read = (p: string) => JSON.parse(fs.readFileSync(path.join(root, p), "utf8"));
+ const manifest = read("workflows/comfyui/manifest.json") as { workflows: { id: string; capability: string; customNodes?: { name: string }[]; validated: boolean; license?: string; autoDownloads?: string[]; bindings: Record<string, { node: string; input: string }[]> }[] };
+ const packs = read("workflows/comfyui/packs.json") as Record<string, { repo: string; commit: string }>;
+ const requirements = read("workflows/comfyui/requirements.json") as { workflows: Record<string, { packs: Record<string, string[]>; firstRun: string[] }> };
+ const subset = read("workflows/comfyui/object_info.subset.json") as Record<string, { python_module: string } | null>;
+
+ const GRAPHS = {
+ "tts-qwen3-design": { capability: "voice-design", pack: "ComfyUI-QwenTTS", bindings: ["prompt", "voiceDescription", "seed", "filenamePrefix"] },
+ "tts-qwen3-clone": { capability: "tts", pack: "ComfyUI-QwenTTS", bindings: ["prompt", "audio", "voiceTranscript", "seed", "filenamePrefix"] },
+ "tts-voxcpm2": { capability: "voice-design", pack: "ComfyUI-VoxCPM2", bindings: ["prompt", "voiceDescription", "seed", "device", "filenamePrefix"] },
+ "tts-voxcpm2-clone": { capability: "tts", pack: "ComfyUI-VoxCPM2", bindings: ["prompt", "audio", "voiceTranscript", "seed", "device", "filenamePrefix"] },
+ } as const;
+
+ describe("the voice graphs in the library", () => {
+ it.each(Object.entries(GRAPHS))("%s: its pack pinned, its classes recorded, its licence and first-run download stated", (id, want) => {
+ const w = manifest.workflows.find((x) => x.id === id)!;
+ expect(w.capability).toBe(want.capability);
+ expect(Object.keys(w.bindings).sort()).toEqual([...want.bindings].sort());
+ expect(w.customNodes?.map((c) => c.name)).toContain(want.pack);
+ // The packs aren't on the validation server: the graph waits for a GPU that has them.
+ expect(w.validated).toBe(false);
+ expect(w.license).toMatch(/Apache-2\.0/);
+ expect(packs[want.pack].commit).toMatch(/^[0-9a-f]{40}$/);
+ expect(requirements.workflows[id].packs[want.pack].length).toBe(1);
+ expect(requirements.workflows[id].firstRun.join(" ")).toMatch(/downloads (Qwen\/Qwen3-TTS-12Hz-1\.7B|openbmb\/VoxCPM2)/);
+ const graph = read(`workflows/comfyui/${id}.json`) as Record<string, { class_type: string }>;
+ for (const n of Object.values(graph)) expect(subset[n.class_type], n.class_type).toBeTruthy();
+ });
+ });
+
+ describe("what the ComfyUI provider binds", () => {
+ it("puts the words into the voice design node, and the take's line and the GPU's device into the VoxCPM2 clone", async () => {
+ const { prepareWorkflow } = await import("@/server/providers/comfyui");
+ const ctx = (op: "voice-design" | "tts", device?: string) => ({ generationId: "g", op, upload: async () => "voice.wav", device: async () => device });
+ const design = await prepareWorkflow("tts-qwen3-design", { prompt: "Hello there.", voiceDescription: " A warm older narrator. " }, ctx("voice-design"));
+ expect(design.workflow["1"].inputs).toMatchObject({ text: "Hello there.", instruct: "A warm older narrator.", do_sample: true, model_size: "1.7B" });
+ const vox = await prepareWorkflow("tts-voxcpm2", { prompt: "Hi.", voiceDescription: "A calm voice." }, ctx("voice-design", "mps"));
+ expect(vox.workflow["1"].inputs).toMatchObject({ text: "Hi.", voice_description: "A calm voice.", device: "mps" });
+ const clone = await prepareWorkflow("tts-voxcpm2-clone", { prompt: "New line.", voiceAudio: "data:audio/wav;base64,UklGRg==", voiceTranscript: "Hello there." }, ctx("tts", "cuda"));
+ expect(clone.workflow["2"].inputs).toMatchObject({ text: "New line.", prompt_text: "Hello there.", device: "cuda" });
+ // No transcript: the controllable clone (empty prompt_text); a GPU that can't say keeps the graph's cuda.
+ const plain = await prepareWorkflow("tts-voxcpm2-clone", { prompt: "New line.", voiceAudio: "data:audio/wav;base64,UklGRg==" }, ctx("tts"));
+ expect(plain.workflow["2"].inputs).toMatchObject({ prompt_text: "", device: "cuda" });
+ const qclone = await prepareWorkflow("tts-qwen3-clone", { prompt: "New line.", voiceAudio: "data:audio/wav;base64,UklGRg==", voiceTranscript: "Hello there." }, ctx("tts"));
+ expect(qclone.workflow["2"].inputs).toMatchObject({ target_text: "New line.", reference_text: "Hello there.", x_vector_only: false });
+ // A sample with no transcript (a recorded or uploaded voice): the pack refuses an empty reference_text unless
+ // it clones from the voice's timbre alone, so x_vector_only goes on.
+ for (const voiceTranscript of [undefined, " "]) {
+ const bare = await prepareWorkflow("tts-qwen3-clone", { prompt: "New line.", voiceAudio: "data:audio/wav;base64,UklGRg==", voiceTranscript }, ctx("tts"));
+ expect(bare.workflow["2"].inputs).toMatchObject({ target_text: "New line.", reference_text: "", x_vector_only: true });
+ }
+ });
+ });
diff --cc tests/voice-design-server.test.ts
index 00000000,afe3263b..2ad430af
mode 000000,100644..100644
--- a/tests/voice-design-server.test.ts
+++ b/tests/voice-design-server.test.ts
@@@ -1,0 -1,212 +1,212 @@@
+ import fs from "node:fs";
+ import os from "node:os";
+ import path from "node:path";
+ import { afterAll, beforeAll, describe, expect, it } from "vitest";
+
+ /**
- * Design a voice on the server (nm10-voice-design): an Element voice keeps the model, the words and the take's line; fal's
++ * Design a voice on the server: an Element voice keeps the model, the words and the take's line; fal's
+ * Qwen3-TTS routes send the right fields; a sample is cloned in two steps (clone-voice, then text-to-speech with the
+ * embedding it returns), and a saved voice keeps that embedding so its next line skips the clone. No paid call is made:
+ * fetch is stubbed and nothing reaches fal.
+ */
+
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-voice-design-"));
+ process.env.FUOBE_DATA_DIR = dir;
+ process.env.COMFYUI_URL = "http://127.0.0.1:9";
+
+ const { setSetting } = await import("@/server/settings");
+ const { createElement, getElement, updateElement } = await import("@/server/elements");
+ const { listAssets, saveFile } = await import("@/server/storage");
+ const { keepVoiceEmbedding, savedVoiceFor } = await import("@/server/voices");
+ const { runAsTenant } = await import("@/server/tenant");
+ const { buildPayload } = await import("@/lib/catalog/payload");
+ const { getModel } = await import("@/lib/catalog");
+ const { planGeneration } = await import("@/lib/catalog/plan");
+ const elementsRoute = await import("@/app/api/elements/route");
+ const { createGenerations, getGeneration } = await import("@/server/generations");
+
+ const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
+ const wav = () => saveFile({ data: Buffer.from("RIFF0000WAVEfmt "), contentType: "audio/wav", name: "take.wav", source: "upload" }).url;
+ const qwen = getModel("qwen-3-tts")!;
+ const route = (op: string) => qwen.routes.find((r) => r.op === op)!;
+
+ beforeAll(() => {
+ setSetting("demoMode", "off");
+ setSetting("enhanceProvider", "none");
+ });
+ afterAll(() => {
+ fs.rmSync(dir, { recursive: true, force: true });
+ });
+
+ describe("Element voices keep a designed voice", () => {
+ it("stores the model, the words and the line; a new clip drops the old clip's embedding", () => {
+ const clip = wav();
+ const el = createElement({ name: "Old Narrator", kind: "voice", references: [clip], voice: { modelId: "oss-qwen3-tts", engine: "open", description: "A warm older male voice.", transcript: "Hello there." } });
+ expect(getElement(el.id)!.voice).toEqual({ modelId: "oss-qwen3-tts", engine: "open", description: "A warm older male voice.", transcript: "Hello there." });
+ updateElement(el.id, { voice: { ...el.voice!, embedding: "/api/files/uploads/x.bin" } });
+ expect(getElement(el.id)!.voice!.embedding).toBe("/api/files/uploads/x.bin");
+ // A rename keeps it; a new recording is a different voice: no embedding and no line of the old take.
+ updateElement(el.id, { name: "Narrator" });
+ expect(getElement(el.id)!.voice!.embedding).toBe("/api/files/uploads/x.bin");
+ updateElement(el.id, { references: [wav()] });
+ expect(getElement(el.id)!.voice).toEqual({ modelId: "oss-qwen3-tts", engine: "open", description: "A warm older male voice." });
+ // Only voices carry one.
+ expect(createElement({ name: "Prop", kind: "prop", references: [], description: "a mug", voice: { modelId: "oss-qwen3-tts", engine: "open" } }).voice).toBeUndefined();
+ });
+
+ it("POST /api/elements takes a take from a model that designs voices, never an embedding", async () => {
+ const post = (body: unknown) => elementsRoute.POST(new Request("http://localhost/api/elements", { method: "POST", body: JSON.stringify(body) }));
+ const clip = wav();
+ const ok = await post({ name: "Bright Host", kind: "voice", references: [clip], voice: { modelId: "qwen-3-tts", description: "A bright young voice.", transcript: "Hi!", embedding: "https://evil.example/x" } });
+ expect(ok.status).toBe(201);
+ const el = (await ok.json()) as { voice: Record<string, unknown> };
+ expect(el.voice).toEqual({ modelId: "qwen-3-tts", engine: "cloud", description: "A bright young voice.", transcript: "Hi!" });
+ // A model that doesn't design voices, a voice with no take, or a voice on a character is refused.
+ expect((await post({ name: "X", kind: "voice", references: [clip], voice: { modelId: "elevenlabs-v4" } })).status).toBe(400);
+ expect((await post({ name: "X", kind: "voice", references: [], description: "words", voice: { modelId: "oss-voxcpm2" } })).status).toBe(400);
+ expect((await post({ name: "X", kind: "character", references: [clip], voice: { modelId: "oss-voxcpm2" } })).status).toBe(400);
+ });
+ });
+
+ describe("Qwen3-TTS on fal: the three routes' payloads", () => {
+ it("voice design sends the line as text and the words as prompt, with room for a long line", () => {
+ expect(route("voice-design").endpoint).toBe("fal-ai/qwen-3-tts/voice-design/1.7b");
+ const p = buildPayload(route("voice-design").map!, { prompt: "Hello there.", voiceDescription: " A warm, gravelly narrator. " });
+ expect(p).toEqual({ text: "Hello there.", prompt: "A warm, gravelly narrator.", max_new_tokens: 4096 });
+ });
+
+ it("text to speech speaks with a premade voice, or with a cloned voice's embedding and what its sample says", () => {
+ const tts = route("tts");
+ expect(tts.endpoint).toBe("fal-ai/qwen-3-tts/text-to-speech/1.7b");
+ expect(buildPayload(tts.map!, { prompt: "Line.", voice: "Serena", language: "English" } as never)).toMatchObject({ text: "Line.", voice: "Serena", max_new_tokens: 4096 });
+ const cloned = buildPayload(tts.map!, { prompt: "Line.", voiceAudio: "https://v3.fal.media/files/take.wav", voiceEmbedding: "https://v3.fal.media/files/e.safetensors", voiceTranscript: "Hello there." });
+ expect(cloned).toEqual({ text: "Line.", speaker_voice_embedding_file_url: "https://v3.fal.media/files/e.safetensors", reference_text: "Hello there.", max_new_tokens: 4096 });
+ // The sample itself is never sent to text to speech: it is cloned first.
+ expect(JSON.stringify(cloned)).not.toContain("take.wav");
+ expect(tts.map!.cloneFirst).toEqual({ endpoint: "fal-ai/qwen-3-tts/clone-voice/1.7b", audio: "audio_url", text: "reference_text", output: "speaker_embedding" });
+ });
+
+ it("is priced per 1,000 characters, and a sample is needed or a premade voice", () => {
+ expect(qwen.pricing).toMatchObject({ unit: "request", usd: 0.09 });
+ expect(qwen.options.voices?.map((v) => v.id)).toContain("Uncle_Fu");
+ expect(() => planGeneration({ feature: "voice-design", modelId: "qwen-3-tts", op: "voice-design", prompt: "Hi" }, getModel, () => undefined)).toThrow(/Describe the voice/);
+ expect(planGeneration({ feature: "voice-design", modelId: "qwen-3-tts", op: "voice-design", prompt: "Hi", params: { voiceDescription: "warm", numOutputs: 3 } }, getModel, () => undefined).jobs).toBe(3);
+ });
+ });
+
+ /** A stand-in for fal's queue: records what was sent and answers like fal. */
+ function fakeFal() {
+ const sent: { url: string; body?: unknown }[] = [];
+ const real = globalThis.fetch;
+ globalThis.fetch = (async (input: string | URL | Request, init?: RequestInit) => {
+ const url = String(input instanceof Request ? input.url : input);
+ sent.push({ url, body: init?.body ? JSON.parse(String(init.body)) : undefined });
+ const json = (v: unknown) => new Response(JSON.stringify(v), { status: 200, headers: { "Content-Type": "application/json" } });
+ if (url.endsWith("/fal-ai/qwen-3-tts/clone-voice/1.7b")) return json({ request_id: "c1", status_url: "https://queue.fal.run/fal-ai/qwen-3-tts/requests/c1/status", response_url: "https://queue.fal.run/fal-ai/qwen-3-tts/requests/c1", cancel_url: "https://queue.fal.run/x" });
+ if (url.includes("/requests/c1/status")) return json({ status: "COMPLETED" });
+ if (url.endsWith("/requests/c1")) return json({ speaker_embedding: { url: "https://v3.fal.media/files/voice.safetensors" } });
+ return json({ request_id: "t1", status_url: "https://queue.fal.run/fal-ai/qwen-3-tts/requests/t1/status", response_url: "https://queue.fal.run/fal-ai/qwen-3-tts/requests/t1", cancel_url: "https://queue.fal.run/y" });
+ }) as typeof fetch;
+ return { sent, restore: () => void (globalThis.fetch = real) };
+ }
+
+ describe("a clone in two steps on fal", () => {
+ it("clones the sample, then speaks with the embedding; the adapter says which embedding it made", async () => {
+ setSetting("falKey", "fal_test_key_123456");
+ const fal = fakeFal();
+ const { falProvider } = await import("@/server/providers/fal");
+ try {
+ const res = await falProvider.submit({
+ generationId: "g1",
+ model: qwen,
+ route: route("tts"),
+ input: { prompt: "A new line.", voiceAudio: "https://v3.fal.media/files/take.wav", voiceTranscript: "Hello there." },
+ });
+ expect(fal.sent.map((s) => s.url.replace("https://queue.fal.run/", ""))).toEqual([
+ "fal-ai/qwen-3-tts/clone-voice/1.7b",
+ "fal-ai/qwen-3-tts/requests/c1/status",
+ "fal-ai/qwen-3-tts/requests/c1",
+ "fal-ai/qwen-3-tts/text-to-speech/1.7b",
+ ]);
+ expect(fal.sent[0].body).toEqual({ audio_url: "https://v3.fal.media/files/take.wav", reference_text: "Hello there." });
+ expect(fal.sent[3].body).toEqual({ text: "A new line.", speaker_voice_embedding_file_url: "https://v3.fal.media/files/voice.safetensors", reference_text: "Hello there.", max_new_tokens: 4096 });
+ expect(res.meta?.voiceEmbedding).toBe("https://v3.fal.media/files/voice.safetensors");
+ // An embedding already kept: one call, straight to speech.
+ fal.sent.length = 0;
+ const again = await falProvider.submit({ generationId: "g2", model: qwen, route: route("tts"), input: { prompt: "More.", voiceAudio: "https://v3.fal.media/files/take.wav", voiceEmbedding: "https://v3.fal.media/files/kept.safetensors" } });
+ expect(fal.sent.map((s) => s.url)).toEqual(["https://queue.fal.run/fal-ai/qwen-3-tts/text-to-speech/1.7b"]);
+ expect(again.meta?.voiceEmbedding).toBeUndefined();
+ } finally {
+ fal.restore();
+ }
+ });
+
+ it("a saved voice keeps the embedding fal made, from fal only, and never inside an account's work", async () => {
+ const clip = wav();
+ const el = createElement({ name: "Kept", kind: "voice", references: [clip], voice: { modelId: "qwen-3-tts", engine: "cloud", transcript: "Hi there." } });
+ const file = async () => ({ data: Buffer.from("safetensors-bytes"), contentType: "application/octet-stream", url: "" });
+ // Not fal's: nothing is fetched or kept.
+ expect(await keepVoiceEmbedding(clip, "https://evil.example/voice.safetensors", file)).toBeNull();
+ expect(await keepVoiceEmbedding(clip, "http://v3.fal.media/voice.safetensors", file)).toBeNull();
+ // Inside an account's work the owner's voices aren't there at all.
+ await runAsTenant({ kind: "account", id: "acct-1" }, async () => {
+ expect(savedVoiceFor(clip)).toBeNull();
+ expect(await keepVoiceEmbedding(clip, "https://v3.fal.media/files/voice.safetensors", file)).toBeNull();
+ });
+ const kept = await keepVoiceEmbedding(`${clip}?v=1`, "https://v3.fal.media/files/voice.safetensors", file);
+ expect(kept).toMatch(/^\/api\/files\//);
+ expect(getElement(el.id)!.voice!.embedding).toBe(kept);
+ expect(fs.readFileSync(path.join(dir, "files", kept!.slice("/api/files/".length)), "utf8")).toBe("safetensors-bytes");
+ // Kept once: a second clone doesn't replace it.
+ expect(await keepVoiceEmbedding(clip, "https://v3.fal.media/files/other.safetensors", file)).toBeNull();
+ });
+
+ it("two lines cloning at once keep one embedding and store no spare file; fal's storage bucket is accepted, the rest of the host is not", async () => {
+ const clip = wav();
+ const el = createElement({ name: "Raced", kind: "voice", references: [clip], voice: { modelId: "qwen-3-tts", engine: "cloud", transcript: "Hi." } });
+ const derived = () => listAssets({ source: "derived", limit: 1000 }).length;
+ const bytes = async () => ({ data: Buffer.from("emb"), contentType: "application/octet-stream", url: "" });
+ // Another bucket on the same host is not fal's.
+ expect(await keepVoiceEmbedding(clip, "https://storage.googleapis.com/someone-else/voice.safetensors", bytes)).toBeNull();
+ const before = derived();
+ // The first download finishes after the second one has kept its file.
+ let release!: () => void;
+ const slow = (async () => {
+ await new Promise<void>((r) => (release = r));
+ return bytes();
+ }) as typeof bytes;
+ const first = keepVoiceEmbedding(clip, "https://storage.googleapis.com/falserverless/files/a.safetensors", slow);
+ const second = await keepVoiceEmbedding(clip, "https://v3.fal.media/files/b.safetensors", bytes);
+ release();
+ expect(await first).toBeNull();
+ expect(second).toMatch(/^\/api\/files\//);
+ expect(getElement(el.id)!.voice!.embedding).toBe(second);
+ expect(derived()).toBe(before + 1);
+ // On its own, fal's bucket is kept like its CDN.
+ const other = createElement({ name: "Bucket", kind: "voice", references: [wav()], voice: { modelId: "qwen-3-tts", engine: "cloud" } });
+ expect(await keepVoiceEmbedding(other.references[0], "https://storage.googleapis.com/falserverless/files/c.safetensors", bytes)).toMatch(/^\/api\/files\//);
+ });
+
+ it("a run with a saved voice sends its kept embedding and its line, and makes no clone", async () => {
+ setSetting("falKey", "fal_test_key_123456");
+ const clip = wav();
+ const emb = saveFile({ data: Buffer.from("emb"), contentType: "application/octet-stream", name: "e.safetensors", source: "derived" }).url;
+ createElement({ name: "Ready", kind: "voice", references: [clip], voice: { modelId: "qwen-3-tts", engine: "cloud", transcript: "The take's line.", embedding: emb } });
+ const fal = fakeFal();
+ const { falProvider } = await import("@/server/providers/fal");
+ const upload = falProvider.prepareFile;
+ falProvider.prepareFile = async (_d, _t, name) => `https://v3.fal.media/files/${name}`;
+ try {
+ const [g] = createGenerations({ feature: "audio", modelId: "qwen-3-tts", engine: "cloud", op: "tts", prompt: "Say this.", inputs: { voiceAudio: clip } });
+ const spoke = () => fal.sent.some((s) => s.url.endsWith("/text-to-speech/1.7b"));
+ for (let i = 0; i < 200 && !spoke() && getGeneration(g.id)!.status !== "failed"; i++) await sleep(25);
+ expect(getGeneration(g.id)!.error).toBeNull();
+ const calls = fal.sent.filter((s) => s.url.startsWith("https://queue.fal.run/fal-ai/qwen-3-tts/"));
+ expect(calls.map((s) => s.url)).toEqual(["https://queue.fal.run/fal-ai/qwen-3-tts/text-to-speech/1.7b"]);
+ expect(calls[0].body).toMatchObject({ text: "Say this.", speaker_voice_embedding_file_url: expect.stringMatching(/^https:\/\/v3\.fal\.media\/files\//), reference_text: "The take's line." });
+ } finally {
+ falProvider.prepareFile = upload;
+ fal.restore();
+ }
+ });
+ });
diff --cc tests/voice-design.test.ts
index 00000000,5a0ea48e..e6b06abf
mode 000000,100644..100644
--- a/tests/voice-design.test.ts
+++ b/tests/voice-design.test.ts
@@@ -1,0 -1,47 +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");
++ expect(DESIGN_MODELS.find((m) => m.key === "qwen")!.label).toBe("Qwen3-TTS");
+ });
+
+ 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({ modelId: "qwen-3-tts", engine: "cloud" })).toBe("Designed with Qwen3-TTS");
++ expect(voiceOrigin({ modelId: "oss-voxcpm2", engine: "open" })).toBe("Designed with VoxCPM2");
+ expect(voiceOrigin(undefined)).toBeNull();
+ });
+ });