MIDI Sonar
midi-sonarVisualizersSounding notes and fading echoes on a circular sweep.
$ pnpm dlx shadcn@latest add @pluginui/core-midi-sonarLoading interactive preview…
Install
Copies the source into your project. Anything it depends on comes with it. Run this in your React project with shadcn initialized; no registry configuration is needed.
Pulls in
piano-roll-geometrycontrol-theme
Install using the registry URL
$ pnpm dlx shadcn@latest add https://pluginui.com/r/core-midi-sonar.jsonUsage
Connect the documented props to your application or host.
import { MidiSonar } from "@/components/ui/midi-sonar"
<MidiSonar notes={notes} time={playheadSeconds} mode="sonar" span={6} />About MIDI Sonar
A circular MIDI field with twelve pitch-class spokes and register mapped to radius. Held notes stay bright; note-off begins a soft decay, with an exact cutoff after the chosen span. Sonar adds a rotating sweep; orbit uses note age around the circle. The controlled playhead makes pause and seek repeatable. The renderer indexes note intervals, caps visible marks and bounds query work without a separate audio or device path.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| notes / time | Timed MIDI notes[] / number | — | Full immutable note intervals in absolute seconds and a host-owned playhead. |
| mode | "sonar" | "orbit" | "sonar" | Pitch-class radar or age-based circular note history. |
| span | number | — | Seconds of decay after note-off; held notes remain bright regardless of their duration. |
| maxNotes | number | 512 | Bounded drawing budget, capped at 2,048 marks. Dense overloaded scores may omit marks. |
| low / high | number | — | Optional MIDI pitch bounds. Omit both to fit the immutable score with a minimum two-octave window. |
| height / aria-label | number | string / string | — | Responsive canvas height and accessible description; no visible label is required. |
| background / ink / accent / muted | string | — | Shared composition colors, with UI-kit token defaults. |
Interaction
- Drag with pointer capture, so the gesture keeps tracking past the edge of the control.
- Shift while dragging for a fine pass; release it mid-gesture and coarse tracking resumes.
- Double-click resets to
defaultValue. - Arrow keys step normally, Shift+arrow steps finely, PageUp/PageDown jump by ten, Home/End go to the extremes.
- Proper
sliderandswitchroles with livearia-valuetext, so a screen reader announces the formatted value rather than the raw number. - The scroll wheel adjusts the value while the pointer is over the control; stepped ranges move at least one declared step per notch by default.