The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Music: Mureka 9.5 Instrumental and Mureka 8 / O2 / 7.6 in the cloud, saved Mureka songs rerun the version they were made with, and Lyria 3.5 counts its description and lyrics together
Claude06f0ed1f8d95
diff --git a/scripts/gen-cloud-models.py b/scripts/gen-cloud-models.pyindex 4a4c6ee1..894d58bf 100644--- a/scripts/gen-cloud-models.py+++ b/scripts/gen-cloud-models.py@@ -1014,15 +1014,30 @@ model("stable-audio-3-music", "Stable Audio 3 Music", "Stability AI", "stable-au# Full songs (nm10-music3, research #10 endpointRecords): lyrics go in params.extra.lyrics with Fuobe's section tags# (src/lib/lyrics.ts); FieldMap.lyrics sends them in the API's own field. Mureka 9.5 moved from the versioned route# (mureka/api/generate/song, whose fal catalog entry lost its metadata) to its own; a past run's Version (params.extra.model)-# is no field there, so it's left out. Mureka prices a song by whether lyrics come with it (Pricing.withLyrics).+# is no field there, so it's left out (a saved run on another version moves to the model that runs it: replaced.ts+# murekaVersion). Mureka prices a song by whether lyrics come with it (Pricing.withLyrics). Its songs sing words: an+# instrumental is its own model (ModelOptions.lyrics.instrumentalModel).model("mureka-song", "Mureka 9.5", "Mureka", "mureka", "audio", "Full songs with vocals in many genres, 2 to 5 minutes",[("music", "mureka/v9.5/generate/song", "fal", {"ignore": ["model"]})],pricing=("request", 0.50, "a song from a prompt; with your lyrics $0.15", {"withLyrics": 0.15}),- defaults={"duration": 180}, options={"durations": [120, 180, 240, 300]})+ defaults={"duration": 180}, options={"durations": [120, 180, 240, 300], "lyrics": {"instrumentalModel": "mureka-9-5-instrumental"}})model("mureka-9", "Mureka 9", "Mureka", "mureka", "audio", "Songs with vocals at a lower price, sung from your lyrics or written for you",- [("music", "mureka/v9/generate/song")], badges=["new"], pricing=("request", 0.30, "a song from a prompt; with your lyrics $0.045", {"withLyrics": 0.045}))+ [("music", "mureka/v9/generate/song")], badges=["new"], pricing=("request", 0.30, "a song from a prompt; with your lyrics $0.045", {"withLyrics": 0.045}),+ options={"lyrics": {"instrumentalModel": "mureka-9-instrumental"}})+model("mureka-9-5-instrumental", "Mureka 9.5 Instrumental", "Mureka", "mureka", "audio", "Mureka's newest instrumental tracks and beds, no vocals",+ [("music", "mureka/v9.5/generate/instrumental")], badges=["new"], pricing=("request", 0.15))model("mureka-9-instrumental", "Mureka 9 Instrumental", "Mureka", "mureka", "audio", "Instrumental tracks and beds, no vocals",[("music", "mureka/v9/generate/instrumental")], badges=["new"], pricing=("request", 0.045))+# Mureka's earlier versions stay on the versioned route (fal serves 7.6, O2 and 8 there; 9 and 9.5 have routes of their own).+# Its duration is a 9.5 field only, and its Version is always sent (the route's own default is 9.5). With lyrics 7.6 costs+# $0.03, O2 and 8 $0.045; from a prompt all three $0.30.+model("mureka-8", "Mureka 8", "Mureka", "mureka", "audio", "Mureka's earlier versions (8, O2, 7.6), for songs made with them",+ [("music", "mureka/api/generate/song", "fal", {"drop": ["duration"]})],+ pricing=("request", 0.30, "a song from a prompt; with your lyrics $0.045 ($0.03 on 7.6)", {"withLyrics": 0.045}),+ options={"controls": [{"param": "model", "label": "Version", "values": ["mureka-8", "mureka-o2", "mureka-7.6"], "default": "mureka-8",+ "labels": {"mureka-8": "Mureka 8", "mureka-o2": "Mureka O2", "mureka-7.6": "Mureka 7.6"}}],+ "lyrics": {"instrumentalModel": "mureka-9-instrumental"}},+ api_defaults={"model": "mureka-8"})# MiniMax Music 3 is the open model the open engine runs too (oss-minimax-music-3): the same weights, hosted. Its lyrics are# required: a run with none asks for an instrumental.model("minimax-music-3", "MiniMax Music 3 · both engines", "MiniMax", "minimax-music", "audio", "Full songs with expressive vocals up to 5 minutes, from your lyrics and a style",@@ -2167,7 +2182,11 @@ def build_route(op, ep, provider, m, opts, ropts=None):if op in ("music", "song-extend", "song-remix") and "lyrics" in kf and (inputs.get(kf["lyrics"]) or {}).get("type") == "string":spec = inputs.get(kf["lyrics"]) or {}most = num(spec.get("maxLength"))- fmap["lyrics"] = {"key": kf["lyrics"], **({"max": most} if most else {})}+ # An API with an instrumental switch (MiniMax Music 2.5's is_instrumental) gets it for lyrics that are only+ # [Instrumental], with its own lyrics writer (lyrics_optimizer) off.+ fmap["lyrics"] = {"key": kf["lyrics"], **({"max": most} if most else {}),+ **({"instrumental": kf["instrumental"]} if kf.get("instrumental") in inputs else {}),+ **({"autoLyrics": kf["autoLyrics"]} if kf.get("autoLyrics") in inputs else {})}# Required by the API with no fallback of Fuobe's (MiniMax Music 3 asks for an instrumental when there are none).needed = spec.get("required") and kf["lyrics"] not in (m.get("api_defaults") or {})opts["lyrics"] = {**({"max": most} if most else {}), **({"required": True} if needed else {})}@@ -2324,7 +2343,8 @@ for m in M:# No route sends a prompt (try-on, 3D, transcription): planning and the composer don't ask for one.if all(r["map"].get("prompt") is False for r in routes):opts["promptless"] = True- opts.update(m["options"])+ # The lyrics options read from the schema (max, required) keep what the model adds to them (its instrumental model).+ opts.update({k: ({**opts[k], **v} if k == "lyrics" and isinstance(opts.get(k), dict) else v) for k, v in m["options"].items()})# A model-wide control or slider goes only to the routes whose schema has its field (Ideogram Vector's# quality is a text-to-vector setting; image-to-vector has none).offered = [c["param"] for c in opts.get("controls", [])] + [x["param"] for x in opts.get("sliders", [])]diff --git a/src/components/faceless/settings-form.tsx b/src/components/faceless/settings-form.tsxindex 004e083b..200a67d3 100644--- a/src/components/faceless/settings-form.tsx+++ b/src/components/faceless/settings-form.tsx@@ -248,7 +248,7 @@ export function EpisodeSettingsForm({</Section>)}{value.music && beds.length > 1 && (- <Section title="Music" hint="Longer films play the bed again, with a soft crossfade on your GPU.">+ <Section title="Music" hint={value.engine === "open" ? "Longer films play the bed again, with a soft crossfade." : "Longer films play the bed again from the start."}><Segmentedlabel="Music model"value={bed?.id ?? ""}diff --git a/src/components/studio/lyrics-editor.tsx b/src/components/studio/lyrics-editor.tsxindex 728fb9ea..4102347e 100644--- a/src/components/studio/lyrics-editor.tsx+++ b/src/components/studio/lyrics-editor.tsx@@ -5,7 +5,7 @@ import { useId, useRef, useState } from "react";import { toast } from "sonner";import { writeLyrics } from "@/lib/api";import type { ModelDef } from "@/lib/catalog/types";-import { INSTRUMENTAL, insertTag, isInstrumental, normalizeLyrics, SECTION_TAGS, songLength, structureOf } from "@/lib/lyrics";+import { INSTRUMENTAL, insertTag, isInstrumental, normalizeLyrics, promptWithLyrics, SECTION_TAGS, songLength, structureOf } from "@/lib/lyrics";import { toastError } from "@/lib/refusals";import { cn } from "@/lib/utils";@@ -36,7 +36,8 @@ export function LyricsEditor({const area = useRef<HTMLTextAreaElement>(null);const [writing, setWriting] = useState(false);const spec = model.options.lyrics ?? {};- const length = normalizeLyrics(value).length;+ // Lyrics read after the description (Lyria 3.5) count with it.+ const length = spec.inPrompt && value.trim() ? promptWithLyrics(idea, value).length : normalizeLyrics(value).length;const over = !!spec.max && length > spec.max;const structure = structureOf(value);const instrumental = !!value.trim() && isInstrumental(value);@@ -82,7 +83,7 @@ export function LyricsEditor({{writing ? <Loader2 className="size-3.5 animate-spin" /> : <Sparkles className="size-3.5" />}{writing ? "Writing…" : "Write the lyrics"}</button>- {!spec.required && (+ {!spec.required && !spec.instrumentalModel && (<buttontype="button"onClick={() => onChange(instrumental ? "" : INSTRUMENTAL)}diff --git a/src/lib/catalog/cloud-models.generated.ts b/src/lib/catalog/cloud-models.generated.tsindex a578b2cb..6ec8761f 100644--- a/src/lib/catalog/cloud-models.generated.ts+++ b/src/lib/catalog/cloud-models.generated.ts@@ -12594,7 +12594,9 @@ export const CLOUD_MODELS: ModelDef[] = ["map": {"lyrics": {"key": "lyrics",- "max": 3500+ "max": 3500,+ "instrumental": "is_instrumental",+ "autoLyrics": "lyrics_optimizer"},"fixed": {"lyrics_optimizer": true@@ -12686,7 +12688,8 @@ export const CLOUD_MODELS: ModelDef[] = [],"options": {"lyrics": {- "max": 5000+ "max": 5000,+ "instrumentalModel": "mureka-9-5-instrumental"},"durations": [120,@@ -12728,7 +12731,8 @@ export const CLOUD_MODELS: ModelDef[] = [],"options": {"lyrics": {- "max": 5000+ "max": 5000,+ "instrumentalModel": "mureka-9-instrumental"}},"badges": [@@ -12741,6 +12745,31 @@ export const CLOUD_MODELS: ModelDef[] = ["withLyrics": 0.045}},+ {+ "id": "mureka-9-5-instrumental",+ "name": "Mureka 9.5 Instrumental",+ "vendor": "Mureka",+ "family": "mureka",+ "engine": "cloud",+ "kind": "audio",+ "tagline": "Mureka's newest instrumental tracks and beds, no vocals",+ "routes": [+ {+ "op": "music",+ "provider": "fal",+ "endpoint": "mureka/v9.5/generate/instrumental",+ "map": {}+ }+ ],+ "options": {},+ "badges": [+ "new"+ ],+ "pricing": {+ "unit": "request",+ "usd": 0.15+ }+ },{"id": "mureka-9-instrumental","name": "Mureka 9 Instrumental",@@ -12766,6 +12795,60 @@ export const CLOUD_MODELS: ModelDef[] = ["usd": 0.045}},+ {+ "id": "mureka-8",+ "name": "Mureka 8",+ "vendor": "Mureka",+ "family": "mureka",+ "engine": "cloud",+ "kind": "audio",+ "tagline": "Mureka's earlier versions (8, O2, 7.6), for songs made with them",+ "routes": [+ {+ "op": "music",+ "provider": "fal",+ "endpoint": "mureka/api/generate/song",+ "map": {+ "lyrics": {+ "key": "lyrics",+ "max": 5000+ },+ "defaults": {+ "model": "mureka-8"+ }+ }+ }+ ],+ "options": {+ "lyrics": {+ "max": 5000,+ "instrumentalModel": "mureka-9-instrumental"+ },+ "controls": [+ {+ "param": "model",+ "label": "Version",+ "values": [+ "mureka-8",+ "mureka-o2",+ "mureka-7.6"+ ],+ "default": "mureka-8",+ "labels": {+ "mureka-8": "Mureka 8",+ "mureka-o2": "Mureka O2",+ "mureka-7.6": "Mureka 7.6"+ }+ }+ ]+ },+ "pricing": {+ "unit": "request",+ "usd": 0.3,+ "note": "a song from a prompt; with your lyrics $0.045 ($0.03 on 7.6)",+ "withLyrics": 0.045+ }+ },{"id": "minimax-music-3","name": "MiniMax Music 3 \u00b7 both engines",diff --git a/src/lib/catalog/payload.ts b/src/lib/catalog/payload.tsindex a709ebd1..6654373a 100644--- a/src/lib/catalog/payload.ts+++ b/src/lib/catalog/payload.ts@@ -1,5 +1,5 @@import { readTimeline, timelineTracks } from "@/lib/av/timeline";-import { LYRICS_PARAM, lyricsOf, promptWithLyrics, SONG_ID_PARAM } from "@/lib/lyrics";+import { isInstrumental, LYRICS_PARAM, lyricsOf, promptWithLyrics, SONG_ID_PARAM } from "@/lib/lyrics";import { toH3MaxTrajectory, type CameraKey } from "@/lib/camera-path";import { upscaleFactorFor } from "@/lib/av/upscale";import { carriesBoxes, carriesLayout, LAYOUT_PARAM } from "@/lib/layout-prompt";@@ -540,7 +540,11 @@ export function buildPayload(map: FieldMap, input: GenInput): Record<string, unkconst songId = input.extra?.[SONG_ID_PARAM];if (map.songSource && typeof songId === "string" && songId.trim()) out[map.songSource.songId] = songId.trim();const lyrics = map.lyrics ? lyricsOf(input.extra) : "";- if (lyrics && map.lyrics?.key) out[map.lyrics.key] = lyrics;+ if (lyrics && map.lyrics?.instrumental && isInstrumental(lyrics)) {+ // An instrumental, by the API's own switch (MiniMax Music 2.5): no words, and nothing written for it.+ out[map.lyrics.instrumental] = true;+ if (map.lyrics.autoLyrics) out[map.lyrics.autoLyrics] = false;+ } else if (lyrics && map.lyrics?.key) out[map.lyrics.key] = lyrics;else if (lyrics && map.lyrics?.inPrompt && map.prompt !== false) {const key = map.prompt ?? "prompt";setPath(out, key, promptWithLyrics(typeof out[key] === "string" ? (out[key] as string) : (input.prompt ?? ""), lyrics));diff --git a/src/lib/catalog/plan.ts b/src/lib/catalog/plan.tsindex 57829443..1da456ec 100644--- a/src/lib/catalog/plan.ts+++ b/src/lib/catalog/plan.ts@@ -21,7 +21,7 @@ import { characterScale, CINEMA_CROP, soulKind, soulMegapixels, soulRecipe, soulimport { computeDimensions, fitCanvas } from "@/lib/comfy";import { carriesLayout, flux3Boxes, flux3Caption, layoutCompilerFor, LAYOUT_MAX_SIDE, LAYOUT_MULTIPLE, LAYOUT_PARAM, readLayout, validateLayout, type LayoutDraft, type LayoutFormat } from "@/lib/layout-prompt";import { pricingOn, type PriceClock } from "./promo";-import { isInstrumental, lyricsOf, lyricsProblem, LYRICS_PARAM } from "@/lib/lyrics";+import { isInstrumental, lyricsOf, lyricsProblem, LYRICS_PARAM, promptLyricsProblem } from "@/lib/lyrics";import { presetRoutes } from "./preset-recipe-routes";export { pricingAt } from "./promo";@@ -498,9 +498,14 @@ export function planGeneration(const words = lyricsOf(params.extra);const rest = { ...params.extra };delete rest[LYRICS_PARAM];- if (model.options.lyrics && words) {- const problem = lyricsProblem(words, model.options.lyrics.max, model.name);+ const spec = model.options.lyrics;+ if (spec && words) {+ // Lyrics read after the description (Lyria 3.5) share its limit with it.+ const problem = spec.inPrompt && spec.max ? promptLyricsProblem(prompt, words, spec.max, model.name) : lyricsProblem(words, spec.max, model.name);if (problem) throw new Error(problem);+ // A model that sings words only (Mureka's songs): an instrumental is its maker's instrumental model.+ const own = spec.instrumentalModel && op === "music" && isInstrumental(words) ? getModel(spec.instrumentalModel) : undefined;+ if (own) throw new Error(`${model.name} sings the lyrics you write: for an instrumental, pick ${own.name}`);params = { ...params, extra: { ...rest, [LYRICS_PARAM]: words } };} else {if (words && !isInstrumental(words) && op === "music") notes.push(`${model.name} writes its own words from your description: the lyrics aren't sent`);diff --git a/src/lib/catalog/replaced.ts b/src/lib/catalog/replaced.tsindex 78367b6b..83b7751a 100644--- a/src/lib/catalog/replaced.ts+++ b/src/lib/catalog/replaced.ts@@ -142,6 +142,26 @@ const sentence = (a: string | undefined, b: string): string => {return head ? `${head}. ${b}` : b;};+/** Mureka's earlier song versions, run by the versioned route's model (mureka-8 · its Version control). */+const MUREKA_EARLIER = new Set(["mureka-8", "mureka-o2", "mureka-7.6"]);++/**+ * A Mureka song saved with its Version (params.extra.model, when mureka-song ran every version on one route) goes to the+ * model that runs that version now: Mureka 9 to its own model, 8, O2 and 7.6 to Mureka 8 with the Version kept; 9.5 stays+ * (the setting is dropped). The same version runs, so nothing to say. Null for any other request.+ */+function murekaVersion<T extends StoredRequest>(req: T): T | null {+ const version = req.modelId === "mureka-song" ? req.params?.extra?.model : undefined;+ if (typeof version !== "string") return null;+ if (MUREKA_EARLIER.has(version)) return { ...req, modelId: "mureka-8" };+ if (version !== "mureka-9" && version !== "mureka-9.5") return null;+ const extra = { ...req.params!.extra };+ delete extra.model;+ const params = { ...req.params, extra: Object.keys(extra).length ? extra : undefined };+ if (!params.extra) delete params.extra;+ return { ...req, ...(version === "mureka-9" && { modelId: "mureka-9" }), params };+}+/*** A stored request (Reuse, a saved project's step, an Assist plan, a retry, a script) moved to the model that does its* job now, with what still means something kept: a Soul style id becomes the Fuobe look that replaced it (`presetId`),@@ -151,6 +171,8 @@ const sentence = (a: string | undefined, b: string): string => {* returned as it is. `note` says what changed, for a toast or the API's notes.*/export function migrateRequest<T extends StoredRequest>(req: T, opts: MigrateOptions = {}): { request: T; note?: string } {+ const version = murekaVersion(req);+ if (version) return { request: version };const r = replacedBy(req.modelId);const refs = !!(req.inputs?.images?.length || req.inputs?.videos?.length || req.inputs?.audios?.length);const op = req.op ?? (r?.withReferences && refs ? r.withReferences : undefined);diff --git a/src/lib/catalog/types.ts b/src/lib/catalog/types.tsindex b0f0c39c..03f4b45f 100644--- a/src/lib/catalog/types.ts+++ b/src/lib/catalog/types.ts@@ -536,9 +536,11 @@ export interface FieldMap {/*** Song lyrics (params.extra.lyrics, section tags such as [Verse] on lines of their own: src/lib/lyrics.ts): the API's lyrics* field and the most characters it takes, or (`inPrompt`) written after the prompt for an API that reads them there- * (Lyria 3.5). A route without it never sends params.extra.lyrics.+ * (Lyria 3.5). A route without it never sends params.extra.lyrics. `instrumental`: the API's switch for a song with no+ * vocals (MiniMax Music 2.5's is_instrumental), sent in place of lyrics that are only [Instrumental], with its own lyrics+ * writer (`autoLyrics`) off.*/- lyrics?: { key?: string; inPrompt?: true; max?: number };+ lyrics?: { key?: string; inPrompt?: true; max?: number; instrumental?: string; autoLyrics?: string };/*** A song tool's source song (Mureka extend / remix): one of the provider's own songs by id (params.extra.songId, kept on a* result as meta.songId) in `songId`, else the song file (inputs.audio) sent first to `upload` (Mureka's files/upload with@@ -633,8 +635,10 @@ export interface ModelOptions {/*** The model sings lyrics (Audio → Music's lyrics editor, params.extra.lyrics): the most characters it takes, and whether they* go after the prompt (Lyria 3.5) rather than in a field of their own. Section tags ([Verse], [Chorus]) on lines of their own.+ * `instrumentalModel`: the model sings words only, and its maker's instrumental model is this one (Mureka 9.5 → Mureka 9.5+ * Instrumental): the editor offers no Instrumental, and lyrics that are only [Instrumental] are refused with its name.*/- lyrics?: { max?: number; inPrompt?: true; required?: true };+ lyrics?: { max?: number; inPrompt?: true; required?: true; instrumentalModel?: string };/** Takes a song to cover (inputs.audio: YuE2 sings its melody with the new style and lyrics). */cover?: true;/** Draft mode (cheap preview, then a full render of the take you like). */diff --git a/src/lib/lyrics.ts b/src/lib/lyrics.tsindex 7862fdd4..cafc99d2 100644--- a/src/lib/lyrics.ts+++ b/src/lib/lyrics.ts@@ -124,6 +124,15 @@ export function lyricsProblem(text: string, max: number | undefined, model = "Threturn null;}+/** What is wrong with a description and lyrics read as one text of up to `max` characters (Lyria 3.5); null when they fit. */+export function promptLyricsProblem(prompt: string, lyrics: string, max: number, model = "This model"): string | null {+ const n = promptWithLyrics(prompt, lyrics).length;+ if (n > max) {+ return `${model} reads up to ${max.toLocaleString("en-US")} characters of description and lyrics together: these are ${n.toLocaleString("en-US")}. Shorten them or drop a verse`;+ }+ return null;+}+/** The prompt with the lyrics after it, for a model that reads both in one text (Lyria 3.5). */export function promptWithLyrics(prompt: string, lyrics: string): string {const words = normalizeLyrics(lyrics);diff --git a/src/server/enhance.ts b/src/server/enhance.tsindex 9545649d..e3e2107f 100644--- a/src/server/enhance.ts+++ b/src/server/enhance.ts@@ -203,7 +203,14 @@ export async function writeLyrics(idea: string, o: { seconds?: number; max?: numconst text = await llmText(LYRICS_SYSTEM, `Write lyrics for this song, about ${Math.round(seconds / 60 * 10) / 10} minutes long: ${sections}.${room}\n\n${idea.trim()}`);const words = normalizeLyrics(text?.replace(/^```\w*\n?|```$/g, ""));if (!words) return null;- return o.max && words.length > o.max ? normalizeLyrics(words.slice(0, words.lastIndexOf("\n", o.max))) : words;+ return o.max && words.length > o.max ? trimLyrics(words, o.max) : words;+}++/** Lyrics cut to at most `max` characters at the last line break before it (at `max` itself when there is none). */+export function trimLyrics(words: string, max: number): string {+ const cut = words.lastIndexOf("\n", max);+ const out = normalizeLyrics(words.slice(0, cut > 0 ? cut : max));+ return out.length > max ? out.slice(0, max).trimEnd() : out;}export async function enhancePrompt(prompt: string, kind: MediaKind, op: Operation): Promise<string> {diff --git a/src/server/faceless.ts b/src/server/faceless.tsindex 4a78c114..83fe3302 100644--- a/src/server/faceless.ts+++ b/src/server/faceless.ts@@ -741,9 +741,25 @@ export function withOfferedVideo(s: EpisodeSettings): EpisodeSettings {return !id || id === m.video ? s : { ...s, videoModel: id };}+/**+ * An episode's settings with the music bed model Settings → Models & licences offers, as the settings show it: the pick+ * while it is on, else the engine's default, else the first bed model that is on. A bed switched off after an episode+ * picked it gives way, rather than stopping the film at its music.+ */+export function withOfferedMusic(s: EpisodeSettings): EpisodeSettings {+ if (!s.music) return s;+ const m = ENGINE_MODELS[s.engine];+ const picked = s.musicModel && m.musicChoices.includes(s.musicModel) ? s.musicModel : undefined;+ const id = firstOn([...(picked ? [picked] : []), m.music, ...m.musicChoices], s.engine);+ return !id || id === (picked ?? m.music) ? s : { ...s, musicModel: id };+}++/** An episode's settings with the video and music bed models that are on (withOfferedVideo, withOfferedMusic). */+export const withOfferedModels = (s: EpisodeSettings): EpisodeSettings => withOfferedMusic(withOfferedVideo(s));+function graphInput(ep: FacelessEpisode, blocks = ep.script.blocks, stillEdits?: StillEdits): GraphInput {const genre = genreInfo(ep.channelId ? getChannel(ep.channelId)?.genre : "education");- const s = withOfferedVideo(ep.settings);+ const s = withOfferedModels(ep.settings);const narration = ENGINE_MODELS[s.engine].narration;let fallbackVoice: string | undefined;if (s.engine === "open" && s.voice?.kind !== "sample") {@@ -857,7 +873,7 @@ function narrationCues(ep: FacelessEpisode): TimedText[] | null {function advance(ep: FacelessEpisode): FacelessEpisode {const plan = ep.plan!;const blocks = ep.script.blocks;- const video = getModel(resolveModels(withOfferedVideo(ep.settings), narrationText(blocks).length, getModel).video);+ const video = getModel(resolveModels(withOfferedModels(ep.settings), narrationText(blocks).length, getModel).video);const cues = narrationCues(ep);const spoken = cues ? spokenTimes(blocks, cues) : null;const timing = spoken ? sceneTiming(blocks, spoken, video, plan.timing) : (plan.timing ?? plannedTiming(blocks, video));@@ -1237,7 +1253,7 @@ function graphInputSafe(ep: FacelessEpisode): GraphInput {try {return graphInput(ep);} catch {- return { feature: ep.kind, title: ep.title, genre: genreInfo(ep.channelId ? getChannel(ep.channelId)?.genre : "education"), settings: withOfferedVideo(ep.settings), blocks: ep.script.blocks, fallbackVoice: "/api/files/placeholder.wav" };+ return { feature: ep.kind, title: ep.title, genre: genreInfo(ep.channelId ? getChannel(ep.channelId)?.genre : "education"), settings: withOfferedModels(ep.settings), blocks: ep.script.blocks, fallbackVoice: "/api/files/placeholder.wav" };}}@@ -1349,7 +1365,7 @@ export function estimateEpisode(input: { kind: "faceless" | "explainer"; setting/** What the render will do differently from what was asked (nothing that stops it). */function notesFor(settings: EpisodeSettings, seconds: number): { notes?: string[] } {const notes: string[] = [];- const m = resolveModels(withOfferedVideo(settings), 0, getModel);+ const m = resolveModels(withOfferedModels(settings), 0, getModel);const limit = styleRefLimit(settings.engine, getModel);if (settings.styleRefs.length > limit) notes.push(`The open-source picture model follows the first ${limit} style references.`);if (settings.engine === "open" && settings.styleRefs.length && settings.sourceImages?.length) notes.push("Your style references set the look; the attached images aren't used for the open-source pictures.");diff --git a/tests/lyrics.test.ts b/tests/lyrics.test.tsindex a01c0677..e79f7cb4 100644--- a/tests/lyrics.test.ts+++ b/tests/lyrics.test.ts@@ -90,3 +90,13 @@ describe("a song's Mureka id on Reuse", () => {expect(withSongId({ lyrics: "x" }, song, "/api/files/a.mp3", false)).toEqual({ lyrics: "x" });});});++describe("written lyrics cut to a model's limit", () => {+ it("at the last line break before it, or at the limit when there is none", async () => {+ const { trimLyrics } = await import("@/server/enhance");+ expect(trimLyrics("[Verse]\nabc def\nghi jkl", 16)).toBe("[Verse]\nabc def");+ const one = `[Verse]\n${"a".repeat(50)}`;+ expect(trimLyrics(one.replace("\n", " "), 20).length).toBeLessThanOrEqual(20);+ expect(trimLyrics("x".repeat(40), 10)).toBe("x".repeat(10));+ });+});diff --git a/tests/model-access-studios.test.ts b/tests/model-access-studios.test.tsindex 247761e2..2e78584c 100644--- a/tests/model-access-studios.test.ts+++ b/tests/model-access-studios.test.ts@@ -22,7 +22,7 @@ const { changeAccess, firstOn, isOffered } = await import("@/server/model-accessconst { toolModel } = await import("@/server/layers");const { planKatana } = await import("@/server/katana");const { multiplierModel } = await import("@/server/marketing");-const { withOfferedVideo } = await import("@/server/faceless");+const { withOfferedMusic, withOfferedVideo } = await import("@/server/faceless");const { setSetting } = await import("@/server/settings");afterAll(() => fs.rmSync(dir, { recursive: true, force: true }));@@ -95,4 +95,15 @@ describe("a studio's default on the server", () => {// A pick stays the pick.expect(withOfferedVideo({ ...settings, videoModel: "gemini-omni-flash" }).videoModel).toBe("gemini-omni-flash");});++ it("Faceless's music bed gives way when the one picked is switched off, as its picker shows", () => {+ const settings = { engine: "cloud" as const, animation: "animated", music: true, musicModel: "minimax-music-3" } as Parameters<typeof withOfferedMusic>[0];+ expect(withOfferedMusic(settings)).toBe(settings);+ changeAccess([{ kind: "model", id: "minimax-music-3", on: false }]);+ expect(withOfferedMusic(settings).musicModel).toBe("sonilo-music");+ changeAccess([{ kind: "model", id: "sonilo-music", on: false }]);+ expect(withOfferedMusic(settings).musicModel).toBe("elevenlabs-music-2-5");+ // No bed, nothing to change.+ expect(withOfferedMusic({ ...settings, music: false })).toEqual({ ...settings, music: false });+ });});diff --git a/tests/music3-cloud.test.ts b/tests/music3-cloud.test.tsindex c5841b1e..76f5a3f3 100644--- a/tests/music3-cloud.test.ts+++ b/tests/music3-cloud.test.ts@@ -12,6 +12,7 @@ import type { GenerationRequest, ModelRoute, Operation } from "@/lib/catalog/typimport { nextSteps, outputActions } from "@/lib/output-actions";import { downloadName } from "@/lib/library";import { songFormat, songToolProblem } from "@/lib/lyrics";+import { migrateRequest } from "@/lib/catalog/replaced";import type { Generation } from "@/lib/catalog/types";const route = (id: string, op?: Operation): ModelRoute => {@@ -100,6 +101,44 @@ describe("Mureka 9 / 9.5", () => {});});+describe("Mureka's versions", () => {+ it("Mureka 9.5 Instrumental: a description, $0.15 a track", () => {+ expect(payload("mureka-9-5-instrumental", { prompt: "Warm lo-fi bed" })).toEqual({ prompt: "Warm lo-fi bed" });+ expect(cost("mureka-9-5-instrumental")).toBe(0.15);+ });++ it("Mureka 8, O2 and 7.6 stay on the versioned route, the Version always sent", () => {+ expect(route("mureka-8").endpoint).toBe("mureka/api/generate/song");+ expect(payload("mureka-8", { prompt: "pop" })).toEqual({ prompt: "pop", model: "mureka-8" });+ expect(payload("mureka-8", { prompt: "pop", duration: 180, extra: { model: "mureka-7.6", lyrics: "[Verse]\nla" } })).toEqual({ prompt: "pop", model: "mureka-7.6", lyrics: "[Verse]\nla" });+ expect(cost("mureka-8")).toBe(0.3);+ expect(cost("mureka-8", { extra: { lyrics: "[Verse]\nla" } })).toBe(0.045);+ });++ it("a song saved with its Version runs that version again", () => {+ const saved = (model: string) => migrateRequest({ modelId: "mureka-song", prompt: "pop", params: { duration: 180, extra: { model, seed: 3 } } });+ expect(saved("mureka-9")).toEqual({ request: { modelId: "mureka-9", prompt: "pop", params: { duration: 180, extra: { seed: 3 } } } });+ expect(saved("mureka-9.5")).toEqual({ request: { modelId: "mureka-song", prompt: "pop", params: { duration: 180, extra: { seed: 3 } } } });+ expect(saved("mureka-7.6").request).toMatchObject({ modelId: "mureka-8", params: { extra: { model: "mureka-7.6" } } });+ expect(saved("mureka-o2").request.modelId).toBe("mureka-8");+ expect(migrateRequest({ modelId: "mureka-song", params: { extra: { model: "mureka-9" } } }).request).toEqual({ modelId: "mureka-9", params: {} });+ // Today's runs are left as they are.+ const now = { modelId: "mureka-song", prompt: "pop" };+ expect(migrateRequest(now).request).toBe(now);+ });++ it("a Mureka song sings words: an instrumental is its instrumental model", () => {+ expect(planError({ modelId: "mureka-song", prompt: "pop", params: { extra: { lyrics: "[Instrumental]" } } })).toBe("Mureka 9.5 sings the lyrics you write: for an instrumental, pick Mureka 9.5 Instrumental");+ expect(planError({ modelId: "mureka-9", prompt: "pop", params: { extra: { lyrics: "[Instrumental]" } } })).toBe("Mureka 9 sings the lyrics you write: for an instrumental, pick Mureka 9 Instrumental");+ expect(getModel("mureka-song")!.options.lyrics).toEqual({ max: 5000, instrumentalModel: "mureka-9-5-instrumental" });+ });++ it("MiniMax Music 2.5 makes an instrumental by its own switch, with no words written for it", () => {+ expect(payload("minimax-music-2-5", { prompt: "lo-fi", extra: { lyrics: "[Instrumental]" } })).toEqual({ prompt: "lo-fi", is_instrumental: true, lyrics_optimizer: false });+ expect(payload("minimax-music-2-5", { prompt: "lo-fi", extra: { lyrics: "[Verse]\nla" } })).toEqual({ prompt: "lo-fi", lyrics: "[Verse]\nla", lyrics_optimizer: true });+ });+});+describe("ElevenLabs Music v2.5 and Lyria 3.5", () => {it("ElevenLabs takes a length in milliseconds and bills each started minute", () => {expect(payload("elevenlabs-music-2-5", { prompt: "Synthwave", duration: 90, seed: 3 })).toEqual({ prompt: "Synthwave", music_length_ms: 90000 });@@ -108,6 +147,12 @@ describe("ElevenLabs Music v2.5 and Lyria 3.5", () => {expect(getModel("elevenlabs-music-2-5")!.options.lyrics).toBeUndefined();});+ it("Lyria 3.5 counts the description and the lyrics together against its 5,000 characters", () => {+ const lyrics = `[Verse]\n${"la la la la\n".repeat(380)}`.trim();+ expect(plan({ modelId: "lyria-3-5", prompt: "x".repeat(200), params: { extra: { lyrics } } }).op).toBe("music");+ expect(planError({ modelId: "lyria-3-5", prompt: "x".repeat(510), params: { extra: { lyrics } } })).toMatch(/^Lyria 3\.5 reads up to 5,000 characters of description and lyrics together: these are 5,\d{3}\. Shorten them or drop a verse$/);+ });+it("Lyria 3.5 reads the lyrics after the description, takes a picture, and has no negative prompt", () => {expect(payload("lyria-3-5", { prompt: "Uplifting pop, 120 BPM", images: ["https://x/p.png"], extra: { lyrics: "[chorus] rise up" } })).toEqual({prompt: "Uplifting pop, 120 BPM.\n\nLyrics:\n[Chorus]\nrise up",