audio/ui
Toggle Mode D
Audio UI
Copy Registry URL
Installation
Copy to Clipboardpnpm dlx shadcn@latest add @audio-ui/note-find
Usage
Copy to Clipboardimport { findNotes } from "@/components/audio-ui/piano-roll/edits"; import { NoteFind } from "@/components/audio-ui/note-find"; <NoteFind onFind={(query) => setSelection(findNotes(notes, query))} scale={scale} />;
NoteFind is a search button that opens the form in a popover. Pressing Select hands onFind a NoteQuery, and findNotes from the piano roll's edits (piano-roll/edits.ts) returns the ids of the notes it matches, ready to be a Piano roll's selection. The query is data, so it can also feed anything else that reads notes: a step sequencer, a list, an agent's tool.
Each field narrows the notes found, and an empty one sets no limit:
- Pitch: one pitch class, in any octave.
- Scale: in the scale or out of it. Off until
scaleis given. - State: active notes, or deactivated ones.
- Every: of the notes found, in the order they play, every second, third or fourth.
- Velocity (1 to 127), Length (in steps) and Chance %: a range, from and to, either end left open.
- The notes that do not match: finds the rest instead.
Without the popover
NoteFindForm is the form alone, to put in a sheet, a sidebar or a panel of your own:
Copy to Clipboardimport { NoteFindForm } from "@/components/audio-ui/note-find"; <NoteFindForm onFind={selectFound} scale={scale} />;
API reference
NoteFind
Props · 2
Fired with the query when Select is pressed.
The scale marked, which the Scale field reads. With
null, that field is off.NoteFindForm
Takes onFind and scale, and the props of a div.