{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "bar-visualizer-demo",
  "title": "Bar Visualizer Demo",
  "description": "A worked example of Bar Visualizer: Frequency bars for audio on its way out, the counterpart to the trace a microphone draws on the way in.",
  "dependencies": [
    "lucide-react@^1.31.0"
  ],
  "registryDependencies": [
    "https://ui.tinkererslabs.com/r/bar-visualizer.json"
  ],
  "files": [
    {
      "path": "components/demos/bar-visualizer-demo.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Pause, Play } from \"lucide-react\"\n\nimport { SAMPLE_AUDIO } from \"@/components/demos/audio-fixtures\"\nimport { BarVisualizer } from \"@/registry/default/bar-visualizer/bar-visualizer\"\n\nexport function BarVisualizerDemo() {\n  const audioRef = React.useRef<HTMLAudioElement>(null)\n  const [element, setElement] = React.useState<HTMLAudioElement | null>(null)\n  const [speaking, setSpeaking] = React.useState(false)\n\n  React.useEffect(() => setElement(audioRef.current), [])\n\n  return (\n    <div className=\"border-border bg-background flex w-full max-w-md items-center gap-3 rounded-xl border p-3\">\n      <audio\n        ref={audioRef}\n        src={SAMPLE_AUDIO}\n        preload=\"metadata\"\n        onPlay={() => setSpeaking(true)}\n        onPause={() => setSpeaking(false)}\n        onEnded={() => setSpeaking(false)}\n      />\n\n      <button\n        type=\"button\"\n        aria-label={speaking ? \"Stop the reply\" : \"Play the reply\"}\n        onClick={() => {\n          const audio = audioRef.current\n          if (!audio) return\n          if (speaking) audio.pause()\n          else void audio.play().catch(() => {})\n        }}\n        className=\"bg-foreground text-background focus-visible:ring-ring inline-flex size-10 shrink-0 items-center justify-center rounded-full focus-visible:ring-2 focus-visible:outline-none\"\n      >\n        {speaking ? (\n          <Pause aria-hidden=\"true\" size={16} />\n        ) : (\n          <Play aria-hidden=\"true\" size={16} />\n        )}\n      </button>\n\n      <BarVisualizer\n        source={element}\n        state={speaking ? \"speaking\" : \"idle\"}\n        className=\"h-10 flex-1\"\n      />\n    </div>\n  )\n}\n",
      "type": "registry:example"
    },
    {
      "path": "components/demos/audio-fixtures.ts",
      "content": "import type { TranscriptLine } from \"@/registry/default/audio-player/audio-player\"\n\nexport const SAMPLE_AUDIO = \"/demo/audio/voice-note.m4a\"\n\n/**\n * Timed from the four clips this file was assembled out of, so every line\n * starts on the word it names rather than near it.\n */\nexport const voiceNote: TranscriptLine[] = [\n  { start: 0, end: 1.52, text: \"Quick note before I forget.\" },\n  {\n    start: 1.87,\n    end: 5.07,\n    text: \"The upload retry is firing twice when the network drops.\",\n  },\n  {\n    start: 5.42,\n    end: 8.1,\n    text: \"I think the listener gets added again on reconnect.\",\n  },\n  {\n    start: 8.45,\n    end: 11.88,\n    text: \"I'll push a fix this afternoon, but I wanted it written down.\",\n  },\n]\n\nexport const SAMPLE_VIDEO = \"/demo/video/screen-note.mp4\"\n\nexport const videoCaptions = [\n  {\n    src: \"/demo/video/screen-note.vtt\",\n    srcLang: \"en\",\n    label: \"English\",\n    default: true,\n  },\n]\n",
      "type": "registry:example"
    }
  ],
  "type": "registry:example"
}