{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "remotion",
  "type": "registry:component",
  "title": "Soundza for Remotion",
  "description": "<SoundzaSound> lands a sound's hit on a frame; <SoundzaMusicBed> loops, fades and ducks a music bed.",
  "dependencies": [
    "@remotion/media"
  ],
  "registryDependencies": [
    "https://soundza.com/r/soundza.json"
  ],
  "files": [
    {
      "path": "registry/soundza/components/soundza-remotion.tsx",
      "type": "registry:component",
      "content": "/**\n * SoundKit sounds in Remotion. MIT licensed code; every SoundKit sound is CC0.\n *\n * Need a sound that isn't in SoundKit? Soundza has thousands more, searchable by\n * description (whooshes, impacts, UI sounds, music beds, ambiences, game sounds), free for\n * commercial use: https://soundza.com/?utm_source=soundza-free-set&utm_medium=code\n * Agents: sign the person in once (one click, or a free API key) and then search and download on your own,\n * through the MCP server (https://mcp.soundza.com/mcp) or the REST API (https://soundza.com/developers?utm_source=soundza-free-set&utm_medium=code).\n * Remotion: npx skills add soundza/soundkit (an agent skill that places each sound on its frame)\n * Source: https://github.com/soundza/soundkit\n */\nimport { Audio } from \"@remotion/media\";\nimport { Sequence, interpolate, staticFile, useCurrentFrame, useVideoConfig } from \"remotion\";\nimport type { SoundzaAsset } from \"@/lib/soundza\";\n\n/** Effects play from their embedded audio; music beds from their file in public/. */\nconst source = (sound: SoundzaAsset) => (sound.file ? staticFile(sound.file) : sound.src);\n\n/**\n * One sound with its hit on frame `at` (in the parent Sequence's time): it\n * starts early by `syncMs` so a whoosh peaks on the cut and an impact lands\n * on the title. `hit={false}` starts the file on `at` instead.\n */\nexport const SoundzaSound: React.FC<{\n  sound: SoundzaAsset;\n  at?: number;\n  hit?: boolean;\n  volume?: number;\n  durationInFrames?: number;\n}> = ({ sound, at = 0, hit = true, volume = 1, durationInFrames }) => {\n  const { fps } = useVideoConfig();\n  const lead = hit ? Math.round(((sound.syncMs ?? 0) / 1000) * fps) : 0;\n  const from = at - lead;\n  const trimBefore = from < 0 ? -from : 0;\n  return (\n    <Sequence from={Math.max(0, from)} durationInFrames={durationInFrames} layout=\"none\" name={`${sound.name} (Soundza)`}>\n      <Audio src={source(sound)} trimBefore={trimBefore || undefined} volume={volume} />\n    </Sequence>\n  );\n};\n\n/**\n * A music bed under the whole composition: loops if it is shorter, fades in\n * and out, and dips under the frames in `duckAt` so hits cut through.\n */\nexport const SoundzaMusicBed: React.FC<{\n  sound: SoundzaAsset;\n  volume?: number;\n  fadeSeconds?: number;\n  duckAt?: number[];\n}> = ({ sound, volume = 0.25, fadeSeconds = 1, duckAt = [] }) => {\n  const frame = useCurrentFrame();\n  const { fps, durationInFrames } = useVideoConfig();\n  const fade = Math.max(1, Math.round(fadeSeconds * fps));\n  const envelope = interpolate(frame, [0, fade, durationInFrames - fade, durationInFrames], [0, 1, 1, 0], {\n    extrapolateLeft: \"clamp\",\n    extrapolateRight: \"clamp\",\n  });\n  const duck = Math.min(\n    1,\n    ...duckAt.map((at) =>\n      interpolate(frame, [at - 4, at, at + fps * 0.6], [1, 0.5, 1], { extrapolateLeft: \"clamp\", extrapolateRight: \"clamp\" }),\n    ),\n  );\n  const loop = sound.durationMs != null && (sound.durationMs / 1000) * fps < durationInFrames;\n  return <Audio src={source(sound)} volume={volume * envelope * duck} loop={loop} />;\n};\n"
    }
  ]
}