Piano Roll Visualizer

piano-roll-visualizerVisualizers

Falling notes or a scrolling river, driven by your MIDI playhead.

$ pnpm dlx shadcn@latest add @pluginui/core-piano-roll-visualizer
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-piano-roll-visualizer.json

Usage

Connect the documented props to your application or host.

example.tsx
import { PianoRollVisualizer } from "@/components/ui/piano-roll-visualizer"
<PianoRollVisualizer notes={notes} time={playheadSeconds} orientation="vertical" span={6} />
About Piano Roll Visualizer

An immersive display of absolute-time MIDI notes. Vertical mode drops future notes toward a strike line; horizontal mode turns the same notes into a river. Held notes light up and released notes fade. The host supplies notes and time; this component opens no devices and owns no transport. A bounded indexed window keeps long scores practical, and seeking redraws deterministically.

Props

PropTypeDefaultDescription
notes / timeTimed MIDI notes[] / number—Immutable notes in absolute seconds and the host playhead. Each note has midi, time, duration, velocity, and optional voice.
orientation"vertical" | "horizontal""vertical"Falling notes or a horizontal note river.
span / maxNotesnumber / number4 / 512Visible time window in seconds and the maximum painted-note budget. Does not alter playback.
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—One shared palette for the entire composition. Omit to use UI-kit tokens.

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.