Skip to content

JaimeJunr/claude-code-frontend-skills / plugins/hyperframes/skills/media-use

media-use

Verified

Get or make any media for a HyperFrames video - music, sound effects, images, icons, logos, voiceover, avatar and generated video, transcripts, cutouts, colour grades and looks - with HeyGen or free local tools, and mix placed audio. Also for footage that looks dark, flat or dull, or should be stylized or hidden.

FileKindSize
.gitignoreother17 B
SKILL.mdskill md5.3 KB
audio/assets/sfx/CREDITS.mdmarkdown1.2 KB
audio/assets/sfx/chime.mp3binary26.7 KB
audio/assets/sfx/click-soft.mp3binary11.4 KB
audio/assets/sfx/click.mp3binary11.4 KB
audio/assets/sfx/error.mp3binary50.6 KB
audio/assets/sfx/glitch-1.mp3binary82.4 KB
audio/assets/sfx/glitch-2.mp3binary109.5 KB
audio/assets/sfx/glitch-3.mp3binary96.8 KB
audio/assets/sfx/impact-bass-1.mp3binary66.1 KB
audio/assets/sfx/impact-bass-2.mp3binary81.0 KB
audio/assets/sfx/key-press.mp3binary3.8 KB
audio/assets/sfx/manifest.jsonconfig3.6 KB
audio/assets/sfx/notification.mp3binary76.7 KB
audio/assets/sfx/ping.mp3binary25.8 KB
audio/assets/sfx/pop.mp3binary22.5 KB
audio/assets/sfx/riser.mp3binary313.5 KB
audio/assets/sfx/sparkle.mp3binary56.3 KB
audio/assets/sfx/typing.mp3binary26.2 KB
audio/assets/sfx/whoosh-cinematic.mp3binary173.3 KB
audio/assets/sfx/whoosh-short.mp3binary18.0 KB
audio/assets/sfx/whoosh.mp3binary18.0 KB
audio/references/bgm.mdmarkdown7.9 KB
audio/references/captions/authoring.mdmarkdown9.2 KB
audio/references/captions/motion.mdmarkdown5.4 KB
audio/references/captions/transcript-handling.mdmarkdown5.3 KB
audio/references/remove-background.mdmarkdown8.3 KB
audio/references/requirements.mdmarkdown4.7 KB
audio/references/sfx.mdmarkdown4.0 KB
audio/references/transcribe.mdmarkdown2.8 KB
audio/references/tts-to-captions.mdmarkdown1.7 KB
audio/references/tts.mdmarkdown13.9 KB
audio/scripts/audio.mjsscript15.2 KB
audio/scripts/audio.test.mjsscript8.4 KB
audio/scripts/carve.mjsscript20.1 KB
audio/scripts/carve.test.mjsscript12.2 KB
audio/scripts/extract-audio-data.pyscript7.1 KB
audio/scripts/gemini-pipeline.test.mjsscript4.8 KB
audio/scripts/heygen-tts.mjsexecutablescript4.3 KB
audio/scripts/heygen-tts.test.mjsscript1.4 KB
audio/scripts/heygen-voice.mjsscript3.8 KB
audio/scripts/heygen-voice.test.mjsscript8.3 KB
audio/scripts/lib/audio-carve.mjsscript16.6 KB
audio/scripts/lib/audio-meta.mjsscript1.1 KB
audio/scripts/lib/audio-meta.test.mjsscript4.5 KB
audio/scripts/lib/bgm-volume.mjsscript236 B
audio/scripts/lib/bgm.mjsscript11.5 KB
audio/scripts/lib/bgm.test.mjsscript4.7 KB
audio/scripts/lib/concurrency.mjsscript527 B
audio/scripts/lib/concurrency.test.mjsscript1.6 KB
audio/scripts/lib/gemini-auth.mjsscript1.6 KB
audio/scripts/lib/gemini-auth.pyscript1.9 KB
audio/scripts/lib/gemini-auth.test.mjsscript3.0 KB
audio/scripts/lib/gemini-auth_test.pyscript4.3 KB
audio/scripts/lib/gemini-tts.mjsscript5.0 KB
audio/scripts/lib/gemini-tts.test.mjsscript9.2 KB
audio/scripts/lib/heygen.mjsscript14.3 KB
audio/scripts/lib/heygen.test.mjsscript22.9 KB
audio/scripts/lib/main-module.mjsscript479 B
audio/scripts/lib/media-record.mjsscript5.1 KB
audio/scripts/lib/media-record.test.mjsscript12.6 KB
audio/scripts/lib/openverse.mjsscript4.9 KB
audio/scripts/lib/project-path.mjsscript2.2 KB
audio/scripts/lib/project-path.test.mjsscript3.0 KB
audio/scripts/lib/python.mjsscript4.6 KB
audio/scripts/lib/python.test.mjsscript7.8 KB
audio/scripts/lib/recording.mjsscript4.4 KB
audio/scripts/lib/sfx.mjsscript7.2 KB
audio/scripts/lib/sfx.test.mjsscript11.6 KB
audio/scripts/lib/tts.cleanup.test.mjsscript7.0 KB
audio/scripts/lib/tts.mjsscript18.6 KB
audio/scripts/lib/tts.spawn.test.mjsscript6.0 KB
audio/scripts/lib/tts.test.mjsscript10.2 KB
audio/scripts/lib/voice-credit.mjsscript686 B
audio/scripts/lib/voice-credit.test.mjsscript946 B
audio/scripts/lyria-recipe.pyscript4.9 KB
audio/scripts/recording.test.mjsscript9.2 KB
audio/scripts/trusted-program.test.mjsscript3.4 KB
audio/scripts/trusted_program.pyscript2.8 KB
audio/scripts/wait-bgm.mjsscript6.1 KB
audio/scripts/wait-bgm.test.mjsscript8.0 KB
luts/README.mdmarkdown1.1 KB
luts/index.jsonconfig2.0 KB
references/audio.mdmarkdown3.5 KB
references/grading.mdmarkdown7.0 KB
references/heygen.mdmarkdown11.8 KB
references/local.mdmarkdown2.6 KB
references/media-treatment-recipes.mdmarkdown35.0 KB
references/media-treatments.mdmarkdown13.8 KB
references/memory.mdmarkdown3.7 KB
references/meta.mdmarkdown6.4 KB
references/mixing.mdmarkdown4.5 KB
references/operations.mdmarkdown15.8 KB
references/resolve.mdmarkdown9.9 KB
references/setup-providers.mdmarkdown9.1 KB
references/telemetry-dashboard.mdmarkdown4.1 KB
scripts/audio-duck.mjsscript4.0 KB
scripts/compatibility.test.mjsscript1.6 KB
scripts/dither.mjsscript9.8 KB
scripts/dither.test.mjsscript4.6 KB
scripts/eval.mjsscript14.6 KB
scripts/lib/config-lock.mjsscript1.5 KB
scripts/lib/credit-limit.mjsscript2.0 KB
scripts/lib/cutlist.mjsscript6.2 KB
scripts/lib/duck.mjsscript3.8 KB
scripts/lib/error-diffusion.mjsscript6.5 KB
scripts/lib/index-gen.mjsscript2.0 KB
scripts/lib/manifest.mjsscript10.6 KB
scripts/lib/media-fetch.mjsscript2.8 KB
scripts/lib/media-home.mjsscript730 B
scripts/lib/npx-sync.mjsscript3.2 KB
scripts/lib/parakeet-words.mjsscript1.1 KB
scripts/lib/prefs-store.mjsscript6.8 KB
scripts/lib/recipe-store.mjsscript13.0 KB
scripts/lib/telemetry.mjsscript8.8 KB
scripts/lib/telemetry.test.mjsscript3.0 KB
scripts/lib/transcriptCutFade.mjsscript911 B
scripts/lib/windows-exe-search.mjsscript640 B
scripts/lib/words.mjsscript728 B
scripts/prefs.mjsscript2.3 KB
scripts/recipe.mjsscript3.8 KB
scripts/resolve-plugin.test.mjsscript3.2 KB
scripts/resolve.mjsscript1.4 KB
scripts/transcribe.mjsscript8.0 KB
scripts/transcribe.test.mjsscript7.7 KB
scripts/transcript-cut.mjsscript10.1 KB
scripts/transcript-cut.test.mjsscript9.6 KB

audio/scripts/lib/sfx.test.mjs

View on GitHub
import { test } from "node:test";
import assert from "node:assert/strict";
import { mkdtempSync, mkdirSync, writeFileSync, existsSync, readFileSync, rmSync } from "node:fs";
import { join } from "node:path";
import { tmpdir } from "node:os";
import { appendRecord } from "../../../scripts/lib/manifest.mjs";
import { BUNDLED_SFX_DIR, findSoundEffect, resolveSfx } from "./sfx.mjs";

// No real network: each test serves Openverse's answers; by default it is unreachable.
const offline = async () => {
  throw new TypeError("fetch failed");
};
let serve = offline;
const UNREACHABLE =
  "Openverse unreachable (fetch failed): the remaining SFX cues use the bundled library";
globalThis.fetch = (url, init) => serve(String(url), init);

// Offline SFX resolution: the bundled library may ship manifest.json
// without the actual mp3s. The old code copied only when the source existed but
// pushed the sfx entry unconditionally — producing a dangling reference that
// silently dropped downstream ("not on disk"). These tests lock in the loud
// behavior: a present file is copied + referenced; a missing file yields an
// anomaly and NO dangling entry.

async function withDirs(fn) {
  const root = mkdtempSync(join(tmpdir(), "hf-sfx-"));
  const libDir = join(root, "lib");
  const projDir = join(root, "proj");
  mkdirSync(libDir, { recursive: true });
  mkdirSync(projDir, { recursive: true });
  try {
    // `await` is load-bearing: without it the finally cleanup runs before the
    // async test body resolves, deleting the temp dir mid-assertion.
    return await fn({ libDir, projDir });
  } finally {
    rmSync(root, { recursive: true, force: true });
  }
}

test("offline: copies and references a present bundled file", async () => {
  await withDirs(async ({ libDir, projDir }) => {
    writeFileSync(
      join(libDir, "manifest.json"),
      JSON.stringify({ whoosh: { file: "whoosh.mp3", duration: 0.8 } }),
    );
    writeFileSync(join(libDir, "whoosh.mp3"), "ID3-fake-bytes");
    const { sfx, anomalies } = await resolveSfx({
      cues: [{ id: "s1", name: "whoosh" }],
      hyperframesDir: projDir,
      sfxLibDir: libDir,
    });
    assert.equal(sfx.length, 1);
    assert.equal(sfx[0].file, "assets/sfx/whoosh.mp3");
    assert.equal(sfx[0].source, "local");
    assert.ok(existsSync(join(projDir, "assets/sfx/whoosh.mp3")), "mp3 copied into project");
    assert.deepEqual(anomalies, [UNREACHABLE]);
  });
});

test("offline: a matched-but-missing bundled file yields an anomaly and NO dangling entry", async () => {
  await withDirs(async ({ libDir, projDir }) => {
    // Manifest names whoosh.mp3, but the mp3 was never shipped (the reported bug).
    writeFileSync(
      join(libDir, "manifest.json"),
      JSON.stringify({ whoosh: { file: "whoosh.mp3", duration: 0.8 } }),
    );
    const { sfx, anomalies } = await resolveSfx({
      cues: [{ id: "s1", name: "whoosh" }],
      hyperframesDir: projDir,
      sfxLibDir: libDir,
    });
    assert.equal(sfx.length, 0, "no dangling entry for a file that was never copied");
    assert.equal(anomalies.length, 2);
    assert.match(anomalies[1], /missing from the offline library/);
    assert.ok(!existsSync(join(projDir, "assets/sfx/whoosh.mp3")), "nothing copied");
  });
});

const whooshLibrary = (libDir, withFile) => {
  writeFileSync(
    join(libDir, "manifest.json"),
    JSON.stringify({ whoosh: { file: "whoosh.mp3", duration: 0.8 } }),
  );
  if (withFile) writeFileSync(join(libDir, "whoosh.mp3"), "ID3-library-bytes");
};
const record = (projDir, source) =>
  appendRecord(projDir, { id: "sfx_001", type: "sfx", path: "assets/sfx/whoosh.mp3", source });
const bundledOnly = (libDir, projDir) =>
  resolveSfx({
    cues: [{ id: "s1", name: "whoosh" }],
    hyperframesDir: projDir,
    sfxLibDir: libDir,
  });

test("offline: the engine's earlier copy stands in for a library file this install lacks", async () => {
  await withDirs(async ({ libDir, projDir }) => {
    whooshLibrary(libDir, false);
    mkdirSync(join(projDir, "assets/sfx"), { recursive: true });
    writeFileSync(join(projDir, "assets/sfx/whoosh.mp3"), "engine copy");
    record(projDir, "bundled");

    const { sfx, anomalies } = await bundledOnly(libDir, projDir);

    assert.deepEqual(
      sfx.map(({ file }) => file),
      ["assets/sfx/whoosh.mp3"],
    );
    assert.deepEqual(anomalies, [UNREACHABLE]);
  });
});

test("offline: a person's file with the library's bytes stays theirs once recorded as their own", async () => {
  await withDirs(async ({ libDir, projDir }) => {
    whooshLibrary(libDir, true);
    mkdirSync(join(projDir, "assets/sfx"), { recursive: true });
    writeFileSync(join(projDir, "assets/sfx/whoosh.mp3"), "ID3-library-bytes");
    record(projDir, "existing");

    const { sfx } = await bundledOnly(libDir, projDir);

    assert.deepEqual(
      sfx.map(({ file }) => file),
      ["assets/sfx/whoosh-2.mp3"],
    );
    assert.equal(readFileSync(join(projDir, "assets/sfx/whoosh.mp3"), "utf8"), "ID3-library-bytes");
  });
});

const libraryWith = (libDir, names) => {
  const manifest = {};
  for (const name of names) {
    manifest[name] = { file: `${name}.mp3`, duration: 0.5 };
    writeFileSync(join(libDir, `${name}.mp3`), `library ${name}`);
  }
  writeFileSync(join(libDir, "manifest.json"), JSON.stringify(manifest));
};
const sound = (overrides = {}) => ({
  id: "ov-1",
  title: "Swoosh",
  creator: "Ana",
  license: "by",
  foreign_landing_url: "https://freesound.org/s/1",
  url: "https://cdn.freesound.test/swoosh.mp3",
  filetype: "mp3",
  duration: 820,
  attribution: '"Swoosh" by Ana is licensed under CC BY 4.0.',
  ...overrides,
});
// Openverse stand-in: `answer(query)` gives a search response; any other URL is the sound file.
function openverse(answer) {
  const searches = [];
  serve = async (url) => {
    const query = new URL(url).searchParams.get("q");
    if (!url.startsWith("https://api.openverse.org/")) return new Response(`bytes of ${url}`);
    searches.push(query);
    return answer(query);
  };
  return searches;
}
const run = (libDir, projDir, names) =>
  resolveSfx({
    cues: names.map((name, index) => ({ id: String(index + 1), name })),
    hyperframesDir: projDir,
    sfxLibDir: libDir,
  });

test("openverse: each cue gets the best licensed sound, with its licence and credit", async () => {
  await withDirs(async ({ libDir, projDir }) => {
    libraryWith(libDir, ["whoosh"]);
    openverse(() => Response.json({ results: [sound()] }));
    try {
      const { sfx, anomalies } = await run(libDir, projDir, ["whoosh"]);
      assert.deepEqual(sfx, [
        {
          id: "1",
          name: "whoosh",
          file: "assets/sfx/whoosh.mp3",
          source: "openverse",
          duration_s: 0.82,
          license: "by",
          credit: '"Swoosh" by Ana is licensed under CC BY 4.0.',
          offset_s: 0,
          volume: 0.35,
        },
      ]);
      assert.deepEqual(anomalies, []);
      assert.equal(
        readFileSync(join(projDir, "assets/sfx/whoosh.mp3"), "utf8"),
        "bytes of https://cdn.freesound.test/swoosh.mp3",
      );
      assert.match(
        readFileSync(join(projDir, "assets/sfx/CREDITS.md"), "utf8"),
        /- `assets\/sfx\/whoosh\.mp3`: "Swoosh" by Ana is licensed under CC BY 4\.0\. Source: https:\/\/freesound\.org\/s\/1/,
      );
    } finally {
      serve = offline;
    }
  });
});

test("openverse: a rate limit sends this and every later cue to the bundled library, asking once", async () => {
  await withDirs(async ({ libDir, projDir }) => {
    libraryWith(libDir, ["whoosh", "pop"]);
    const searches = openverse(() => new Response("slow down", { status: 429 }));
    try {
      const { sfx, anomalies } = await run(libDir, projDir, ["whoosh", "pop"]);
      assert.deepEqual(searches, ["whoosh"]);
      assert.deepEqual(
        sfx.map(({ file, source }) => [file, source]),
        [
          ["assets/sfx/whoosh.mp3", "local"],
          ["assets/sfx/pop.mp3", "local"],
        ],
      );
      assert.equal(readFileSync(join(projDir, "assets/sfx/pop.mp3"), "utf8"), "library pop");
      assert.deepEqual(anomalies, [
        "Openverse rate limit reached (HTTP 429): the remaining SFX cues use the bundled library",
      ]);
    } finally {
      serve = offline;
    }
  });
});

test("openverse: a cue with no licensed match falls back to the bundled library alone", async () => {
  await withDirs(async ({ libDir, projDir }) => {
    libraryWith(libDir, ["pop"]);
    const searches = openverse((query) =>
      Response.json({ results: query === "pop" ? [sound({ license: "by-nc" })] : [sound()] }),
    );
    try {
      const { sfx } = await run(libDir, projDir, ["pop", "swoosh"]);
      assert.deepEqual(searches, ["pop", "swoosh"]);
      assert.deepEqual(
        sfx.map(({ file, source }) => [file, source]),
        [
          ["assets/sfx/pop.mp3", "local"],
          ["assets/sfx/swoosh.mp3", "openverse"],
        ],
      );
    } finally {
      serve = offline;
    }
  });
});

test("openverse: a failed download falls back to the bundled file with an anomaly", async () => {
  await withDirs(async ({ libDir, projDir }) => {
    libraryWith(libDir, ["whoosh"]);
    serve = async (url) =>
      url.startsWith("https://api.openverse.org/")
        ? Response.json({ results: [sound()] })
        : new Response("gone", { status: 404 });
    try {
      const { sfx, anomalies } = await run(libDir, projDir, ["whoosh"]);
      assert.deepEqual(
        sfx.map(({ file, source }) => [file, source]),
        [["assets/sfx/whoosh.mp3", "local"]],
      );
      assert.match(anomalies[0], /Openverse download failed — download HTTP 404/);
    } finally {
      serve = offline;
    }
  });
});

test("openverse: one effect named in two lines is searched and downloaded once", async () => {
  await withDirs(async ({ libDir, projDir }) => {
    libraryWith(libDir, []);
    const searches = openverse(() => Response.json({ results: [sound({ license: "cc0" })] }));
    try {
      const { sfx } = await run(libDir, projDir, ["whoosh", "whoosh"]);
      assert.deepEqual(searches, ["whoosh"]);
      assert.deepEqual(
        sfx.map(({ id, file }) => [id, file]),
        [
          ["1", "assets/sfx/whoosh.mp3"],
          ["2", "assets/sfx/whoosh.mp3"],
        ],
      );
      assert.equal(
        existsSync(join(projDir, "assets/sfx/CREDITS.md")),
        false,
        "CC0 needs no credit",
      );
    } finally {
      serve = offline;
    }
  });
});

test("findSoundEffect: a host gets the saved file, licence, credit and duration for one query", async () => {
  await withDirs(async ({ projDir }) => {
    const searches = openverse(() => Response.json({ results: [sound()] }));
    try {
      assert.deepEqual(await findSoundEffect("whoosh", { hyperframesDir: projDir }), {
        sound: {
          file: "assets/sfx/whoosh.mp3",
          source: "openverse",
          duration_s: 0.82,
          license: "by",
          credit: '"Swoosh" by Ana is licensed under CC BY 4.0.',
        },
        anomalies: [],
      });
      assert.deepEqual(searches, ["whoosh"]);
    } finally {
      serve = offline;
    }
  });
});

test("findSoundEffect: offline, the skill's own bundled library answers", async () => {
  await withDirs(async ({ projDir }) => {
    const { sound, anomalies } = await findSoundEffect("whoosh", { hyperframesDir: projDir });
    assert.deepEqual(sound, {
      file: "assets/sfx/whoosh.mp3",
      source: "local",
      duration_s: sound.duration_s,
    });
    assert.deepEqual(
      readFileSync(join(projDir, sound.file)),
      readFileSync(join(BUNDLED_SFX_DIR, "whoosh.mp3")),
    );
    assert.deepEqual(anomalies, [UNREACHABLE]);
    assert.equal(
      (await findSoundEffect("no such sound at all", { hyperframesDir: projDir })).sound,
      null,
    );
  });
});
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall