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.

Mureka Extend and Remix: check an uploaded song against Mureka's upload rules

Adarsh9c4b9a29e4ee
diff --git a/src/components/studio/composer.tsx b/src/components/studio/composer.tsx
index 3df5f475..33cab79f 100644
--- a/src/components/studio/composer.tsx
+++ b/src/components/studio/composer.tsx
@@ -775,9 +775,11 @@ export function Composer({ docked }: { docked: boolean }) {
// A voice outside what a hosted talking-avatar model takes (H3 Max lip sync: 5 s to 15 min), as the server would say.
const voiceProblem = op === "avatar" && voiceRef && voice?.duration && model ? voiceWindowProblem(model, voice.duration) : null;
if (voiceProblem && !planError) planError = voiceProblem;
- // A song Mureka's tools refuse (Stems: MP3 or M4A; Remix: 10 s to 5:50), from its name and header, as the server does.
- const songRef = config.voiceFacts && (op === "song-stems" || op === "song-remix") ? draft.slots.audio?.ref : undefined;
- const songProblem = songRef ? songToolProblem(op!, { format: songFormat(undefined, songRef), seconds: voice?.duration }) : null;
+ // A song Mureka's tools refuse (Stems: MP3 or M4A; Remix: 10 s to 5:50; Extend and Remix of a song Mureka didn't make: MP3
+ // or M4A), from its name and header, as the server does. One of Mureka's own goes by its id (withSongId), never as a file.
+ const songRef = config.voiceFacts && (op === "song-stems" || op === "song-remix" || op === "song-extend") ? draft.slots.audio?.ref : undefined;
+ const songById = model?.family === "mureka" && !!draft.song && !!songRef && draft.song.url === songRef;
+ const songProblem = songRef ? songToolProblem(op!, { format: songFormat(undefined, songRef), seconds: voice?.duration }, songById) : null;
if (songProblem && !planError) planError = songProblem;
if (signed.blocker) planError = signed.blocker;
// References mode: Pika's limits (12 files, 2-15 s each, 15 s a group), checked on the clips' lengths before anything runs.
diff --git a/src/server/generations.ts b/src/server/generations.ts
index 260cdf80..0754d784 100644
--- a/src/server/generations.ts
+++ b/src/server/generations.ts
@@ -3373,14 +3373,16 @@ async function handOver(id: string, route: ModelRoute, providerId: ProviderId, p
});
};
// A song tool's song (Mureka): its length read as a voice's is, and one Mureka refuses (Stems: MP3 or M4A, 10 MB; Remix:
- // 10 to 350 seconds) refused here, before it's sent to Mureka or paid for.
+ // 10 to 350 seconds; Extend and Remix of a song Mureka didn't make, which goes through its files/upload first: MP3 or M4A,
+ // and 10 MB for Extend) refused here, before it's sent to Mureka or paid for. One of Mureka's own goes by its id.
+ const songById = typeof plan.params.extra?.songId === "string" && plan.params.extra.songId.trim() !== "";
const prepSong = async (ref?: string) => {
if (!ref) return undefined;
return gate(async () => {
const f = await readRef(ref);
const facts = mediaFacts(f.data);
if (facts.duration && !source.sourceDuration) source = { ...source, sourceDuration: facts.duration };
- const problem = providerId === "mock" ? null : songToolProblem(plan.op, { format: songFormat(f.contentType, f.name), bytes: f.data.length, seconds: facts.duration });
+ const problem = providerId === "mock" ? null : songToolProblem(plan.op, { format: songFormat(f.contentType, f.name), bytes: f.data.length, seconds: facts.duration }, songById);
if (problem) throw new Error(problem);
return upload(`file:${ref}`, f.data, f.contentType, f.name);
});
@@ -3498,7 +3500,7 @@ async function handOver(id: string, route: ModelRoute, providerId: ProviderId, p
// Extending a song (Mureka): the new part starts at its end (or, before its start, at 0) unless the run says where.
if (plan.op === "song-extend" && input.startTime === undefined) {
const head = input.extra?.extend_type === "head";
- if (!head && !(input.sourceDuration && input.sourceDuration > 0)) throw new Error("The song's length couldn't be read: add it again as an MP3, WAV or M4A file");
+ if (!head && !(input.sourceDuration && input.sourceDuration > 0)) throw new Error("The song's length couldn't be read: add it again as an MP3 or M4A file");
input.startTime = head ? 0 : input.sourceDuration;
}
// A talking avatar renders as long as its voice: priced for it once its header is read (an API call that didn't say).
diff --git a/tests/mureka-upload-spec.test.ts b/tests/mureka-upload-spec.test.ts
index d62fc466..13457add 100644
--- a/tests/mureka-upload-spec.test.ts
+++ b/tests/mureka-upload-spec.test.ts
@@ -67,8 +67,7 @@ async function run(modelId: string, audio: string, extra: Record<string, unknown
return getGeneration(g.id)!;
}
-// Skipped until the server side lands: src/lib/lyrics.ts songToolProblem, src/server/generations.ts prepSong and src/server/providers/fal.ts uploadSong (retry on X-Fal-Needs-Retry). It fails without that change.
-describe.skip("a song Mureka's files/upload takes", () => {
+describe("a song Mureka's files/upload takes", () => {
it("refuses a WAV for Extend and Remix before anything reaches fal.ai, and sends one of Mureka's own by its id", async () => {
fal.log.length = 0;
fal.script = null;
@@ -87,7 +86,7 @@ describe.skip("a song Mureka's files/upload takes", () => {
});
});
-describe.skip("fal.ai's synchronous upload", () => {
+describe("fal.ai's synchronous upload", () => {
it("is sent again when fal.ai marks the failure temporary (X-Fal-Needs-Retry: 1), and not when it doesn't", async () => {
fal.log.length = 0;
let first = true;