{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "audio-visualizer",
  "type": "registry:component",
  "title": "AudioVisualizer",
  "description": "Renders animated bars (frequency-domain) or a waveform (time-domain) for an audio file. Does **not** play audio — pair with a parallel `AudioClip` for playback. Uses `useAudioData` from `@remotion/media-utils` (cached per `src`).",
  "dependencies": [
    "remotion",
    "@remotion/media-utils",
    "zod",
    "react"
  ],
  "registryDependencies": [
    "lib-canvas"
  ],
  "files": [
    {
      "path": "registry/components/audio-visualizer/AudioVisualizer.tsx",
      "type": "registry:component",
      "target": "components/onda/audio-visualizer/AudioVisualizer.tsx",
      "content": "import React from 'react';\nimport { useCurrentFrame, useVideoConfig, Easing, random } from 'remotion';\nimport { useAudioData, visualizeAudio } from '@remotion/media-utils';\nimport { PlacementBox } from '../../../lib/canvas';\nimport { audioVisualizerSchema, type AudioVisualizerProps } from './schema';\n\nexport { audioVisualizerSchema, type AudioVisualizerProps };\n\n// ─── audio-signal helpers ────────────────────────────────────────────\n//\n// Standard W3C / WebAudio signal-processing primitives. These bridge the\n// gap between `visualizeAudio`'s raw FFT magnitudes (most below 0.1, hard\n// to see) and the responsive 0..1 amplitudes a visualizer expects.\n\nconst toDecibel = (v: number) => 20 * Math.log10(v);\nconst clamp = (v: number, lo: number, hi: number) => Math.max(lo, Math.min(hi, v));\nconst normalize = (v: number, lo: number, hi: number) => (v - lo) / (hi - lo);\n\n/**\n * Convert a raw FFT magnitude into a perceptually-scaled `[0, 1]` value\n * via decibel normalization. The default range (`-100dB..-30dB`) is the\n * \"interesting\" range for music — without this, raw `visualizeAudio()`\n * output looks dead because almost all magnitudes sit between 0 and 0.1.\n */\nconst processFftValue = (v: number, minDb: number, maxDb: number): number => {\n  const db = toDecibel(v);\n  return clamp(normalize(db, minDb, maxDb), 0, 1);\n};\n\n/** RMS of an array — a single scalar representing overall \"loudness\". */\nconst getRms = (values: number[]): number => {\n  if (values.length === 0) return 0;\n  let sum = 0;\n  for (let i = 0; i < values.length; i++) sum += values[i] * values[i];\n  return Math.sqrt(sum / values.length);\n};\n\n/** Rotate an array left by `n` positions — used by `hills` for the stacked copies. */\nconst rotate = <T,>(arr: T[], n: number): T[] => {\n  if (!n) return [...arr];\n  const k = n % arr.length;\n  return [...arr.slice(k), ...arr.slice(0, k)];\n};\n\n/**\n * Curated \"known good\" preset configurations — named visual personalities\n * that show off what's possible without forcing the consumer to wade\n * through every prop. Each preset is a `Partial<AudioVisualizerProps>` you\n * spread onto the component: `<AudioVisualizer {...audioVisualizerPresets.aurora} />`.\n *\n * Exported as first-class data (not preview-only metadata) so:\n *   - the docs site renders them as a chip row in the live preview's TryIt panel\n *   - agents picking a preset by name is simpler than guessing prop combos\n *   - downstream consumers (Studio, brief renderers) can offer the same set\n *\n * Color story: rose (`#D96B82`) is always the anchor — Onda's brand\n * accent — paired with a different complementary color per preset for\n * visual personality. The WOW palette additions (cyan / violet / amber)\n * live LOCAL to the visualizer, not in the brand tokens — visualizers\n * are an earned-color moment where bolder pairings earn their place.\n */\nexport const audioVisualizerPresets = {\n  /** Spotify-style: chunky bars, single rose accent, middle-aligned. */\n  spotify: {\n    variant: 'bars',\n    barWidth: 12,\n    barGap: 8,\n    barAlign: 'middle',\n    color: 'var(--onda-accent, #D96B82)',\n  },\n  /** SoundCloud-style: dense thin bars, rose → cyan complement. */\n  soundcloud: {\n    variant: 'bars',\n    barWidth: 2,\n    barGap: 1,\n    barAlign: 'middle',\n    color: ['var(--onda-accent, #D96B82)', '#4DD4D8'],\n  },\n  /** Bottom-anchored equalizer bars — classic DJ look, two-tone rose. */\n  equalizer: {\n    variant: 'bars',\n    barWidth: 6,\n    barGap: 4,\n    barAlign: 'bottom',\n    color: ['var(--onda-accent, #D96B82)', 'var(--onda-accent-soft, #E89AAB)'],\n  },\n  /** Aurora hills — three-tone layered fills, rose / violet / soft rose. */\n  aurora: {\n    variant: 'hills',\n    hillsCopies: 3,\n    hillsFillOpacity: 0.5,\n    color: ['var(--onda-accent, #D96B82)', '#7C5CE5', 'var(--onda-accent-soft, #E89AAB)'],\n  },\n  /** Voice ribbon — four stacked wave lines, rose ↔ cyan, slow drift. */\n  voice: {\n    variant: 'wave',\n    waveLines: 4,\n    waveLineGap: 18,\n    waveScrollSpeed: -100,\n    color: ['var(--onda-accent, #D96B82)', '#4DD4D8'],\n  },\n  /** Sunburst — radial bars outward, amber ↔ rose (warm). */\n  sunburst: {\n    variant: 'radial',\n    radialBarOrigin: 'outer',\n    radialBarWidth: 6,\n    radialBarGap: 4,\n    color: ['#FFB547', 'var(--onda-accent, #D96B82)'],\n  },\n  /** Neon ring — radial bars inward, rose ↔ violet (synthwave). */\n  neon: {\n    variant: 'radial',\n    radialBarOrigin: 'inner',\n    radialInnerRadius: 120,\n    radialBarWidth: 4,\n    color: ['var(--onda-accent, #D96B82)', '#7C5CE5'],\n  },\n} as const satisfies Record<string, Partial<AudioVisualizerProps>>;\n\nexport type AudioVisualizerPreset = keyof typeof audioVisualizerPresets;\n\n// Drop-shadow string used when `glow` is on. Tuned for a soft accent halo.\nconst GLOW_FILTER = 'drop-shadow(0 0 6px currentColor)';\n\n/** Normalize a `string | string[]` color prop to a non-empty array. */\nconst toColorArray = (c: string | string[]): string[] =>\n  Array.isArray(c) ? (c.length > 0 ? c : ['var(--onda-accent, #D96B82)']) : [c];\n\n/** Pick a color by index, wrapping. */\nconst colorAt = (colors: string[], i: number) => colors[i % colors.length];\n\n/**\n * Renders an animated visualization of an audio file. **Does not play\n * audio** — pair with `AudioClip` for playback.\n *\n * Four variants, all driven by the same dB-normalized FFT pipeline:\n *\n * - `'bars'` — frequency-domain bars (spectrum analyzer).\n * - `'wave'` — parametric sine wave whose amplitude is driven by RMS.\n * - `'hills'` — filled smooth-curve \"mountains\" mirrored around center.\n * - `'radial'` — bars arranged in a circle, each bar driven by an FFT bin.\n *\n * All four share the same Onda accent treatment — single `color` prop,\n * soft glow via `drop-shadow`.\n */\nexport const AudioVisualizer: React.FC<AudioVisualizerProps> = (props) => {\n  const audioData = useAudioData(props.src);\n\n  if (!audioData) {\n    const w = props.variant === 'radial' ? props.radialDiameter : props.width;\n    const h = props.variant === 'radial' ? props.radialDiameter : props.height;\n    return (\n      <PlacementBox placement={props.placement}>\n        <div style={{ width: w, height: h }} />\n      </PlacementBox>\n    );\n  }\n\n  const child =\n    props.variant === 'bars' ? <BarsVariant {...props} audioData={audioData} />\n    : props.variant === 'wave' ? <WaveVariant {...props} audioData={audioData} />\n    : props.variant === 'hills' ? <HillsVariant {...props} audioData={audioData} />\n    : <RadialVariant {...props} audioData={audioData} />;\n\n  return <PlacementBox placement={props.placement}>{child}</PlacementBox>;\n};\n\ntype V = AudioVisualizerProps & { audioData: NonNullable<ReturnType<typeof useAudioData>> };\n\n// ─── BARS ────────────────────────────────────────────────────────────\n\nconst BarsVariant: React.FC<V> = ({\n  audioData, width, height, color, glow,\n  barWidth, barGap, barRadius, barAlign,\n  minDb, maxDb, numberOfSamples,\n}) => {\n  const frame = useCurrentFrame();\n  const { fps } = useVideoConfig();\n  const raw = visualizeAudio({ fps, frame, audioData, numberOfSamples });\n\n  const slot = barWidth + barGap;\n  const nBars = Math.max(1, Math.floor(width / slot));\n  const sampleStep = Math.max(1, Math.floor(raw.length / nBars));\n\n  const bars = Array.from({ length: nBars }, (_, i) => {\n    const v = raw[(i * sampleStep) % raw.length] ?? 0;\n    const processed = processFftValue(v, minDb, maxDb);\n    return Math.log(1 + processed) / Math.log(2);\n  });\n\n  // Multi-stop vertical gradient. Each color in the array becomes a stop;\n  // evenly distributed. With one color, the gradient fades to 30% alpha\n  // at the bottom (soft glow effect). With multiple colors, the array\n  // drives the stops (no alpha fade — the colors carry the visual).\n  const colors = toColorArray(color);\n  const stops = colors.length === 1\n    ? [\n        { offset: '0%', color: colors[0], opacity: 1 },\n        { offset: '100%', color: colors[0], opacity: 0.3 },\n      ]\n    : colors.map((c, i) => ({\n        offset: `${(i / (colors.length - 1)) * 100}%`,\n        color: c,\n        opacity: 1,\n      }));\n\n  // Use the first color for the glow tint (drop-shadow only takes one).\n  const tintColor = colors[0];\n\n  return (\n    <svg\n      width={width}\n      height={height}\n      viewBox={`0 0 ${width} ${height}`}\n      style={{\n        display: 'block',\n        color: tintColor,\n        filter: glow ? GLOW_FILTER : undefined,\n      }}\n    >\n      <defs>\n        <linearGradient id=\"ondaBarGradient\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n          {stops.map((s, i) => (\n            <stop key={i} offset={s.offset} stopColor={s.color} stopOpacity={s.opacity} />\n          ))}\n        </linearGradient>\n      </defs>\n      {bars.map((v, i) => {\n        const h = Math.max(barRadius * 2, v * height);\n        const x = i * slot;\n        const y =\n          barAlign === 'top' ? 0\n          : barAlign === 'bottom' ? height - h\n          : (height - h) / 2;\n        return (\n          <rect\n            key={i} x={x} y={y}\n            width={barWidth} height={h}\n            rx={barRadius}\n            fill=\"url(#ondaBarGradient)\"\n          />\n        );\n      })}\n    </svg>\n  );\n};\n\n// ─── WAVE ────────────────────────────────────────────────────────────\n\nconst WaveVariant: React.FC<V> = ({\n  audioData, width, height, color, glow,\n  waveSections, waveLines, waveLineGap, waveStrokeWidth, waveScrollSpeed,\n  minDb, maxDb, numberOfSamples,\n}) => {\n  const frame = useCurrentFrame();\n  const { fps } = useVideoConfig();\n  const raw = visualizeAudio({ fps, frame, audioData, numberOfSamples });\n\n  // Skip sub-bass to get a perceptually-correct loudness signal.\n  const focused = raw.slice(Math.floor(0.25 * raw.length));\n  const processed = focused.map((v) => processFftValue(v, minDb, maxDb));\n  const rms = getRms(processed);\n  const amplitude = rms * (height * 0.45);\n\n  const t = frame / fps;\n  const offsetPixels = waveScrollSpeed * t;\n  const sectionWidth = width / waveSections;\n  const off = offsetPixels % (2 * sectionWidth);\n\n  const totalGapHeight = (waveLines - 1) * waveLineGap;\n  const linesStartY = -totalGapHeight / 2;\n\n  const lines = Array.from({ length: waveLines }, (_, lineIndex) => {\n    const yShift = linesStartY + lineIndex * waveLineGap;\n    return buildWavePath({\n      width, sections: waveSections, amplitude,\n      offsetPixels: off + lineIndex * 6, yShift,\n    });\n  });\n\n  // Cycle the color array across stacked lines. With a single color,\n  // every line is the same hue and we apply opacity decay so the layers\n  // read as one ribbon. With multiple colors, each line gets its own\n  // hue — no opacity decay so each color is fully present.\n  const colors = toColorArray(color);\n  const tintColor = colors[0];\n\n  return (\n    <svg\n      width={width}\n      height={height}\n      viewBox={`0 ${-height / 2} ${width} ${height}`}\n      style={{ display: 'block', color: tintColor, filter: glow ? GLOW_FILTER : undefined }}\n    >\n      {lines.map((d, i) => (\n        <path\n          key={i} d={d}\n          stroke={colorAt(colors, i)}\n          strokeWidth={waveStrokeWidth}\n          strokeLinecap=\"round\"\n          strokeOpacity={colors.length === 1 ? 1 - i * 0.25 : 1}\n          fill=\"none\"\n        />\n      ))}\n    </svg>\n  );\n};\n\nfunction buildWavePath({\n  width, sections, amplitude, offsetPixels, yShift,\n}: { width: number; sections: number; amplitude: number; offsetPixels: number; yShift: number }): string {\n  const numberOfPoints = sections * 2;\n  const step = 1 / numberOfPoints;\n  const stepOffset = offsetPixels / width;\n\n  const points = Array.from({ length: numberOfPoints }, (_, i) => {\n    const fraction = ((i - 0.5) % numberOfPoints) * step - stepOffset;\n    let x = (fraction + 1) % 1;\n    x = x * width;\n    let y = Math.sin(Math.abs(fraction) * Math.PI);\n    y = Easing.cubic(y);\n    y = y * amplitude;\n    y = y * Math.sin((0.5 + i) * Math.PI);\n    return { x, y: y + yShift };\n  }).sort((a, b) => a.x - b.x);\n\n  const sectionW = width / sections;\n  const cpDist = 0.4 * sectionW;\n  const segments = points.map((p, i, arr) => {\n    const prev = i === 0 ? { x: 0, y: yShift } : arr[i - 1];\n    return `C ${prev.x + cpDist} ${prev.y}, ${p.x - cpDist} ${p.y}, ${p.x} ${p.y}`;\n  });\n  const last = points[points.length - 1];\n  const tail = `C ${last.x + cpDist} ${last.y}, ${width - cpDist} ${yShift}, ${width} ${yShift}`;\n  return `M 0 ${yShift} ${segments.join(' ')} ${tail}`;\n}\n\n// ─── HILLS ───────────────────────────────────────────────────────────\n\nconst HillsVariant: React.FC<V> = ({\n  audioData, width, height, color, glow,\n  hillsBumps, hillsCopies, hillsAlign, hillsFillOpacity, hillsStrokeWidth, hillsSeed,\n  minDb, maxDb, numberOfSamples,\n}) => {\n  const frame = useCurrentFrame();\n  const { fps } = useVideoConfig();\n  const raw = visualizeAudio({ fps, frame, audioData, numberOfSamples });\n\n  // Sample mid-range frequencies — same focus Marcus uses (most of the\n  // perceived \"shape\" of music sits in this band).\n  const start = Math.floor(0.2 * raw.length);\n  const end = Math.floor(0.6 * raw.length);\n  const samples = raw.slice(start, end);\n  const sampleStep = Math.max(1, Math.floor(samples.length / hillsBumps));\n  const values = Array.from({ length: hillsBumps }, (_, i) =>\n    processFftValue(samples[(i * sampleStep) % samples.length] ?? 0, minDb, maxDb),\n  );\n\n  // Layout: 15% horizontal padding so the curve doesn't kiss the edges.\n  const pad = 0.15 * width;\n  const stepSize = (width - 2 * pad) / Math.max(1, values.length - 1);\n\n  const { vbShift, scaling } =\n    hillsAlign === 'top'    ? { vbShift: -height, scaling: 1 }\n  : hillsAlign === 'bottom' ? { vbShift: 0, scaling: 1 }\n  :                           { vbShift: -height / 2, scaling: 0.5 };\n\n  const hills = Array.from({ length: hillsCopies }, (_, lineIndex) => {\n    const shifted = rotate(values, 3 * lineIndex);\n    return shifted.map((v, i) => ({\n      x: pad + i * stepSize,\n      // Slight per-bump random multiplier (deterministic via seed) gives\n      // the hills natural variation instead of identical waveforms.\n      y:\n        scaling * height * v *\n        (1.2 - 0.5 * random(`${hillsSeed}-${lineIndex}-${i}`)),\n    }));\n  });\n\n  const cp = 0.5 * stepSize;\n  const buildPath = (line: { x: number; y: number }[], mirror: boolean) => {\n    const sign = mirror ? -1 : 1;\n    const segments = line.map((p, i, arr) => {\n      const prev = i === 0 ? { x: 0, y: 0 } : arr[i - 1];\n      return `C ${prev.x + cp} ${sign * prev.y}, ${p.x - cp} ${sign * p.y}, ${p.x} ${sign * p.y}`;\n    });\n    const last = line[line.length - 1];\n    const tail = `C ${last.x + cp} ${sign * last.y}, ${width - cp} 0, ${width} 0`;\n    return `M 0 0 ${segments.join(' ')} ${tail} Z`;\n  };\n\n  // Cycle the color array across stacked copies.\n  const colors = toColorArray(color);\n  const tintColor = colors[0];\n\n  return (\n    <svg\n      width={width}\n      height={height}\n      viewBox={`0 ${vbShift} ${width} ${height}`}\n      style={{ display: 'block', color: tintColor, filter: glow ? GLOW_FILTER : undefined }}\n    >\n      {hills.map((line, i) => {\n        const fillColor = colorAt(colors, i);\n        const pathProps = {\n          fill: fillColor,\n          fillOpacity: hillsFillOpacity / Math.max(1, hillsCopies - i),\n          stroke: hillsStrokeWidth > 0 ? fillColor : 'none',\n          strokeWidth: hillsStrokeWidth,\n        };\n        return (\n          <React.Fragment key={i}>\n            {hillsAlign !== 'top' && <path d={buildPath(line, false)} {...pathProps} />}\n            {hillsAlign !== 'bottom' && <path d={buildPath(line, true)} {...pathProps} />}\n          </React.Fragment>\n        );\n      })}\n    </svg>\n  );\n};\n\n// ─── RADIAL ──────────────────────────────────────────────────────────\n\nconst RadialVariant: React.FC<V> = ({\n  audioData, color, glow,\n  radialDiameter, radialInnerRadius, radialBarWidth, radialBarGap, radialBarRadius, radialBarOrigin,\n  minDb, maxDb, numberOfSamples,\n}) => {\n  const frame = useCurrentFrame();\n  const { fps } = useVideoConfig();\n  const raw = visualizeAudio({ fps, frame, audioData, numberOfSamples });\n\n  const radius = radialDiameter / 2;\n  const innerR = clamp(radialInnerRadius, 0, radius - radialBarWidth);\n  const maxBarHeight = radius - innerR;\n\n  // Number of bars = circumference of the inner ring divided by bar slot.\n  const slot = radialBarWidth + radialBarGap;\n  const circumference = 2 * Math.PI * innerR;\n  const nBars = Math.max(8, Math.floor(circumference / slot));\n\n  // Use the upper half of the spectrum (high-pass) and mirror it so the\n  // circle reads symmetrically — same trick Marcus's radial uses.\n  const sampleStep = Math.max(1, Math.floor(raw.length / nBars));\n  const halfBars = Array.from({ length: Math.floor(nBars / 2) }, (_, i) => {\n    const v = raw[Math.floor(raw.length / 2) + (i * sampleStep) % Math.floor(raw.length / 2)] ?? 0;\n    return processFftValue(v, minDb, maxDb);\n  });\n  const amplitudes = [...halfBars, ...halfBars.slice().reverse()];\n\n  // Multi-stop gradient — same pattern as bars but oriented along the\n  // bar's height (outward from the ring). Each color becomes a stop.\n  const colors = toColorArray(color);\n  const stops = colors.length === 1\n    ? [\n        { offset: '0%', color: colors[0], opacity: 1 },\n        { offset: '100%', color: colors[0], opacity: 0.4 },\n      ]\n    : colors.map((c, i) => ({\n        offset: `${(i / (colors.length - 1)) * 100}%`,\n        color: c,\n        opacity: 1,\n      }));\n  const tintColor = colors[0];\n\n  return (\n    <svg\n      width={radialDiameter}\n      height={radialDiameter}\n      viewBox={`0 0 ${radialDiameter} ${radialDiameter}`}\n      style={{ display: 'block', color: tintColor, filter: glow ? GLOW_FILTER : undefined }}\n    >\n      <defs>\n        <linearGradient id=\"ondaRadialGradient\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n          {stops.map((s, i) => (\n            <stop key={i} offset={s.offset} stopColor={s.color} stopOpacity={s.opacity} />\n          ))}\n        </linearGradient>\n      </defs>\n      {amplitudes.map((v, i) => {\n        const barHeight = Math.max(radialBarRadius * 2, v * maxBarHeight);\n        const x = radius;\n        // Position relative to the rotated coordinate system.\n        const y =\n          radialBarOrigin === 'outer' ? radius - barHeight\n          : radialBarOrigin === 'inner' ? radius\n          : radius - 0.5 * barHeight;\n        const yOffset =\n          radialBarOrigin === 'outer' ? radius\n          : radialBarOrigin === 'inner' ? innerR\n          : radius - 0.5 * (radius - innerR);\n        const angle = (360 * i) / amplitudes.length;\n\n        return (\n          <rect\n            key={i}\n            x={x} y={y}\n            width={radialBarWidth} height={barHeight}\n            rx={radialBarRadius}\n            fill=\"url(#ondaRadialGradient)\"\n            transform={`rotate(${angle} ${radius} ${radius}) translate(0 ${yOffset})`}\n          />\n        );\n      })}\n    </svg>\n  );\n};\n\nexport default AudioVisualizer;\n"
    },
    {
      "path": "registry/components/audio-visualizer/schema.ts",
      "type": "registry:component",
      "target": "components/onda/audio-visualizer/schema.ts",
      "content": "import { z } from 'zod';\nimport { placementSchema } from '../../../lib/canvas-schemas';\n\n// ─── schema ──────────────────────────────────────────────────────────\n\n/** Zod schema for {@link AudioVisualizer} props. */\nexport const audioVisualizerSchema = z.object({\n  /** Discriminator literal — matches this entry's registry slug. Auto-populated when omitted (`schema.parse({})` works as before). Lets consumers build `z.discriminatedUnion('kind', [...])` directly over onda schemas. */\n  kind: z.literal('audio-visualizer').default('audio-visualizer'),\n  /** URL or path to the audio file. */\n  src: z.string().default('https://www.w3schools.com/html/horse.mp3'),\n  /**\n   * Visualization variant:\n   * - `'bars'` — FFT bars (spectrum analyzer).\n   * - `'wave'` — parametric sine wave driven by audio RMS energy.\n   * - `'hills'` — filled smooth-curve \"mountains\" mirrored around a centerline.\n   * - `'radial'` — bars arranged in a circle, audio drives each ray.\n   */\n  variant: z.enum(['bars', 'wave', 'hills', 'radial']).default('bars'),\n  /** Width in px. */\n  width: z.number().default(640),\n  /** Height in px. */\n  height: z.number().default(160),\n  /**\n   * Accent color. Pass a single string for a one-tone visualizer, or an\n   * array for multi-color treatments — bars/radial render a vertical\n   * multi-stop gradient; wave/hills cycle through the array, one color\n   * per stacked line / copy. Default is Onda's two-tone accent ramp\n   * (rose → soft rose).\n   */\n  color: z\n    .union([z.string(), z.array(z.string()).min(1)])\n    .default(['var(--onda-accent, #D96B82)', 'var(--onda-accent-soft, #E89AAB)']),\n  /** Add a soft accent glow via `drop-shadow`. */\n  glow: z.boolean().default(true),\n\n  /** Lower bound (dB) for FFT normalization. Anything below maps to 0. */\n  minDb: z.number().default(-100),\n  /** Upper bound (dB) for FFT normalization. Anything above maps to 1. */\n  maxDb: z.number().default(-30),\n  /** FFT bin count (power of two). 256 = dense, 64 = chunky. */\n  numberOfSamples: z.number().int().default(256),\n\n  // ── bars-only ───────────────────────────────────────────────────────\n  // Each variant-specific prop carries an `only:<variant>` hint via\n  // `.describe()`. Tooling (the docs-site TryIt popover; future agent\n  // runtimes) can read these hints to hide / dim props that don't apply\n  // to the current `variant` value. The hint is in JSON Schema's\n  // `description` field, so it survives `zodToJsonSchema()` and is\n  // visible to anything consuming the composition contract.\n  /** Bar width in px. */\n  barWidth: z.number().min(1).default(4).describe('only:bars'),\n  /** Gap between bars in px. */\n  barGap: z.number().min(0).default(4).describe('only:bars'),\n  /** Corner radius for bars in px. */\n  barRadius: z.number().min(0).default(2).describe('only:bars'),\n  /** Vertical placement. */\n  barAlign: z.enum(['top', 'middle', 'bottom']).default('middle').describe('only:bars'),\n\n  // ── wave-only ───────────────────────────────────────────────────────\n  /** Number of sine-wave sections across the width. */\n  waveSections: z.number().int().min(2).default(12).describe('only:wave'),\n  /** Number of stacked wave lines. */\n  waveLines: z.number().int().min(1).default(2).describe('only:wave'),\n  /** Vertical gap between stacked wave lines in px. */\n  waveLineGap: z.number().min(0).default(16).describe('only:wave'),\n  /** Stroke thickness of each wave line in px. */\n  waveStrokeWidth: z.number().min(0.5).default(2).describe('only:wave'),\n  /** Horizontal scroll speed in px/sec — wave drifts left as audio plays. */\n  waveScrollSpeed: z.number().default(-160).describe('only:wave'),\n\n  // ── hills-only ──────────────────────────────────────────────────────\n  /** Number of bumps across the width. 8 reads natural. */\n  hillsBumps: z.number().int().min(2).default(8).describe('only:hills'),\n  /** Number of stacked hill copies for depth. */\n  hillsCopies: z.number().int().min(1).default(2).describe('only:hills'),\n  /** Vertical placement. `'middle'` mirrors above/below the centerline. */\n  hillsAlign: z.enum(['top', 'middle', 'bottom']).default('middle').describe('only:hills'),\n  /** Fill opacity for each hill copy. */\n  hillsFillOpacity: z.number().min(0).max(1).default(0.4).describe('only:hills'),\n  /** Stroke width for each hill copy. `0` = no outline. */\n  hillsStrokeWidth: z.number().min(0).default(0).describe('only:hills'),\n  /** Deterministic seed for the per-bump amplitude variation. */\n  hillsSeed: z.union([z.number(), z.string()]).default(42).describe('only:hills'),\n\n  // ── radial-only ─────────────────────────────────────────────────────\n  /** Diameter of the radial visualizer in px. Overrides width/height. */\n  radialDiameter: z.number().min(10).default(360).describe('only:radial'),\n  /** Inner radius — bars start outside this ring. */\n  radialInnerRadius: z.number().min(0).default(80).describe('only:radial'),\n  /** Bar thickness in px. */\n  radialBarWidth: z.number().min(1).default(4).describe('only:radial'),\n  /** Gap between adjacent radial bars in px (along the ring). */\n  radialBarGap: z.number().min(0).default(4).describe('only:radial'),\n  /** Bar corner radius in px. */\n  radialBarRadius: z.number().min(0).default(2).describe('only:radial'),\n  /** Where each bar grows from: outward, inward, or centered on the ring. */\n  radialBarOrigin: z.enum(['outer', 'inner', 'middle']).default('inner').describe('only:radial'),\n\n  /** Where on the canvas this sits. */\n  placement: placementSchema.optional(),\n});\n\n/** Inferred props for {@link AudioVisualizer}. */\nexport type AudioVisualizerProps = z.infer<typeof audioVisualizerSchema>;\n"
    },
    {
      "path": "registry/components/audio-visualizer/audio-visualizer.meta.json",
      "type": "registry:file",
      "target": "components/onda/audio-visualizer/audio-visualizer.meta.json",
      "content": "{\n  \"name\": \"audio-visualizer\",\n  \"title\": \"AudioVisualizer\",\n  \"description\": \"Renders animated bars (frequency-domain) or a waveform (time-domain) for an audio file. Does **not** play audio — pair with a parallel `AudioClip` for playback. Uses `useAudioData` from `@remotion/media-utils` (cached per `src`).\",\n  \"pickWhen\": \"the audio needs to be visible on screen — podcast clip, music drop, voiceover hero shot. Always pair with `audio-clip` for actual playback.\",\n  \"category\": \"media\",\n  \"tags\": [\n    \"audio\",\n    \"visualization\",\n    \"waveform\",\n    \"bars\",\n    \"fft\"\n  ],\n  \"dependencies\": [\n    \"remotion\",\n    \"@remotion/media-utils\",\n    \"zod\",\n    \"react\"\n  ]\n}\n"
    },
    {
      "path": "registry/components/audio-visualizer/README.md",
      "type": "registry:file",
      "target": "components/onda/audio-visualizer/README.md",
      "content": "# AudioVisualizer\n\nAnimated visualization of an audio file — four variants, all driven by the same dB-normalized FFT pipeline and rendered in SVG with Onda's accent treatment (single `color` prop + soft glow).\n\n**Does not play audio.** Pair with a parallel `AudioClip` pointing at the same `src` for audible playback.\n\n## Variants\n\n| Variant | What it shows |\n| --- | --- |\n| `'bars'` | Frequency-domain bars (spectrum analyzer). Each bar is one FFT bin. |\n| `'wave'` | Parametric sine wave whose amplitude is driven by the audio's RMS energy. Always smooth and flowing — the audio drives one scalar, not the shape. |\n| `'hills'` | Filled smooth-curve \"mountains\" mirrored around a centerline. Mid-frequency band drives the bump heights; per-bump variation is seed-deterministic. |\n| `'radial'` | Bars arranged in a circle, each driven by a high-frequency FFT bin. Mirrored so the circle reads symmetrically. |\n\nAll four use the same dB-normalization (`minDb..maxDb`) so the visual response is perceptually correct — raw FFT magnitudes sit below 0.1 and look dead without this.\n\n## Why it ships as one component (not four)\n\nAll four share the same `useAudioData` cache, the same `processFftValue` pipeline, the same Onda accent treatment, and most of the same props. Switching variants is a single prop change. The per-variant props (`bar*`, `wave*`, `hills*`, `radial*`) are namespaced so they don't collide.\n\n## Props\n\n### Universal\n\n| Name | Type | Default | Notes |\n| --- | --- | --- | --- |\n| `src` | `string` | sample URL | URL or path to the audio file. |\n| `variant` | `'bars' \\| 'wave' \\| 'hills' \\| 'radial'` | `'bars'` | Visualization style. |\n| `width` | `number` | `640` | Width in px (ignored by `'radial'` — use `radialDiameter`). |\n| `height` | `number` | `160` | Height in px (ignored by `'radial'`). |\n| `color` | `string \\| string[]` | `[\"#D96B82\", \"#E89AAB\"]` | Single color OR an array. Bars / radial render a multi-stop vertical gradient. Wave cycles colors per stacked line. Hills cycle per stacked copy. Default is Onda's two-tone accent ramp (rose → soft rose). |\n| `glow` | `boolean` | `true` | Soft accent glow via `drop-shadow`. |\n| `minDb` | `number` | `-100` | Lower dB bound for FFT normalization. |\n| `maxDb` | `number` | `-30` | Upper dB bound. |\n| `numberOfSamples` | `integer (power of two)` | `256` | FFT bin count. |\n| `placement` | `Placement?` | – | Canvas placement. |\n\n### `'bars'` variant\n\n| Name | Type | Default |\n| --- | --- | --- |\n| `barWidth` | `number` | `4` |\n| `barGap` | `number` | `4` |\n| `barRadius` | `number` | `2` |\n| `barAlign` | `'top' \\| 'middle' \\| 'bottom'` | `'middle'` |\n\n### `'wave'` variant\n\n| Name | Type | Default |\n| --- | --- | --- |\n| `waveSections` | `integer` | `12` |\n| `waveLines` | `integer` | `2` |\n| `waveLineGap` | `number` | `16` |\n| `waveStrokeWidth` | `number` | `2` |\n| `waveScrollSpeed` | `number` | `-160` |\n\n### `'hills'` variant\n\n| Name | Type | Default |\n| --- | --- | --- |\n| `hillsBumps` | `integer` | `8` |\n| `hillsCopies` | `integer` | `2` |\n| `hillsAlign` | `'top' \\| 'middle' \\| 'bottom'` | `'middle'` |\n| `hillsFillOpacity` | `number 0..1` | `0.4` |\n| `hillsStrokeWidth` | `number` | `0` |\n| `hillsSeed` | `number \\| string` | `42` |\n\n### `'radial'` variant\n\n| Name | Type | Default |\n| --- | --- | --- |\n| `radialDiameter` | `number` | `360` |\n| `radialInnerRadius` | `number` | `80` |\n| `radialBarWidth` | `number` | `4` |\n| `radialBarGap` | `number` | `4` |\n| `radialBarRadius` | `number` | `2` |\n| `radialBarOrigin` | `'outer' \\| 'inner' \\| 'middle'` | `'inner'` |\n\n## Usage\n\n```tsx\nimport { Composition } from 'remotion';\nimport { AudioVisualizer, audioVisualizerSchema } from './components/onda/audio-visualizer/AudioVisualizer';\n\n<Composition\n  id=\"Visualizer\"\n  component={AudioVisualizer}\n  durationInFrames={300}\n  fps={30}\n  width={1920}\n  height={1080}\n  schema={audioVisualizerSchema}\n  defaultProps={audioVisualizerSchema.parse({\n    src: '/music.mp3',\n    variant: 'wave',\n  })}\n/>\n```\n\nPaired with playback (the typical pattern):\n\n```tsx\n<AbsoluteFill>\n  <AudioClip src=\"/music.mp3\" />\n  <AudioVisualizer src=\"/music.mp3\" variant=\"hills\" placement=\"bottom\" />\n</AbsoluteFill>\n```\n\n## Implementation notes\n\n- **dB normalization is the secret.** `processFftValue(v, minDb, maxDb)` converts raw FFT magnitudes → decibels → 0..1. Without it, almost all bars sit between 0 and 0.1 of canvas height and look dead. Adjust `minDb` / `maxDb` to tune responsiveness for different content.\n- **`useAudioData` caches by `src`.** Multiple visualizers on the same audio file share one decode.\n- **`'wave'` doesn't render raw audio data.** It's a parametric sine wave; the audio only drives `amplitude` via RMS. Rendering raw amplitude data as a continuous shape pinches to zero at silent samples and looks broken.\n- **`'hills'` per-bump variation is deterministic.** Driven by `hillsSeed` via Remotion's `random()`.\n- **`'radial'` mirrors the FFT data.** Takes the upper half of the spectrum, mirrors it, so the circle reads symmetrically.\n\n## Color examples\n\n```tsx\n// Default — two-tone Onda accent\n<AudioVisualizer src=\"...\" variant=\"wave\" />\n\n// Single color, fully tinted\n<AudioVisualizer src=\"...\" variant=\"bars\" color=\"#D96B82\" />\n\n// Multi-color gradient on bars (top-to-bottom rainbow)\n<AudioVisualizer src=\"...\" variant=\"bars\" color={['#D96B82', '#E89AAB', '#F2F2F4']} />\n\n// Multi-color wave — each line gets its own hue\n<AudioVisualizer\n  src=\"...\"\n  variant=\"wave\"\n  waveLines={3}\n  color={['#D96B82', '#E89AAB', '#8E8E98']}\n/>\n\n// Multi-color hills — each copy gets its own fill\n<AudioVisualizer\n  src=\"...\"\n  variant=\"hills\"\n  hillsCopies={3}\n  color={['#D96B82', '#E89AAB', '#F2F2F4']}\n/>\n```\n\n## Inspiration\n\nVisual design ported (technique, not code) from [marcusstenbeck/remotion-audio-visualizers](https://github.com/marcusstenbeck/remotion-audio-visualizers). The signal-processing primitives (`processFftValue`, `getRms`) are standard WebAudio / W3C patterns reimplemented from scratch for our MIT-licensed catalog.\n"
    }
  ]
}
