From ba998b6a829efc4b2df96aaeb48ca04300e8cc7e Mon Sep 17 00:00:00 2001 From: teahubxyz Date: Wed, 21 Oct 2026 01:42:33 +0000 Subject: [PATCH] =?UTF-8?q?inference:=20a=20reference=20track=20sets=20the?= =?UTF-8?q?=20length=20=E2=80=94=20Runware=20refuses=20duration=20alongsid?= =?UTF-8?q?e=20inputs.audio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01K6897PWcUEwHiqZMcVnNF6 --- .github/time/cloudflare/inference.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/time/cloudflare/inference.js b/.github/time/cloudflare/inference.js index 19e33df..6689233 100644 --- a/.github/time/cloudflare/inference.js +++ b/.github/time/cloudflare/inference.js @@ -87,7 +87,7 @@ async function renderRunware(body, env) { duration: Math.max(30, Math.min(num(body.duration, 120), num(env.AUDIO_SECONDS, 120))), outputType: "URL", outputFormat: "MP3", deliveryMethod: "sync", includeCost: true, audioSettings: { bitrate: 192, channels: 2, sampleRate: 44100 }, settings: {} }; if (Number.isInteger(+body.seed) && +body.seed >= 0) task.seed = Math.min(2147483647, +body.seed); - if (typeof body.reference === "string" && /^data:audio\/[a-z0-9.+-]+;base64,[A-Za-z0-9+/=]+$/i.test(body.reference)) task.inputs = { audio: body.reference }; + if (typeof body.reference === "string" && /^data:audio\/[a-z0-9.+-]+;base64,[A-Za-z0-9+/=]+$/i.test(body.reference)) { task.inputs = { audio: body.reference }; delete task.duration; } // the reference sets the length const beats = String(body.timeSignature || "").match(/^(\d)\/(4|8)$/); // "3/4" → 3; Runware takes 2, 3, 4 or 6 beats to the bar if (beats && [2, 3, 4, 6].includes(+beats[1])) task.settings.timeSignature = +beats[1]; if (body.steps) task.steps = Math.min(20, Math.max(1, +body.steps | 0));