{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "example-signal-synth",
  "type": "registry:block",
  "title": "Signal Synth",
  "description": "Complete Tailwind instrument face: mixed-size knobs, rank faders, switches, LCD, editable filter, envelope and modulation window. Silent UI assembly.",
  "dependencies": [
    "@base-ui/react",
    "maruaudio@>=0.0.3 <0.1.0"
  ],
  "registryDependencies": [
    "https://pluginui.com/r/core-console-button.json",
    "https://pluginui.com/r/core-dot-matrix-display.json",
    "https://pluginui.com/r/core-envelope-display.json",
    "https://pluginui.com/r/core-eq-editor.json",
    "https://pluginui.com/r/core-fader.json",
    "https://pluginui.com/r/core-knob.json",
    "https://pluginui.com/r/core-lfo-visualizer.json",
    "https://pluginui.com/r/core-toggle-switch.json"
  ],
  "files": [
    {
      "path": "components/blocks/signal-synth.tsx",
      "content": "/**\n * Source: https://pluginui.com/examples/signal-synth\n * Copyright © [Maru](https://maru.audio)\n *\n * Maru UI Kit — https://maru.audio/ui-kit\n *\n * Installed from the Maru UI registry. This file is yours now: edit it\n * freely, it will not be overwritten unless you re-run the add command.\n *\n * Keep this item’s companion files and CSS imports together. Dependencies\n * declared by the registry are installed with the source.\n */\nimport { formatControlValue } from \"maruaudio/ui/shared/format\"\nimport { UI_KIT_TEXT_SELECTION_STYLES } from \"maruaudio/ui/shared/portable-styles\"\nimport { THEMED_DISPLAY_PRESET } from \"maruaudio/ui/shared/display-chrome\"\nimport { useState, type ReactNode } from \"react\"\nimport { Knob } from \"@/components/ui/knob\"\nimport { Fader } from \"@/components/ui/fader\"\nimport {\n  EnvelopeDisplay,\n  type ADSR,\n} from \"@/components/ui/envelope-display\"\nimport {\n  EQEditor,\n  type EQEditorBand,\n} from \"@/components/ui/eq-editor\"\nimport { LFOVisualizer } from \"@/components/ui/lfo-visualizer\"\nimport { DotMatrixDisplay } from \"@/components/ui/dot-matrix-display\"\nimport { ConsoleButton } from \"@/components/ui/console-button\"\nimport { ToggleSwitch } from \"@/components/ui/toggle-switch\"\nimport { token } from \"maruaudio/ui/shared/theme\"\n\nconst initialEnvelope: ADSR = {\n  attack: 0.08,\n  decay: 0.3,\n  sustain: 0.6,\n  release: 1.2,\n}\nconst initialFilter: EQEditorBand[] = [\n  {\n    type: \"lowpass\",\n    freq: 2400,\n    gain: 0,\n    q: 0.7,\n    label: \"Cutoff\",\n    gainRange: null,\n  },\n]\n\nfunction Panel({\n  number,\n  title,\n  children,\n}: {\n  number: string\n  title: string\n  children: ReactNode\n}) {\n  return (\n    <section\n      className=\"min-w-0 space-y-4 border p-4\"\n      style={{ borderColor: token.border, borderRadius: token.radius }}\n    >\n      <h4\n        className=\"flex items-center gap-3 text-[10px] tracking-[0.18em] uppercase\"\n        style={{ color: token.textMuted }}\n      >\n        <span style={{ color: token.accent }}>{number}</span>\n        {title}\n      </h4>\n      {children}\n    </section>\n  )\n}\n/** Indexed panels follow Auto Wah; ranks/envelope/modulation follow Strings Ensemble.\n * This portable block owns only silent visual state, never the modules' processing. */\nexport function SignalSynth() {\n  const [envelope, setEnvelope] = useState(initialEnvelope)\n  const [bands, setBands] = useState(initialFilter)\n  const [rate, setRate] = useState(2.4)\n  const [hold, setHold] = useState(false)\n  const filter = bands[0]!\n  return (\n    <section\n      data-text-selection=\"editable-only\"\n      className=\"relative w-full min-w-0 space-y-5 border p-4 sm:p-6\"\n      style={{\n        background: token.surface,\n        color: token.text,\n        borderColor: token.border,\n        borderRadius: token.radius,\n        fontFamily: token.font,\n      }}\n    >\n      <style>{UI_KIT_TEXT_SELECTION_STYLES}</style>\n      <header\n        className=\"flex flex-wrap items-center justify-between gap-4 border-b pb-5\"\n        style={{ borderColor: token.border }}\n      >\n        <div>\n          <p\n            className=\"mb-1 text-[10px] tracking-[0.2em] uppercase\"\n            style={{ color: token.textMuted }}\n          >\n            Polyphonic instrument / edition 01\n          </p>\n          <h3 className=\"text-3xl font-semibold tracking-tight\">\n            SIGNAL<span style={{ color: token.accent }}> / 01</span>\n          </h3>\n        </div>\n        <div className=\"max-w-full overflow-x-auto\">\n          <DotMatrixDisplay\n            label=\"Patch memory\"\n            text={[\n              \"SOFT STRINGS\",\n              `${formatControlValue(filter.freq, \"Hz\")} LP`,\n            ]}\n            columns={16}\n            pitch={1.6}\n            preset={THEMED_DISPLAY_PRESET}\n          />\n        </div>\n        <ToggleSwitch label=\"Power\" variant=\"stomp\" defaultChecked />\n      </header>\n      <div className=\"grid items-start gap-4 md:grid-cols-2\">\n        <Panel number=\"01\" title=\"Oscillator ranks\">\n          <div className=\"flex flex-wrap items-center justify-around gap-4\">\n            <Knob\n              label=\"Spread\"\n              defaultValue={0.65}\n              size={76}\n              indicator=\"dot\"\n            />\n            <Knob label=\"Detune\" defaultValue={0.2} size={52} indicator=\"dot\" />\n            {[\"16′\", \"8′\", \"4′\"].map((label, i) => (\n              <Fader\n                key={label}\n                label={label}\n                defaultValue={[0.7, 0.9, 0.4][i]}\n                min={0}\n                max={1}\n                length={112}\n                thickness={22}\n                ticks={5}\n              />\n            ))}\n          </div>\n          <div\n            className=\"flex items-center justify-between gap-3 border-t pt-3\"\n            style={{ borderColor: token.border }}\n          >\n            <ToggleSwitch\n              label=\"Sub voice\"\n              variant=\"lever\"\n              defaultChecked\n              hideValue\n            />\n            <ToggleSwitch\n              label=\"Ensemble\"\n              variant=\"rocker\"\n              defaultChecked\n              hideValue\n            />\n          </div>\n        </Panel>\n        <Panel number=\"02\" title=\"Filter window\">\n          <EQEditor\n            bands={bands}\n            onBandsChange={setBands}\n            height={150}\n            showLabels={false}\n            showAxisLabels\n            handleLabels=\"none\"\n          />\n          <div className=\"flex flex-wrap items-center justify-around gap-4\">\n            <Knob\n              label=\"Cutoff\"\n              min={20}\n              max={20000}\n              value={filter.freq}\n              onChange={(freq) => setBands([{ ...filter, freq }])}\n              curve=\"log\"\n              unit=\"Hz\"\n              size={76}\n              indicator=\"dot\"\n            />\n            <Knob\n              label=\"Resonance\"\n              min={0.1}\n              max={10}\n              value={filter.q}\n              onChange={(q) => setBands([{ ...filter, q }])}\n              size={52}\n              indicator=\"dot\"\n            />\n            <Knob label=\"Drive\" defaultValue={0.2} size={40} indicator=\"line\" />\n          </div>\n        </Panel>\n        <Panel number=\"03\" title=\"Amplitude envelope\">\n          <EnvelopeDisplay\n            value={envelope}\n            onChange={setEnvelope}\n            height={150}\n          />\n          <div className=\"flex flex-wrap justify-around gap-3\">\n            {([\"attack\", \"decay\", \"sustain\", \"release\"] as const).map((key) => (\n              <Knob\n                key={key}\n                label={key}\n                value={envelope[key]}\n                min={0}\n                max={key === \"sustain\" ? 1 : 3}\n                unit={key === \"sustain\" ? \"\" : \"s\"}\n                size={40}\n                onChange={(value) =>\n                  setEnvelope((current) => ({ ...current, [key]: value }))\n                }\n              />\n            ))}\n          </div>\n        </Panel>\n        <Panel number=\"04\" title=\"Motion & output\">\n          <LFOVisualizer\n            frequency={rate}\n            paused={hold}\n            height={100}\n            aria-label=\"Modulation waveform\"\n          />\n          <div className=\"flex flex-wrap items-center justify-around gap-4\">\n            <Knob\n              label=\"Rate\"\n              value={rate}\n              onChange={setRate}\n              min={0.1}\n              max={12}\n              unit=\"Hz\"\n              size={52}\n              indicator=\"dot\"\n            />\n            <Knob label=\"Depth\" defaultValue={0.35} size={40} />\n            <Fader\n              label=\"Output\"\n              defaultValue={0.75}\n              min={0}\n              max={1}\n              length={90}\n              thickness={22}\n            />\n            <ConsoleButton\n              variant={hold ? \"primary\" : \"outline\"}\n              onClick={() => setHold((value) => !value)}\n              aria-pressed={hold}\n            >\n              Hold motion\n            </ConsoleButton>\n          </div>\n        </Panel>\n      </div>\n      <footer\n        className=\"flex flex-wrap justify-between gap-3 border-t pt-4 text-[10px] tracking-widest uppercase\"\n        style={{ borderColor: token.border, color: token.textMuted }}\n      >\n        <span>16 voices / stereo ensemble</span>\n        <ConsoleButton\n          size=\"sm\"\n          variant=\"outline\"\n          onClick={() => {\n            setEnvelope(initialEnvelope)\n            setBands(initialFilter)\n            setRate(2.4)\n            setHold(false)\n          }}\n        >\n          Reset filter & modulation\n        </ConsoleButton>\n      </footer>\n    </section>\n  )\n}\n",
      "type": "registry:component",
      "target": "@components/blocks/signal-synth.tsx"
    }
  ]
}
