MIDI Sonar

midi-sonarVisualizers

Sounding notes and fading echoes on a circular sweep.

$ pnpm dlx shadcn@latest add @pluginui/core-midi-sonar
Loading 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.json

Usage

Connect the documented props to your application or host.

example.tsx
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

PropTypeDefaultDescription
notes / timeTimed 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.
spannumber—Seconds of decay after note-off; held notes remain bright regardless of their duration.
maxNotesnumber512Bounded drawing budget, capped at 2,048 marks. Dense overloaded scores may omit marks.
low / highnumber—Optional MIDI pitch bounds. Omit both to fit the immutable score with a minimum two-octave window.
height / aria-labelnumber | string / string—Responsive canvas height and accessible description; no visible label is required.
background / ink / accent / mutedstring—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 slider and switch roles with live aria-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.