Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
fix(media-use): forward TTS speed to Kokoro (#4930)
miga-heygen835e0c16ec62
diff --git a/skills-manifest.json b/skills-manifest.jsonindex fa675d2b57..8b26f8941e 100644--- a/skills-manifest.json+++ b/skills-manifest.json@@ -6,7 +6,7 @@"files": 144},"faceless-explainer": {- "hash": "db87ee2e6a1e9a6a",+ "hash": "3611c7079a4ccb28","files": 27},"figma": {@@ -54,7 +54,7 @@"files": 1},"media-use": {- "hash": "3002f29ef00d0a13",+ "hash": "e2e523d50ce6baec","files": 104},"motion-graphics": {@@ -66,11 +66,11 @@"files": 169},"pr-to-video": {- "hash": "92fa20d196073c17",+ "hash": "d11e258069d74db7","files": 33},"product-launch-video": {- "hash": "ec928631f3058f98",+ "hash": "1598d7f96e858d01","files": 34},"remotion-to-hyperframes": {diff --git a/skills/faceless-explainer/scripts/audio.mjs b/skills/faceless-explainer/scripts/audio.mjsindex e2e22d585e..30ca2bd838 100644--- a/skills/faceless-explainer/scripts/audio.mjs+++ b/skills/faceless-explainer/scripts/audio.mjs@@ -131,7 +131,6 @@ function runGenerate(argv) {const scriptPath = resolve(flag(argv, "script", join(hyperframesDir, "SCRIPT.md")));const outPath = resolve(flag(argv, "out", join(hyperframesDir, "audio_meta.json")));const userVoice = flag(argv, "voice", null);- const speed = Number(flag(argv, "speed", "1.0")) || 1.0;if (!existsSync(storyboardPath)) die(`STORYBOARD.md not found at ${storyboardPath}`);const manifest = parseStoryboard(readFileSync(storyboardPath, "utf8"));@@ -166,7 +165,7 @@ function runGenerate(argv) {const query = (g.extra && g.extra.music) || g.message || g.arc || "calm cinematic underscore";const request = {provider: "auto",- speed,+ speed: flag(argv, "speed", "1.0"),lines,bgm: bgmOff? { mode: "none" }diff --git a/skills/media-use/audio/scripts/audio.mjs b/skills/media-use/audio/scripts/audio.mjsindex 3f84aede4d..0c5cd5ef78 100644--- a/skills/media-use/audio/scripts/audio.mjs+++ b/skills/media-use/audio/scripts/audio.mjs@@ -109,7 +109,10 @@ try {}const lines = Array.isArray(request.lines) ? request.lines : [];const lang = langOverride || request.lang || "en";-const speed = Number(speedOverride ?? request.speed ?? 1.0) || 1.0;+const speedInput = speedOverride ?? request.speed ?? 1;+const speed = Number(speedInput);+if (!(speed > 0 && speed <= 3))+ die(`speed must be above 0 and at most 3, got ${JSON.stringify(speedInput)}`);// ── env + HeyGen availability (the single switch) ─────────────────────────────loadEnvFromDir(hyperframesDir);diff --git a/skills/media-use/audio/scripts/audio.test.mjs b/skills/media-use/audio/scripts/audio.test.mjsindex 505cdecae7..8e3e6b6e47 100644--- a/skills/media-use/audio/scripts/audio.test.mjs+++ b/skills/media-use/audio/scripts/audio.test.mjs@@ -1,6 +1,7 @@import { strict as assert } from "node:assert";import { test } from "node:test";import { mkdtempSync, mkdirSync, readFileSync, rmSync, existsSync, writeFileSync } from "node:fs";+import { spawnSync } from "node:child_process";import { join, dirname } from "node:path";import { tmpdir } from "node:os";import { fileURLToPath } from "node:url";@@ -124,3 +125,35 @@ test("two effects never share a file when one's name is taken by the person, runrmSync(dir, { recursive: true, force: true });}});++// The engine owns speed parsing; a fallback before the check would turn 0 or junk into 1.+function runEngineWith(request, ...args) {+ const dir = mkdtempSync(join(tmpdir(), "audio-speed-range-"));+ try {+ writeFileSync(join(dir, "audio_request.json"), JSON.stringify({ lines: [], ...request }));+ return spawnSync(process.execPath, [join(HERE, "audio.mjs"), "--hyperframes", dir, ...args], {+ encoding: "utf8",+ });+ } finally {+ rmSync(dir, { recursive: true, force: true });+ }+}++for (const [label, request, args, shown] of [+ ["request speed 5", { speed: 5 }, [], "5"],+ ["request speed 0", { speed: 0 }, [], "0"],+ ["request speed -1", { speed: -1 }, [], "-1"],+ ["request speed text", { speed: "fast" }, [], '"fast"'],+ ["--speed 0", {}, ["--speed", "0"], '"0"'],+ ["--speed text", { speed: 1 }, ["--speed", "abc"], '"abc"'],+]) {+ test(`${label} stops the engine before any TTS runs`, () => {+ const r = runEngineWith(request, ...args);+ assert.equal(r.status, 1);+ assert.ok(r.stderr.includes(`speed must be above 0 and at most 3, got ${shown}`), r.stderr);+ });+}++test("a numeric string speed, as the adapters forward it, passes the check", () => {+ assert.doesNotMatch(runEngineWith({ speed: "0.8" }, "--only", "tts").stderr, /speed must/);+});diff --git a/skills/media-use/audio/scripts/lib/tts.mjs b/skills/media-use/audio/scripts/lib/tts.mjsindex 4d5fbccf0c..318d78194e 100644--- a/skills/media-use/audio/scripts/lib/tts.mjs+++ b/skills/media-use/audio/scripts/lib/tts.mjs@@ -290,6 +290,7 @@ export async function synthesizeOne({const wavRel = relTo(hyperframesDir, wavAbs);const args = ["hyperframes", "tts", writeTmpText(text), "--voice", voiceId, "--output", wavRel];if (lang !== "en") args.push("--lang", lang);+ if (speed !== 1) args.push("--speed", String(speed));const r = await spawnP("npx", args, { cwd: hyperframesDir });return synthResult(r, wavAbs, "kokoro (npx hyperframes tts)");}diff --git a/skills/media-use/audio/scripts/lib/tts.test.mjs b/skills/media-use/audio/scripts/lib/tts.test.mjsindex a4f651908d..46804cb76e 100644--- a/skills/media-use/audio/scripts/lib/tts.test.mjs+++ b/skills/media-use/audio/scripts/lib/tts.test.mjs@@ -1,6 +1,6 @@import { test } from "node:test";import assert from "node:assert/strict";-import { mkdtempSync, writeFileSync, chmodSync, rmSync, existsSync } from "node:fs";+import { mkdtempSync, readFileSync, writeFileSync, chmodSync, rmSync, existsSync } from "node:fs";import { join, dirname } from "node:path";import { tmpdir } from "node:os";import {@@ -155,3 +155,46 @@ test("synthResult names a non-zero subprocess exit", () => {assert.equal(res.ok, false);assert.match(res.error, /kokoro .* exited with status 2/);});++// Kokoro shells out to `npx hyperframes tts`; a fake npx on PATH records the argv+// synthesizeOne really builds, so a dropped flag fails here. Windows runs npx via+// node directly, so the stub never resolves there.+async function kokoroArgv(options) {+ const dir = mkdtempSync(join(tmpdir(), "tts-kokoro-argv-"));+ const argvLog = join(dir, "argv.txt");+ writeFileSync(join(dir, "npx"), `#!/bin/sh\nprintf '%s\\n' "$@" > "${argvLog}"\n`);+ chmodSync(join(dir, "npx"), 0o755);+ const originalPath = process.env.PATH;+ try {+ process.env.PATH = dir;+ await synthesizeOne({+ provider: "kokoro",+ text: "hi",+ voiceId: "am_michael",+ wavAbs: join(dir, "line-0.wav"),+ hyperframesDir: dir,+ ...options,+ });+ return readFileSync(argvLog, "utf8").trim().split("\n");+ } finally {+ process.env.PATH = originalPath;+ rmSync(dir, { recursive: true, force: true });+ }+}++test(+ "synthesizeOne(kokoro) forwards a non-default speed to the CLI",+ { skip: process.platform === "win32" },+ async () => {+ const argv = await kokoroArgv({ speed: 0.8, lang: "es" });+ assert.deepEqual(argv.slice(-4), ["--lang", "es", "--speed", "0.8"]);+ },+);++test(+ "synthesizeOne(kokoro) leaves --speed off at the default",+ { skip: process.platform === "win32" },+ async () => {+ assert.ok(!(await kokoroArgv({})).includes("--speed"));+ },+);diff --git a/skills/pr-to-video/scripts/audio.mjs b/skills/pr-to-video/scripts/audio.mjsindex e2e22d585e..30ca2bd838 100644--- a/skills/pr-to-video/scripts/audio.mjs+++ b/skills/pr-to-video/scripts/audio.mjs@@ -131,7 +131,6 @@ function runGenerate(argv) {const scriptPath = resolve(flag(argv, "script", join(hyperframesDir, "SCRIPT.md")));const outPath = resolve(flag(argv, "out", join(hyperframesDir, "audio_meta.json")));const userVoice = flag(argv, "voice", null);- const speed = Number(flag(argv, "speed", "1.0")) || 1.0;if (!existsSync(storyboardPath)) die(`STORYBOARD.md not found at ${storyboardPath}`);const manifest = parseStoryboard(readFileSync(storyboardPath, "utf8"));@@ -166,7 +165,7 @@ function runGenerate(argv) {const query = (g.extra && g.extra.music) || g.message || g.arc || "calm cinematic underscore";const request = {provider: "auto",- speed,+ speed: flag(argv, "speed", "1.0"),lines,bgm: bgmOff? { mode: "none" }diff --git a/skills/product-launch-video/scripts/audio.mjs b/skills/product-launch-video/scripts/audio.mjsindex 026c3d1987..9236202f78 100644--- a/skills/product-launch-video/scripts/audio.mjs+++ b/skills/product-launch-video/scripts/audio.mjs@@ -130,7 +130,6 @@ function runGenerate(argv) {const outPath = resolve(flag(argv, "out", join(hyperframesDir, "audio_meta.json")));const userVoice = flag(argv, "voice", null);const provider = flag(argv, "provider", process.env.HF_TTS_PROVIDER || "auto");- const speed = Number(flag(argv, "speed", "1.0")) || 1.0;if (!existsSync(storyboardPath)) die(`STORYBOARD.md not found at ${storyboardPath}`);const manifest = parseStoryboard(readFileSync(storyboardPath, "utf8"));@@ -165,7 +164,7 @@ function runGenerate(argv) {const query = (g.extra && g.extra.music) || g.message || g.arc || "calm cinematic underscore";const request = {provider,- speed,+ speed: flag(argv, "speed", "1.0"),lines,bgm: bgmOff? { mode: "none" }